Prepopulate the memoryCache with data:uri images.

This patch prepopulates the memoryCache for data:uri  images, fixing a
long-standing bug where data uri  subresources did not load for SVG images
(network loads are still disabled).

The two large changes are the following new methods:
1) resourceFromDataURIRequest has been added which returns a resource from a
data uri request. This function was placed on CachedResource because it  needs
to use the createResource helper function. I hope this function can be re-used
in a followup patch to reduce memory in data uri handling.

2) preCacheDataURIImage has been added which simply prefills the memory cache
with a data uri image.

----------------

Update after rollout: Several changes were needed to address test failures:

1) fast/backgrounds/solid-color-context-restore.html
This test was written 7 years ago and no longer tests what it should. The test
relied on a solid color data image being drawn before a selection rect changed
but the image was not actually drawing since data urls loaded and drew
asynchronously.
After this change, the bug in this test was exposed and the image would draw
after the selection changed. This patch removes this test entirely. The bug it
fixed only affected ImageMac which no longer exists. See wkbug.com/10158.

2) fast/forms/basic-buttons.html
This test relied on images not loading synchronously and the image size values
were checked in as 0. This test just needs a rebaseline to correctly set the
image sizes in the expectations.

3) http/tests/inspector/network/image-as-text-loading-data-url.html
This test was for pretty-printing very long data url errors. Because data image
loads no longer touch the network, the error message is no longer printed for
images. I have updated this test to use a long script data url instead of an
image. The test has been renamed "script-as-text-loading-data-url.html".

4) virtual/softwarecompositing/tiling/huge-layer-img.html
This test just needed a rebaseline.

5) I have added two tests to prove synchronicity:
data-uri-images-load-synchronously.html
data-uri-images-reload-synchronously.html
The first is a test for the specific change exposed by
fast/forms/basic-buttons.html: image sizes are now available synchronously. The
second verifies that we do not reload data uris but instead pull them from the
cache.

Lastly, this updated patch no longer checks for incorrect resource types coming
from the cache. This was redundant with a check in determineRevalidationPolicy.

BUG=224317
[email protected]

Review URL: https://codereview.chromium.org/16433002

git-svn-id: svn://svn.chromium.org/blink/trunk@152093 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/third_party/WebKit/LayoutTests/loader/data-uri-images-load-synchronously.html b/third_party/WebKit/LayoutTests/loader/data-uri-images-load-synchronously.html
new file mode 100644
index 0000000..7746f5b5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/loader/data-uri-images-load-synchronously.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<body>
+Test for crbug.com/224317: data:uri images should load synchronously.<br/>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    var image = new Image();
+    image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAnklEQVR42u3QMQEAAAgDoGlyo1vBzwciUJlw1ApkyZIlS5YsBbJkyZIlS5YCWbJkyZIlS4EsWbJkyZKlQJYsWbJkyVIgS5YsWbJkKZAlS5YsWbIUyJIlS5YsWQpkyZIlS5YsBbJkyZIlS5YCWbJkyZIlS4EsWbJkyZKlQJYsWbJkyVIgS5YsWbJkKZAlS5YsWbIUyJIlS5YsWQpkyfq2MosBSIeKONMAAAAASUVORK5CYII=";
+
+    if (image.width == 100 && image.height == 100)
+        document.write("PASS");
+    else
+        document.write("FAIL");
+</script>
+</body>
+</html>