[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

jianli at chromium.org jianli at chromium.org
Wed Dec 22 11:53:54 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 51ceb756c9f2b1d9699aa49fa0f27c1afb456411
Author: jianli at chromium.org <jianli at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 11 00:03:19 2010 +0000

    Add the support to register the blob data.
    https://bugs.webkit.org/show_bug.cgi?id=43600
    
    Reviewed by David Levin.
    
    This is the first step towards adding Blob URL support. The blob has
    an internal URL (used by FileReader) and public URLs (used by Blob.url).
    The URL and its associated data are managed by BlobRegistry interface.
    
    This patch does not remove the usage of BlobItem. It will be removed
    when all the blob data support is hooked up and the new tests will be
    added then.
    
    * CMakeLists.txt:
    * GNUmakefile.am:
    * WebCore.gypi:
    * WebCore.pro:
    * WebCore.vcproj/WebCore.vcproj:
    * WebCore.xcodeproj/project.pbxproj:
    * bindings/js/SerializedScriptValue.cpp:
    (WebCore::SerializedBlob::create):
    (WebCore::SerializedBlob::url):
    (WebCore::SerializedBlob::type):
    (WebCore::SerializedBlob::size):
    (WebCore::SerializedBlob::SerializedBlob):
    (WebCore::SerializedFile::create):
    (WebCore::SerializedFile::path):
    (WebCore::SerializedFile::url):
    (WebCore::SerializedFile::type):
    (WebCore::SerializedFile::SerializedFile):
    (WebCore::SerializedFileList::item):
    (WebCore::SerializedFileList::SerializedFileList):
    (WebCore::SerializedScriptValueData::SerializedScriptValueData):
    (WebCore::SharedSerializedData::asBlob):
    (WebCore::SharedSerializedData::asFile):
    (WebCore::SerializingTreeWalker::convertIfTerminal):
    (WebCore::DeserializingTreeWalker::convertIfTerminal):
    (WebCore::TeardownTreeWalker::convertIfTerminal):
    * bindings/js/SerializedScriptValue.h:
    (WebCore::SerializedScriptValueData::):
    (WebCore::SerializedScriptValueData::asString):
    (WebCore::SerializedScriptValueData::asBlob):
    (WebCore::SerializedScriptValueData::asFile):
    * bindings/v8/SerializedScriptValue.cpp:
    (WebCore::ZigZag::Writer::writeBlob):
    (WebCore::ZigZag::Writer::writeFile):
    (WebCore::ZigZag::Writer::writeFileList):
    (WebCore::ZigZag::Writer::doWriteUintHelper):
    (WebCore::ZigZag::Writer::doWriteUint32):
    (WebCore::ZigZag::Writer::doWriteUint64):
    (WebCore::ZigZag::Serializer::writeBlob):
    (WebCore::ZigZag::Serializer::writeFile):
    (WebCore::ZigZag::Reader::readBlob):
    (WebCore::ZigZag::Reader::readFile):
    (WebCore::ZigZag::Reader::readFileList):
    (WebCore::ZigZag::Reader::doReadUintHelper):
    (WebCore::ZigZag::Reader::doReadUint32):
    (WebCore::ZigZag::Reader::doReadUint64):
    * dom/ScriptExecutionContext.cpp:
    (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
    (WebCore::ScriptExecutionContext::trackBlobURL):
    (WebCore::ScriptExecutionContext::revokeBlobURL):
    * dom/ScriptExecutionContext.h:
    * html/Blob.cpp:
    (WebCore::Blob::Blob):
    (WebCore::Blob::~Blob):
    (WebCore::Blob::createPublicURL):
    * html/Blob.h:
    (WebCore::Blob::create):
    (WebCore::Blob::url):
    * html/BlobRegistryImpl.cpp: Added.
    * html/BlobRegistryImpl.h: Added.
    * html/BlobStorageData.h: Added.
    * html/BlobURL.cpp: Added.
    * html/BlobURL.h: Added.
    * html/File.cpp:
    (WebCore::File::File):
    * html/File.h:
    (WebCore::File::create):
    * platform/BlobData.cpp: Added.
    * platform/BlobData.h: Added.
    * platform/BlobRegistry.h: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65102 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index 0d4625c..3d85f6b 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -931,6 +931,8 @@ SET(WebCore_SOURCES
     html/AsyncImageResizer.cpp
     html/Blob.cpp
     html/BlobBuilder.cpp
+    html/BlobRegistryImpl.cpp
+    html/BlobURL.cpp
     html/CollectionCache.cpp
     html/CSSPreloadScanner.cpp
     html/DOMDataGridDataSource.cpp
@@ -1194,6 +1196,7 @@ SET(WebCore_SOURCES
     page/animation/KeyframeAnimation.cpp
 
     platform/Arena.cpp
+    platform/BlobData.cpp
     platform/BlobItem.cpp
     platform/ContentType.cpp
     platform/ContextMenu.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 680f610..9955b32 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,88 @@
+2010-08-10  Jian Li  <jianli at chromium.org>
+
+        Reviewed by David Levin.
+
+        Add the support to register the blob data.
+        https://bugs.webkit.org/show_bug.cgi?id=43600
+
+        This is the first step towards adding Blob URL support. The blob has
+        an internal URL (used by FileReader) and public URLs (used by Blob.url).
+        The URL and its associated data are managed by BlobRegistry interface.
+
+        This patch does not remove the usage of BlobItem. It will be removed
+        when all the blob data support is hooked up and the new tests will be
+        added then.
+
+        * CMakeLists.txt:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/SerializedScriptValue.cpp:
+        (WebCore::SerializedBlob::create):
+        (WebCore::SerializedBlob::url):
+        (WebCore::SerializedBlob::type):
+        (WebCore::SerializedBlob::size):
+        (WebCore::SerializedBlob::SerializedBlob):
+        (WebCore::SerializedFile::create):
+        (WebCore::SerializedFile::path):
+        (WebCore::SerializedFile::url):
+        (WebCore::SerializedFile::type):
+        (WebCore::SerializedFile::SerializedFile):
+        (WebCore::SerializedFileList::item):
+        (WebCore::SerializedFileList::SerializedFileList):
+        (WebCore::SerializedScriptValueData::SerializedScriptValueData):
+        (WebCore::SharedSerializedData::asBlob):
+        (WebCore::SharedSerializedData::asFile):
+        (WebCore::SerializingTreeWalker::convertIfTerminal):
+        (WebCore::DeserializingTreeWalker::convertIfTerminal):
+        (WebCore::TeardownTreeWalker::convertIfTerminal):
+        * bindings/js/SerializedScriptValue.h:
+        (WebCore::SerializedScriptValueData::):
+        (WebCore::SerializedScriptValueData::asString):
+        (WebCore::SerializedScriptValueData::asBlob):
+        (WebCore::SerializedScriptValueData::asFile):
+        * bindings/v8/SerializedScriptValue.cpp:
+        (WebCore::ZigZag::Writer::writeBlob):
+        (WebCore::ZigZag::Writer::writeFile):
+        (WebCore::ZigZag::Writer::writeFileList):
+        (WebCore::ZigZag::Writer::doWriteUintHelper):
+        (WebCore::ZigZag::Writer::doWriteUint32):
+        (WebCore::ZigZag::Writer::doWriteUint64):
+        (WebCore::ZigZag::Serializer::writeBlob):
+        (WebCore::ZigZag::Serializer::writeFile):
+        (WebCore::ZigZag::Reader::readBlob):
+        (WebCore::ZigZag::Reader::readFile):
+        (WebCore::ZigZag::Reader::readFileList):
+        (WebCore::ZigZag::Reader::doReadUintHelper):
+        (WebCore::ZigZag::Reader::doReadUint32):
+        (WebCore::ZigZag::Reader::doReadUint64):
+        * dom/ScriptExecutionContext.cpp:
+        (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
+        (WebCore::ScriptExecutionContext::trackBlobURL):
+        (WebCore::ScriptExecutionContext::revokeBlobURL):
+        * dom/ScriptExecutionContext.h:
+        * html/Blob.cpp:
+        (WebCore::Blob::Blob):
+        (WebCore::Blob::~Blob):
+        (WebCore::Blob::createPublicURL):
+        * html/Blob.h:
+        (WebCore::Blob::create):
+        (WebCore::Blob::url):
+        * html/BlobRegistryImpl.cpp: Added.
+        * html/BlobRegistryImpl.h: Added.
+        * html/BlobStorageData.h: Added.
+        * html/BlobURL.cpp: Added.
+        * html/BlobURL.h: Added.
+        * html/File.cpp:
+        (WebCore::File::File):
+        * html/File.h:
+        (WebCore::File::create):
+        * platform/BlobData.cpp: Added.
+        * platform/BlobData.h: Added.
+        * platform/BlobRegistry.h: Added.
+
 2010-08-10  Adam Barth  <abarth at webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 065c056..676eb85 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -1314,6 +1314,11 @@ webcore_sources += \
 	WebCore/html/Blob.h \
 	WebCore/html/BlobBuilder.cpp \
 	WebCore/html/BlobBuilder.h \
+	WebCore/html/BlobRegistryImpl.cpp \
+	WebCore/html/BlobRegistryImpl.h \
+	WebCore/html/BlobStorageData.h \
+	WebCore/html/BlobURL.cpp \
+	WebCore/html/BlobURL.h \
 	WebCore/html/canvas/CanvasContextAttributes.h \
 	WebCore/html/canvas/CanvasGradient.cpp \
 	WebCore/html/canvas/CanvasGradient.h \
@@ -1870,8 +1875,11 @@ webcore_sources += \
 	WebCore/platform/Arena.cpp \
 	WebCore/platform/Arena.h \
 	WebCore/platform/AutodrainedPool.h \
+	WebCore/platform/BlobData.cpp \
+	WebCore/platform/BlobData.h \
 	WebCore/platform/BlobItem.cpp \
 	WebCore/platform/BlobItem.h \
+	WebCore/platform/BlobRegistry.h \
 	WebCore/platform/ContentType.cpp \
 	WebCore/platform/ContentType.h \
 	WebCore/platform/ContextMenu.cpp \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 9583e3a..108f165 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -1432,6 +1432,11 @@
             'html/Blob.h',
             'html/BlobBuilder.cpp',
             'html/BlobBuilder.h',
+            'html/BlobRegistryImpl.cpp',
+            'html/BlobRegistryImpl.h',
+            'html/BlobStorageData.h',
+            'html/BlobURL.cpp',
+            'html/BlobURL.h',
             'html/canvas/ArrayBufferView.cpp',
             'html/canvas/ArrayBufferView.h',
             'html/canvas/ArrayBuffer.cpp',
@@ -2989,8 +2994,11 @@
             'platform/Arena.cpp',
             'platform/Arena.h',
             'platform/AutodrainedPool.h',
+            'platform/BlobData.cpp',
+            'platform/BlobData.h',
             'platform/BlobItem.cpp',
             'platform/BlobItem.h',
+            'platform/BlobRegistry.h',
             'platform/ContentType.cpp',
             'platform/ContentType.h',
             'platform/ContextMenu.cpp',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 12cb818..4f0af1c 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -625,6 +625,8 @@ SOURCES += \
     html/AsyncImageResizer.cpp \
     html/Blob.cpp \
     html/BlobBuilder.cpp \
+    html/BlobRegistryImpl.cpp \
+    html/BlobURL.cpp \
     html/canvas/CanvasGradient.cpp \
     html/canvas/CanvasPattern.cpp \
     html/canvas/CanvasPixelArray.cpp \
@@ -867,6 +869,7 @@ SOURCES += \
     platform/animation/Animation.cpp \
     platform/animation/AnimationList.cpp \
     platform/Arena.cpp \
+    platform/BlobData.cpp \
     platform/BlobItem.cpp \
     platform/text/Base64.cpp \
     platform/text/BidiContext.cpp \
@@ -1390,6 +1393,9 @@ HEADERS += \
     html/AsyncImageResizer.h \
     html/Blob.h \
     html/BlobBuilder.h \
+    html/BlobRegistryImp.h \
+    html/BlobStorageData.h \
+    html/BlobURL.h \
     html/canvas/CanvasGradient.h \
     html/canvas/CanvasPattern.h \
     html/canvas/CanvasPixelArray.h \
@@ -1641,7 +1647,9 @@ HEADERS += \
     platform/animation/Animation.h \
     platform/animation/AnimationList.h \
     platform/Arena.h \
+    platform/BlobData.h \
     platform/BlobItem.h \
+    platform/BlobRegistry.h \
     platform/ContentType.h \
     platform/ContextMenu.h \
     platform/CrossThreadCopier.h \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 7333067..155a816 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -23241,6 +23241,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\platform\BlobData.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\platform\BlobData.h"
+				>
+			</File>
+			<File
 				RelativePath="..\platform\BlobItem.cpp"
 				>
 			</File>
@@ -23249,6 +23257,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\platform\BlobRegistry.h"
+				>
+			</File>
+			<File
 				RelativePath="..\platform\ContentType.cpp"
 				>
 			</File>
@@ -36245,6 +36257,26 @@
 				>
 			</File>
 			<File
+				RelativePath="..\html\BlobRegistryImpl.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\html\BlobRegistryImpl.h"
+				>
+			</File>
+			<File
+				RelativePath="..\html\BlobStorageData.h"
+				>
+			</File>
+			<File
+				RelativePath="..\html\BlobURL.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\html\BlobURL.h"
+				>
+			</File>
+			<File
 				RelativePath="..\html\canvas\CanvasGradient.cpp"
 				>
 			</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index daa154d..29514e3 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -708,6 +708,14 @@
 		2ECF7AE210162B5800427DE7 /* ErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ECF7ADF10162B5800427DE7 /* ErrorEvent.h */; };
 		2ED609BC1145B07100C8684E /* DOMFormData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2ED609BA1145B07100C8684E /* DOMFormData.cpp */; };
 		2ED609BD1145B07100C8684E /* DOMFormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2ED609BB1145B07100C8684E /* DOMFormData.h */; };
+		2EED575212109ED0007656BB /* BlobRegistryImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EED574D12109ED0007656BB /* BlobRegistryImpl.cpp */; };
+		2EED575312109ED0007656BB /* BlobRegistryImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EED574E12109ED0007656BB /* BlobRegistryImpl.h */; };
+		2EED575412109ED0007656BB /* BlobStorageData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EED574F12109ED0007656BB /* BlobStorageData.h */; };
+		2EED575512109ED0007656BB /* BlobURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EED575012109ED0007656BB /* BlobURL.cpp */; };
+		2EED575612109ED0007656BB /* BlobURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EED575112109ED0007656BB /* BlobURL.h */; };
+		2EED575812109EE4007656BB /* BlobRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EED575712109EE4007656BB /* BlobRegistry.h */; };
+		2EED575B12109EF3007656BB /* BlobData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2EED575912109EF3007656BB /* BlobData.cpp */; };
+		2EED575C12109EF3007656BB /* BlobData.h in Headers */ = {isa = PBXBuildFile; fileRef = 2EED575A12109EF3007656BB /* BlobData.h */; };
 		31288E720E3005D6003619AE /* WebKitCSSKeyframeRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31288E6E0E3005D6003619AE /* WebKitCSSKeyframeRule.cpp */; };
 		31288E730E3005D6003619AE /* WebKitCSSKeyframeRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 31288E6F0E3005D6003619AE /* WebKitCSSKeyframeRule.h */; };
 		31288E740E3005D6003619AE /* WebKitCSSKeyframesRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31288E700E3005D6003619AE /* WebKitCSSKeyframesRule.cpp */; };
@@ -6457,6 +6465,14 @@
 		2ECF7AE010162B5800427DE7 /* ErrorEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ErrorEvent.idl; sourceTree = "<group>"; };
 		2ED609BA1145B07100C8684E /* DOMFormData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMFormData.cpp; sourceTree = "<group>"; };
 		2ED609BB1145B07100C8684E /* DOMFormData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFormData.h; sourceTree = "<group>"; };
+		2EED574D12109ED0007656BB /* BlobRegistryImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobRegistryImpl.cpp; sourceTree = "<group>"; };
+		2EED574E12109ED0007656BB /* BlobRegistryImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobRegistryImpl.h; sourceTree = "<group>"; };
+		2EED574F12109ED0007656BB /* BlobStorageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobStorageData.h; sourceTree = "<group>"; };
+		2EED575012109ED0007656BB /* BlobURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobURL.cpp; sourceTree = "<group>"; };
+		2EED575112109ED0007656BB /* BlobURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobURL.h; sourceTree = "<group>"; };
+		2EED575712109EE4007656BB /* BlobRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobRegistry.h; sourceTree = "<group>"; };
+		2EED575912109EF3007656BB /* BlobData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobData.cpp; sourceTree = "<group>"; };
+		2EED575A12109EF3007656BB /* BlobData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobData.h; sourceTree = "<group>"; };
 		31288E6E0E3005D6003619AE /* WebKitCSSKeyframeRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSKeyframeRule.cpp; sourceTree = "<group>"; };
 		31288E6F0E3005D6003619AE /* WebKitCSSKeyframeRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSKeyframeRule.h; sourceTree = "<group>"; };
 		31288E700E3005D6003619AE /* WebKitCSSKeyframesRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSKeyframesRule.cpp; sourceTree = "<group>"; };
@@ -13840,6 +13856,11 @@
 				89BED5E911BE11CE00448492 /* BlobBuilder.cpp */,
 				89BED5EA11BE11CE00448492 /* BlobBuilder.h */,
 				89CD027911C859A80070B791 /* BlobBuilder.idl */,
+				2EED574D12109ED0007656BB /* BlobRegistryImpl.cpp */,
+				2EED574E12109ED0007656BB /* BlobRegistryImpl.h */,
+				2EED574F12109ED0007656BB /* BlobStorageData.h */,
+				2EED575012109ED0007656BB /* BlobURL.cpp */,
+				2EED575112109ED0007656BB /* BlobURL.h */,
 				93C441ED0F813A1A00C1A634 /* CollectionCache.cpp */,
 				93C441EE0F813A1A00C1A634 /* CollectionCache.h */,
 				93C441FF0F813AE100C1A634 /* CollectionType.h */,
@@ -16409,8 +16430,11 @@
 				BCFB2F74097A2E1A00BA703D /* Arena.cpp */,
 				BCFB2F75097A2E1A00BA703D /* Arena.h */,
 				51E1ECB10C91C55600DC255B /* AutodrainedPool.h */,
+				2EED575912109EF3007656BB /* BlobData.cpp */,
+				2EED575A12109EF3007656BB /* BlobData.h */,
 				8988E10C11A3508B00DB732E /* BlobItem.cpp */,
 				8988E10D11A3508B00DB732E /* BlobItem.h */,
+				2EED575712109EE4007656BB /* BlobRegistry.h */,
 				BCC8CFCA0986CD2400140BF2 /* ColorData.gperf */,
 				41D015C90F4B5C71004A662F /* ContentType.cpp */,
 				41D015C80F4B5C71004A662F /* ContentType.h */,
@@ -20120,6 +20144,11 @@
 				97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */,
 				CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */,
 				7AB0B1C11211A62200A76940 /* InspectorStorageAgent.h in Headers */,
+				2EED575312109ED0007656BB /* BlobRegistryImpl.h in Headers */,
+				2EED575412109ED0007656BB /* BlobStorageData.h in Headers */,
+				2EED575612109ED0007656BB /* BlobURL.h in Headers */,
+				2EED575812109EE4007656BB /* BlobRegistry.h in Headers */,
+				2EED575C12109EF3007656BB /* BlobData.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -22543,6 +22572,9 @@
 				E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
 				97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
 				7AB0B1C01211A62200A76940 /* InspectorStorageAgent.cpp in Sources */,
+				2EED575212109ED0007656BB /* BlobRegistryImpl.cpp in Sources */,
+				2EED575512109ED0007656BB /* BlobURL.cpp in Sources */,
+				2EED575B12109EF3007656BB /* BlobData.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebCore/bindings/js/SerializedScriptValue.cpp b/WebCore/bindings/js/SerializedScriptValue.cpp
index 6d6fa21..00ec25f 100644
--- a/WebCore/bindings/js/SerializedScriptValue.cpp
+++ b/WebCore/bindings/js/SerializedScriptValue.cpp
@@ -27,9 +27,11 @@
 #include "config.h"
 #include "SerializedScriptValue.h"
 
+#include "Blob.h"
 #include "File.h"
 #include "FileList.h"
 #include "ImageData.h"
+#include "JSBlob.h"
 #include "JSDOMGlobalObject.h"
 #include "JSFile.h"
 #include "JSFileList.h"
@@ -147,26 +149,86 @@ private:
     unsigned m_length;
 };
 
+class SerializedBlob : public SharedSerializedData {
+public:
+    static PassRefPtr<SerializedBlob> create(const Blob* blob)
+    {
+        return adoptRef(new SerializedBlob(blob));
+    }
+
+    const KURL& url() const { return m_url; }
+    const String& type() const { return m_type; }
+    unsigned long long size() const { return m_size; }
+
+private:
+    SerializedBlob(const Blob* blob)
+        : m_url(blob->url().copy())
+        , m_type(blob->type().crossThreadString())
+        , m_size(blob->size())
+    {
+    }
+
+    KURL m_url;
+    String m_type;
+    unsigned long long m_size;
+};
+
+class SerializedFile : public SharedSerializedData {
+public:
+    static PassRefPtr<SerializedFile> create(const File* file)
+    {
+        return adoptRef(new SerializedFile(file));
+    }
+
+    const String& path() const { return m_path; }
+    const KURL& url() const { return m_url; }
+    const String& type() const { return m_type; }
+
+private:
+    SerializedFile(const File* file)
+        : m_path(file->path().crossThreadString())
+        , m_url(file->url().copy())
+        , m_type(file->type().crossThreadString())
+    {
+    }
+
+    String m_path;
+    KURL m_url;
+    String m_type;
+};
+
 class SerializedFileList : public SharedSerializedData {
 public:
+    struct FileData {
+        String path;
+        KURL url;
+        String type;
+    };
+
     static PassRefPtr<SerializedFileList> create(const FileList* list)
     {
         return adoptRef(new SerializedFileList(list));
     }
 
     unsigned length() const { return m_files.size(); }
-    const String& item(unsigned idx) { return m_files[idx]; }
+    const FileData& item(unsigned idx) { return m_files[idx]; }
 
 private:
     SerializedFileList(const FileList* list)
     {
         unsigned length = list->length();
         m_files.reserveCapacity(length);
-        for (unsigned i = 0; i < length; i++)
-            m_files.append(list->item(i)->path().crossThreadString());
+        for (unsigned i = 0; i < length; i++) {
+            File* file = list->item(i);
+            FileData fileData;
+            fileData.path = file->path().crossThreadString();
+            fileData.url = file->url().copy();
+            fileData.type = file->type().crossThreadString();
+            m_files.append(fileData);
+        }
     }
 
-    Vector<String> m_files;
+    Vector<FileData> m_files;
 };
 
 class SerializedImageData : public SharedSerializedData {
@@ -217,9 +279,15 @@ SerializedScriptValueData::SerializedScriptValueData(const ImageData* imageData)
 {
 }
 
+SerializedScriptValueData::SerializedScriptValueData(const Blob* blob)
+    : m_type(BlobType)
+    , m_sharedData(SerializedBlob::create(blob))
+{
+}
+
 SerializedScriptValueData::SerializedScriptValueData(const File* file)
     : m_type(FileType)
-    , m_string(file->path().crossThreadString())
+    , m_sharedData(SerializedFile::create(file))
 {
 }
 
@@ -233,6 +301,16 @@ SerializedObject* SharedSerializedData::asObject()
     return static_cast<SerializedObject*>(this);
 }
 
+SerializedBlob* SharedSerializedData::asBlob()
+{
+    return static_cast<SerializedBlob*>(this);
+}
+
+SerializedFile* SharedSerializedData::asFile()
+{
+    return static_cast<SerializedFile*>(this);
+}
+
 SerializedFileList* SharedSerializedData::asFileList()
 {
     return static_cast<SerializedFileList*>(this);
@@ -570,6 +648,8 @@ struct SerializingTreeWalker : public BaseWalker {
             JSObject* obj = asObject(value);
             if (obj->inherits(&JSFile::s_info))
                 return SerializedScriptValueData(toFile(obj));
+            if (obj->inherits(&JSBlob::s_info))
+                return SerializedScriptValueData(toBlob(obj));
             if (obj->inherits(&JSFileList::s_info))
                 return SerializedScriptValueData(toFileList(obj));
             if (obj->inherits(&JSImageData::s_info))
@@ -736,12 +816,21 @@ struct DeserializingTreeWalker : public BaseWalker {
                 return jsNumber(m_exec, value.asDouble());
             case SerializedScriptValueData::DateType:
                 return new (m_exec) DateInstance(m_exec, m_globalObject->dateStructure(), value.asDouble());
+            case SerializedScriptValueData::BlobType: {
+                if (!m_isDOMGlobalObject)
+                    return jsNull();
+                SerializedBlob* serializedBlob = value.asBlob();
+                ScriptExecutionContext* scriptExecutionContext = static_cast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject())->scriptExecutionContext();
+                ASSERT(scriptExecutionContext);
+                return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), Blob::create(scriptExecutionContext, serializedBlob->url(), serializedBlob->type(), serializedBlob->size()));
+            }
             case SerializedScriptValueData::FileType: {
                 if (!m_isDOMGlobalObject)
                     return jsNull();
+                SerializedFile* serializedFile = value.asFile();
                 ScriptExecutionContext* scriptExecutionContext = static_cast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject())->scriptExecutionContext();
                 ASSERT(scriptExecutionContext);
-                return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), File::create(scriptExecutionContext, value.asString().crossThreadString()));
+                return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), File::create(scriptExecutionContext, serializedFile->path(), serializedFile->url(), serializedFile->type()));
             }
             case SerializedScriptValueData::FileListType: {
                 if (!m_isDOMGlobalObject)
@@ -751,8 +840,10 @@ struct DeserializingTreeWalker : public BaseWalker {
                 unsigned length = serializedFileList->length();
                 ScriptExecutionContext* scriptExecutionContext = static_cast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject())->scriptExecutionContext();
                 ASSERT(scriptExecutionContext);
-                for (unsigned i = 0; i < length; i++)
-                    result->append(File::create(scriptExecutionContext, serializedFileList->item(i)));
+                for (unsigned i = 0; i < length; i++) {
+                    const SerializedFileList::FileData& fileData = serializedFileList->item(i);
+                    result->append(File::create(scriptExecutionContext, fileData.path, fileData.url, fileData.type));
+                }
                 return toJS(m_exec, static_cast<JSDOMGlobalObject*>(m_globalObject), result.get());
             }
             case SerializedScriptValueData::ImageDataType: {
@@ -920,6 +1011,7 @@ struct TeardownTreeWalker {
             case SerializedScriptValueData::NumberType:
             case SerializedScriptValueData::DateType:
             case SerializedScriptValueData::EmptyType:
+            case SerializedScriptValueData::BlobType:
             case SerializedScriptValueData::FileType:
             case SerializedScriptValueData::FileListType:
             case SerializedScriptValueData::ImageDataType:
diff --git a/WebCore/bindings/js/SerializedScriptValue.h b/WebCore/bindings/js/SerializedScriptValue.h
index 93bd0de..c165810 100644
--- a/WebCore/bindings/js/SerializedScriptValue.h
+++ b/WebCore/bindings/js/SerializedScriptValue.h
@@ -33,10 +33,13 @@ typedef const struct OpaqueJSContext* JSContextRef;
 typedef const struct OpaqueJSValue* JSValueRef;
 
 namespace WebCore {
+    class Blob;
     class File;
     class FileList;
     class ImageData;
     class SerializedArray;
+    class SerializedBlob;
+    class SerializedFile;
     class SerializedFileList;
     class SerializedImageData;
     class SerializedObject;
@@ -46,6 +49,8 @@ namespace WebCore {
         virtual ~SharedSerializedData() { }
         SerializedArray* asArray();
         SerializedObject* asObject();
+        SerializedBlob* asBlob();
+        SerializedFile* asFile();
         SerializedFileList* asFileList();
         SerializedImageData* asImageData();
     };
@@ -62,6 +67,7 @@ namespace WebCore {
             ObjectType,
             ArrayType,
             StringType,
+            BlobType,
             FileType,
             FileListType,
             ImageDataType
@@ -87,7 +93,8 @@ namespace WebCore {
             , m_string(string.crossThreadString()) // FIXME: Should be able to just share the Rep
         {
         }
-        
+
+        explicit SerializedScriptValueData(const Blob*);
         explicit SerializedScriptValueData(const File*);
         explicit SerializedScriptValueData(const FileList*);
         explicit SerializedScriptValueData(const ImageData*);
@@ -122,7 +129,7 @@ namespace WebCore {
 
         String asString() const
         {
-            ASSERT(m_type == StringType || m_type == FileType);
+            ASSERT(m_type == StringType);
             return m_string;
         }
 
@@ -140,6 +147,20 @@ namespace WebCore {
             return m_sharedData->asArray();
         }
 
+        SerializedBlob* asBlob() const
+        {
+            ASSERT(m_type == BlobType);
+            ASSERT(m_sharedData);
+            return m_sharedData->asBlob();
+        }
+
+        SerializedFile* asFile() const
+        {
+            ASSERT(m_type == FileType);
+            ASSERT(m_sharedData);
+            return m_sharedData->asFile();
+        }
+
         SerializedFileList* asFileList() const
         {
             ASSERT(m_type == FileListType);
diff --git a/WebCore/bindings/v8/SerializedScriptValue.cpp b/WebCore/bindings/v8/SerializedScriptValue.cpp
index 9dc4d0f..0cacb67 100644
--- a/WebCore/bindings/v8/SerializedScriptValue.cpp
+++ b/WebCore/bindings/v8/SerializedScriptValue.cpp
@@ -183,16 +183,20 @@ public:
         doWriteNumber(number);
     }
 
-    void writeBlob(const String& path)
+    void writeBlob(const String& url, const String& type, unsigned long long size)
     {
         append(BlobTag);
-        doWriteWebCoreString(path);
+        doWriteWebCoreString(url);
+        doWriteWebCoreString(type);
+        doWriteUint64(size);
     }
 
-    void writeFile(const String& path)
+    void writeFile(const String& path, const String& url, const String& type)
     {
         append(FileTag);
         doWriteWebCoreString(path);
+        doWriteWebCoreString(url);
+        doWriteWebCoreString(type);
     }
 
     void writeFileList(const FileList& fileList)
@@ -200,8 +204,11 @@ public:
         append(FileListTag);
         uint32_t length = fileList.length();
         doWriteUint32(length);
-        for (unsigned i = 0; i < length; ++i)
+        for (unsigned i = 0; i < length; ++i) {
             doWriteWebCoreString(fileList.item(i)->path());
+            doWriteWebCoreString(fileList.item(i)->url().string());
+            doWriteWebCoreString(fileList.item(i)->type());
+        }
     }
 
     void writeImageData(uint32_t width, uint32_t height, const uint8_t* pixelData, uint32_t pixelDataLength)
@@ -251,7 +258,8 @@ private:
         doWriteString(buffer->data(), buffer->size());
     }
 
-    void doWriteUint32(uint32_t value)
+    template<class T>
+    void doWriteUintHelper(T value)
     {
         while (true) {
             uint8_t b = (value & varIntMask);
@@ -264,6 +272,16 @@ private:
         }
     }
 
+    void doWriteUint32(uint32_t value)
+    {
+        doWriteUintHelper(value);
+    }
+
+    void doWriteUint64(uint64_t value)
+    {
+        doWriteUintHelper(value);
+    }
+
     void doWriteNumber(double number)
     {
         append(reinterpret_cast<uint8_t*>(&number), sizeof(number));
@@ -560,7 +578,7 @@ private:
         Blob* blob = V8Blob::toNative(value.As<v8::Object>());
         if (!blob)
             return;
-        m_writer.writeBlob(blob->path());
+        m_writer.writeBlob(blob->url().string(), blob->type(), blob->size());
     }
 
     void writeFile(v8::Handle<v8::Value> value)
@@ -568,7 +586,7 @@ private:
         File* file = V8File::toNative(value.As<v8::Object>());
         if (!file)
             return;
-        m_writer.writeFile(file->path());
+        m_writer.writeFile(file->path(), file->url().string(), file->type());
     }
 
     void writeFileList(v8::Handle<v8::Value> value)
@@ -852,10 +870,16 @@ private:
 
     bool readBlob(v8::Handle<v8::Value>* value)
     {
-        String path;
-        if (!readWebCoreString(&path))
+        String url;
+        String type;
+        unsigned long long size;
+        if (!readWebCoreString(&url))
             return false;
-        PassRefPtr<Blob> blob = Blob::create(getScriptExecutionContext(), path);
+        if (!readWebCoreString(&type))
+            return false;
+        if (!doReadUint64(&size))
+            return false;
+        RefPtr<Blob> blob = Blob::create(getScriptExecutionContext(), KURL(ParsedURLString, url), type, size);
         *value = toV8(blob);
         return true;
     }
@@ -863,9 +887,15 @@ private:
     bool readFile(v8::Handle<v8::Value>* value)
     {
         String path;
+        String url;
+        String type;
         if (!readWebCoreString(&path))
             return false;
-        PassRefPtr<File> file = File::create(getScriptExecutionContext(), path);
+        if (!readWebCoreString(&url))
+            return false;
+        if (!readWebCoreString(&type))
+            return false;
+        RefPtr<File> file = File::create(getScriptExecutionContext(), path, KURL(ParsedURLString, url), type);
         *value = toV8(file);
         return true;
     }
@@ -878,15 +908,22 @@ private:
         PassRefPtr<FileList> fileList = FileList::create();
         for (unsigned i = 0; i < length; ++i) {
             String path;
+            String urlString;
+            String type;
             if (!readWebCoreString(&path))
                 return false;
-            fileList->append(File::create(getScriptExecutionContext(), path));
+            if (!readWebCoreString(&urlString))
+                return false;
+            if (!readWebCoreString(&type))
+                return false;
+            fileList->append(File::create(getScriptExecutionContext(), path, KURL(ParsedURLString, urlString), type));
         }
         *value = toV8(fileList);
         return true;
     }
 
-    bool doReadUint32(uint32_t* value)
+    template<class T>
+    bool doReadUintHelper(T* value)
     {
         *value = 0;
         uint8_t currentByte;
@@ -901,6 +938,16 @@ private:
         return true;
     }
 
+    bool doReadUint32(uint32_t* value)
+    {
+        return doReadUintHelper(value);
+    }
+
+    bool doReadUint64(uint64_t* value)
+    {
+        return doReadUintHelper(value);
+    }
+
     bool doReadNumber(double* number)
     {
         if (m_position + sizeof(double) > m_length)
diff --git a/WebCore/dom/ScriptExecutionContext.cpp b/WebCore/dom/ScriptExecutionContext.cpp
index f7ac603..095fbd0 100644
--- a/WebCore/dom/ScriptExecutionContext.cpp
+++ b/WebCore/dom/ScriptExecutionContext.cpp
@@ -28,12 +28,11 @@
 #include "ScriptExecutionContext.h"
 
 #include "ActiveDOMObject.h"
+#include "BlobRegistry.h"
 #include "Database.h"
 #include "DatabaseTask.h"
 #include "DatabaseThread.h"
-#if ENABLE(BLOB) || ENABLE(FILE_WRITER)
 #include "FileThread.h"
-#endif
 #include "MessagePort.h"
 #include "SecurityOrigin.h"
 #include "WorkerContext.h"
@@ -92,6 +91,12 @@ ScriptExecutionContext::~ScriptExecutionContext()
         m_fileThread = 0;
     }
 #endif
+#if ENABLE(BLOB)
+    HashSet<String>::iterator blobURLsEnd = m_blobURLs.end();
+    for (HashSet<String>::iterator iter = m_blobURLs.begin(); iter != blobURLsEnd; ++iter)
+        // FIXME: implement thread-safe proxy to make it work with workers.
+        BlobRegistry::instance().unregisterBlobURL(KURL(ParsedURLString, *iter));
+#endif
 }
 
 #if ENABLE(DATABASE)
@@ -241,6 +246,22 @@ DOMTimer* ScriptExecutionContext::findTimeout(int timeoutId)
     return m_timeouts.get(timeoutId);
 }
 
+#if ENABLE(BLOB)
+void ScriptExecutionContext::trackBlobURL(const String& url)
+{
+    m_blobURLs.add(url);
+}
+
+void ScriptExecutionContext::revokeBlobURL(const String& url)
+{
+    if (m_blobURLs.contains(url)) {
+        // FIXME: implement thread-safe proxy to make it work with workers.
+        BlobRegistry::instance().unregisterBlobURL(KURL(ParsedURLString, url));
+        m_blobURLs.remove(url);
+    }
+}
+#endif
+
 #if ENABLE(BLOB) || ENABLE(FILE_WRITER)
 FileThread* ScriptExecutionContext::fileThread()
 {
diff --git a/WebCore/dom/ScriptExecutionContext.h b/WebCore/dom/ScriptExecutionContext.h
index d2da307..720a4ee 100644
--- a/WebCore/dom/ScriptExecutionContext.h
+++ b/WebCore/dom/ScriptExecutionContext.h
@@ -36,6 +36,7 @@
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/Threading.h>
+#include <wtf/text/StringHash.h>
 
 namespace WebCore {
 
@@ -125,6 +126,11 @@ namespace WebCore {
         void removeTimeout(int timeoutId);
         DOMTimer* findTimeout(int timeoutId);
 
+#if ENABLE(BLOB)
+        void trackBlobURL(const String&);
+        void revokeBlobURL(const String&);
+#endif
+
 #if USE(JSC)
         JSC::JSGlobalData* globalData();
 #endif
@@ -152,6 +158,10 @@ namespace WebCore {
 
         HashMap<int, DOMTimer*> m_timeouts;
 
+#if ENABLE(BLOB)
+        HashSet<String> m_blobURLs;
+#endif
+
         virtual void refScriptExecutionContext() = 0;
         virtual void derefScriptExecutionContext() = 0;
 
diff --git a/WebCore/html/Blob.cpp b/WebCore/html/Blob.cpp
index 977ffa6..bb04e10 100644
--- a/WebCore/html/Blob.cpp
+++ b/WebCore/html/Blob.cpp
@@ -31,29 +31,72 @@
 #include "config.h"
 #include "Blob.h"
 
+#include "BlobData.h"
 #include "BlobItem.h"
+#include "BlobRegistry.h"
+#include "BlobURL.h"
 #include "FileSystem.h"
+#include "ScriptExecutionContext.h"
 
 namespace WebCore {
 
+// FIXME: To be removed when we switch to using BlobData.
 Blob::Blob(ScriptExecutionContext*, const String& type, const BlobItemList& items)
     : m_type(type)
+    , m_size(0)
 {
     for (size_t i = 0; i < items.size(); ++i)
         m_items.append(items[i]);
 }
 
+// FIXME: To be removed when we switch to using BlobData.
 Blob::Blob(ScriptExecutionContext*, const PassRefPtr<BlobItem>& item)
+    : m_size(0)
 {
     m_items.append(item);
 }
 
+// FIXME: To be removed when we switch to using BlobData.
 Blob::Blob(ScriptExecutionContext*, const String& path)
+    : m_size(0)
 {
     // Note: this doesn't initialize the type unlike File(path).
     m_items.append(FileBlobItem::create(path));
 }
 
+Blob::Blob(ScriptExecutionContext* scriptExecutionContext, PassOwnPtr<BlobData> blobData, long long size)
+    : m_type(blobData->contentType())
+    , m_size(size)
+{
+    ASSERT(blobData.get() && !blobData->items().isEmpty());
+
+    // Create a new internal URL and register it with the provided blob data.
+    m_url = BlobURL::createURL(scriptExecutionContext);
+    // FIXME: implement thread-safe proxy to make it work with workers.
+    BlobRegistry::instance().registerBlobURL(m_url, blobData);
+}
+
+Blob::Blob(ScriptExecutionContext* scriptExecutionContext, const KURL& srcURL, const String& type, long long size)
+    : m_type(type)
+    , m_size(size)
+{
+    // FIXME: To be removed when we switch to using BlobData.
+    if (srcURL.isEmpty())
+        return;
+
+    // Create a new internal URL and register it with the same blob data as the source URL.
+    m_url = BlobURL::createURL(scriptExecutionContext);
+    // FIXME: implement thread-safe proxy to make it work with workers.
+    BlobRegistry::instance().registerBlobURL(m_url, srcURL);
+}
+
+Blob::~Blob()
+{
+    // The internal URL is only used to refer to the Blob object. So we need to unregister the URL when the object is GC-ed.
+    // FIXME: implement thread-safe proxy to make it work with workers.
+    BlobRegistry::instance().unregisterBlobURL(m_url);
+}
+
 unsigned long long Blob::size() const
 {
     // FIXME: JavaScript cannot represent sizes as large as unsigned long long, we need to
@@ -64,6 +107,7 @@ unsigned long long Blob::size() const
     return size;
 }
 
+// FIXME: To be removed when we switch to using BlobData.
 const String& Blob::path() const
 {
     ASSERT(m_items.size() == 1 && m_items[0]->toFileBlobItem());
@@ -99,4 +143,17 @@ PassRefPtr<Blob> Blob::slice(ScriptExecutionContext* scriptExecutionContext, lon
 }
 #endif // ENABLE(BLOB)
 
+KURL Blob::createPublicURL(ScriptExecutionContext* scriptExecutionContext) const
+{
+    KURL url = BlobURL::createURL(scriptExecutionContext);
+
+    // FIXME: implement thread-safe proxy to make it work with workers.
+    BlobRegistry::instance().registerBlobURL(url, m_url);
+
+    // Keep track of the new URL in the ScriptExecutionContext so that it will get unregistered when the context is gone.
+    scriptExecutionContext->trackBlobURL(url.string());
+
+    return url;
+}
+
 } // namespace WebCore
diff --git a/WebCore/html/Blob.h b/WebCore/html/Blob.h
index 7afc7a0..a72929c 100644
--- a/WebCore/html/Blob.h
+++ b/WebCore/html/Blob.h
@@ -32,54 +32,71 @@
 #define Blob_h
 
 #include "BlobItem.h"
+#include "KURL.h"
 #include "PlatformString.h"
+#include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
 
+class BlobData;
 class ScriptExecutionContext;
 
 class Blob : public RefCounted<Blob> {
 public:
+    // FIXME: To be removed when we switch to using BlobData.
     static PassRefPtr<Blob> create(ScriptExecutionContext* scriptExecutionContext, const String& type, const BlobItemList& items)
     {
         return adoptRef(new Blob(scriptExecutionContext, type, items));
     }
 
-    // FIXME: Deprecated method.  This is called only from
-    // bindings/v8/SerializedScriptValue.cpp and the usage in it will become invalid once
-    // BlobBuilder is introduced.
-    static PassRefPtr<Blob> create(ScriptExecutionContext* scriptExecutionContext, const String& path)
+    // For deserialization.
+    static PassRefPtr<Blob> create(ScriptExecutionContext* scriptExecutionContext, const KURL& srcURL, const String& type, long long size)
     {
-        return adoptRef(new Blob(scriptExecutionContext, path));
+        return adoptRef(new Blob(scriptExecutionContext, srcURL, type, size));
     }
 
-    virtual ~Blob() { }
+    virtual ~Blob();
 
+    const KURL& url() const { return m_url; }
     unsigned long long size() const;
     const String& type() const { return m_type; }
     virtual bool isFile() const { return false; }
 
-    // FIXME: Deprecated method.
+    // FIXME: To be removed when we switch to using BlobData.
     const String& path() const;
 
+    // FIXME: To be removed when we switch to using BlobData.
     const BlobItemList& items() const { return m_items; }
 
 #if ENABLE(BLOB)
     PassRefPtr<Blob> slice(ScriptExecutionContext*, long long start, long long length, const String& contentType = String()) const;
+
+    KURL createPublicURL(ScriptExecutionContext*) const;
 #endif
 
 protected:
+    // FIXME: To be removed when we switch to using BlobData.
     Blob(ScriptExecutionContext*, const String& type, const BlobItemList&);
     Blob(ScriptExecutionContext*, const PassRefPtr<BlobItem>&);
-
-    // FIXME: Deprecated constructor.  See also the comment for Blob::create(path).
     Blob(ScriptExecutionContext*, const String& path);
 
+    Blob(ScriptExecutionContext*, PassOwnPtr<BlobData>, long long size);
+
+    // For deserialization.
+    Blob(ScriptExecutionContext*, const KURL& srcURL, const String& type, long long size);
+
+    // FIXME: To be removed when we switch to using BlobData.
     BlobItemList m_items;
+
+    // This is an internal URL referring to the blob data associated with this object.
+    // It is only used by FileReader to read the blob data via loading from the blob URL resource.
+    KURL m_url;
+
     String m_type;
+    long long m_size;
 };
 
 } // namespace WebCore
diff --git a/WebCore/html/BlobRegistryImpl.cpp b/WebCore/html/BlobRegistryImpl.cpp
new file mode 100644
index 0000000..5eea4ca
--- /dev/null
+++ b/WebCore/html/BlobRegistryImpl.cpp
@@ -0,0 +1,173 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(BLOB)
+
+#include "BlobRegistryImpl.h"
+
+#include "FileStream.h"
+#include "FileStreamProxy.h"
+#include "FileSystem.h"
+#include "ResourceError.h"
+#include "ResourceHandle.h"
+#include "ResourceLoader.h"
+#include "ResourceRequest.h"
+#include "ResourceResponse.h"
+#include <wtf/StdLibExtras.h>
+
+namespace WebCore {
+
+bool BlobRegistryImpl::shouldLoadResource(const ResourceRequest& request) const
+{
+    // If the resource is not fetched using the GET method, bail out.
+    if (!equalIgnoringCase(request.httpMethod(), "GET"))
+        return false;
+
+    return true;
+}
+
+PassRefPtr<ResourceHandle> BlobRegistryImpl::createResourceHandle(const ResourceRequest& request, ResourceHandleClient*)
+{
+    if (!shouldLoadResource(request))
+        return 0;
+
+    // FIXME: To be implemented.
+    return 0;
+}
+
+bool BlobRegistryImpl::loadResourceSynchronously(const ResourceRequest& request, ResourceError&, ResourceResponse&, Vector<char>&)
+{
+    if (!shouldLoadResource(request))
+        return false;
+
+    // FIXME: To be implemented.
+    return false;
+}
+
+BlobRegistry& BlobRegistry::instance()
+{
+    DEFINE_STATIC_LOCAL(BlobRegistryImpl, instance, ());
+    return instance;
+}
+
+void BlobRegistryImpl::appendStorageItems(BlobStorageData* blobStorageData, const BlobStorageDataItemList& items)
+{
+    for (BlobStorageDataItemList::const_iterator iter = items.begin(); iter != items.end(); ++iter) {
+        if (iter->type == BlobStorageDataItem::Data)
+            blobStorageData->appendData(iter->data, iter->offset, iter->length);
+        else {
+            ASSERT(iter->type == BlobStorageDataItem::File);
+            blobStorageData->appendFile(iter->path, iter->offset, iter->length, iter->expectedModificationTime);
+        }
+    }
+}
+
+void BlobRegistryImpl::appendStorageItems(BlobStorageData* blobStorageData, const BlobStorageDataItemList& items, long long offset, long long length)
+{
+    ASSERT(length != BlobDataItem::toEndOfFile);
+
+    BlobStorageDataItemList::const_iterator iter = items.begin();
+    if (offset) {
+        for (; iter != items.end(); ++iter) {
+            if (offset >= iter->length)
+                offset -= iter->length;
+            else
+                break;
+        }
+    }
+
+    for (; iter != items.end() && length > 0; ++iter) {
+        long long currentLength = iter->length - offset;
+        long long newLength = currentLength > length ? length : currentLength;
+        if (iter->type == BlobStorageDataItem::Data)
+            blobStorageData->appendData(iter->data, iter->offset + offset, newLength);
+        else {
+            ASSERT(iter->type == BlobStorageDataItem::File);
+            blobStorageData->appendFile(iter->path, iter->offset + offset, newLength, iter->expectedModificationTime);
+        }
+        offset = 0;
+    }
+}
+
+void BlobRegistryImpl::registerBlobURL(const KURL& url, PassOwnPtr<BlobData> blobData)
+{
+    RefPtr<BlobStorageData> blobStorageData = BlobStorageData::create();
+    blobStorageData->setContentType(blobData->contentType());
+    blobStorageData->setContentDisposition(blobData->contentDisposition());
+
+    for (BlobDataItemList::const_iterator iter = blobData->items().begin(); iter != blobData->items().end(); ++iter) {
+        switch (iter->type) {
+        case BlobDataItem::Data:
+            blobStorageData->appendData(iter->data, 0, iter->data.length());
+            break;
+        case BlobDataItem::File:
+            blobStorageData->appendFile(iter->path, iter->offset, iter->length, iter->expectedModificationTime);
+            break;
+        case BlobDataItem::Blob:
+            if (m_blobs.contains(iter->url.string()))
+                appendStorageItems(blobStorageData.get(), m_blobs.get(iter->url.string())->items(), iter->offset, iter->length);
+            break;
+        }
+    }
+
+
+    m_blobs.set(url.string(), blobStorageData);
+}
+
+void BlobRegistryImpl::registerBlobURL(const KURL& url, const KURL& srcURL)
+{
+    RefPtr<BlobStorageData> src = m_blobs.get(srcURL.string());
+    ASSERT(src);
+    if (!src)
+        return;
+
+    RefPtr<BlobStorageData> blobStorageData = BlobStorageData::create();
+    blobStorageData->setContentType(src->contentType());
+    blobStorageData->setContentDisposition(src->contentDisposition());
+    appendStorageItems(blobStorageData.get(), src->items());
+    
+    m_blobs.set(url.string(), blobStorageData);
+}
+
+void BlobRegistryImpl::unregisterBlobURL(const KURL& url)
+{
+    m_blobs.remove(url.string());
+}
+
+PassRefPtr<BlobStorageData> BlobRegistryImpl::getBlobDataFromURL(const KURL& url) const
+{
+    return m_blobs.get(url.string());
+}
+
+#endif // ENABLE(BLOB)
+
+} // namespace WebCore
diff --git a/WebCore/html/BlobRegistryImpl.h b/WebCore/html/BlobRegistryImpl.h
new file mode 100644
index 0000000..d87b58e
--- /dev/null
+++ b/WebCore/html/BlobRegistryImpl.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BlobRegistryImpl_h
+#define BlobRegistryImpl_h
+
+#if ENABLE(BLOB)
+
+#include "BlobData.h"
+#include "BlobRegistry.h"
+#include "BlobStorageData.h"
+#include "PlatformString.h"
+#include <wtf/HashMap.h>
+#include <wtf/text/CString.h>
+#include <wtf/text/StringHash.h>
+
+namespace WebCore {
+
+class KURL;
+class ResourceError;
+class ResourceHandle;
+class ResourceHandleClient;
+class ResourceRequest;
+class ResourceResponse;
+
+// BlobRegistryImpl is not thread-safe. It should only be called from main thread.
+class BlobRegistryImpl : public BlobRegistry {
+public:
+    virtual ~BlobRegistryImpl() { }
+
+    virtual void registerBlobURL(const KURL&, PassOwnPtr<BlobData>);
+    virtual void registerBlobURL(const KURL&, const KURL& srcURL);
+    virtual void unregisterBlobURL(const KURL&);
+    virtual PassRefPtr<ResourceHandle> createResourceHandle(const ResourceRequest&, ResourceHandleClient*);
+    virtual bool loadResourceSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data);
+
+    PassRefPtr<BlobStorageData> getBlobDataFromURL(const KURL&) const;
+
+private:
+    bool shouldLoadResource(const ResourceRequest& request) const;
+    void appendStorageItems(BlobStorageData*, const BlobStorageDataItemList&);
+    void appendStorageItems(BlobStorageData*, const BlobStorageDataItemList&, long long offset, long long length);
+
+    HashMap<String, RefPtr<BlobStorageData> > m_blobs;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(BLOB)
+
+#endif // BlobRegistryImpl_h
diff --git a/WebCore/html/BlobStorageData.h b/WebCore/html/BlobStorageData.h
new file mode 100644
index 0000000..f4125a4
--- /dev/null
+++ b/WebCore/html/BlobStorageData.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BlobStorageData_h
+#define BlobStorageData_h
+
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+struct BlobStorageDataItem {
+    enum BlobStoreDataItemType { Data, File };
+    BlobStoreDataItemType type;
+    long long offset;
+    long long length;
+
+    // For string data.
+    CString data;
+
+    // For file data.
+    String path;
+    double expectedModificationTime;
+
+    BlobStorageDataItem(const CString& data, long long offset, long long length)
+        : type(Data)
+        , offset(offset)
+        , length(length)
+        , data(data)
+        , expectedModificationTime(0)
+    {
+    }
+
+    BlobStorageDataItem(const String& path, long long offset, long long length, double expectedModificationTime)
+        : type(File)
+        , offset(offset)
+        , length(length)
+        , path(path)
+        , expectedModificationTime(expectedModificationTime)
+    {
+    }
+};
+
+typedef Vector<BlobStorageDataItem> BlobStorageDataItemList;
+
+class BlobStorageData : public RefCounted<BlobStorageData> {
+public:
+    static PassRefPtr<BlobStorageData> create()
+    {
+        return adoptRef(new BlobStorageData());
+    }
+
+    const String& contentType() const { return m_contentType; }
+    void setContentType(const String& contentType) { m_contentType = contentType; }
+
+    const String& contentDisposition() const { return m_contentDisposition; }
+    void setContentDisposition(const String& contentDisposition) { m_contentDisposition = contentDisposition; }
+    
+    const BlobStorageDataItemList& items() const { return m_items; }
+
+    void appendData(const CString& data, long long offset, long long length)
+    {
+        m_items.append(BlobStorageDataItem(data, offset, length));
+    }
+
+    void appendFile(const String& path, long long offset, long long length, double expectedModificationTime)
+    {
+        m_items.append(BlobStorageDataItem(path, offset, length, expectedModificationTime));
+    }
+
+private:
+    String m_contentType;
+    String m_contentDisposition;
+    BlobStorageDataItemList m_items;
+};
+
+} // namespace WebCore
+
+#endif // BlobStorageData_h
diff --git a/WebCore/html/BlobURL.cpp b/WebCore/html/BlobURL.cpp
new file mode 100644
index 0000000..8a9bb05
--- /dev/null
+++ b/WebCore/html/BlobURL.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(BLOB)
+
+#include "BlobURL.h"
+
+#include "KURL.h"
+#include "PlatformString.h"
+#include "ScriptExecutionContext.h"
+#include "SecurityOrigin.h"
+#include "UUID.h"
+
+namespace WebCore {
+
+KURL BlobURL::createURL(ScriptExecutionContext* scriptExecutionContext)
+{
+    // Create the blob URL in the following format:
+    //     blob:%escaped_origin%/%UUID%
+    // The origin of the host page is encoded in the URL value to allow easy lookup of the origin when the security check needs
+    // to be performed.
+    String urlString = "blob:";
+    urlString += encodeWithURLEscapeSequences(scriptExecutionContext->securityOrigin()->toString());
+    urlString += "/";
+    urlString += createCanonicalUUIDString();
+    return KURL(ParsedURLString, urlString);
+}
+
+KURL BlobURL::getOrigin(const KURL& url)
+{
+    ASSERT(url.protocolIs("blob"));
+
+    unsigned startIndex = url.pathStart();
+    unsigned afterEndIndex = url.pathAfterLastSlash();
+    String origin = url.string().substring(startIndex, afterEndIndex - startIndex);
+    return KURL(ParsedURLString, decodeURLEscapeSequences(origin));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(BLOB)
diff --git a/WebCore/html/BlobURL.h b/WebCore/html/BlobURL.h
new file mode 100644
index 0000000..dc79c99
--- /dev/null
+++ b/WebCore/html/BlobURL.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BlobURL_h
+#define BlobURL_h
+
+#if ENABLE(BLOB)
+
+#include "KURL.h"
+
+namespace WebCore {
+
+class ScriptExecutionContext;
+
+class BlobURL {
+public:
+    static KURL createURL(ScriptExecutionContext*);
+    static KURL getOrigin(const KURL&);
+};
+
+}
+
+#endif // ENABLE(BLOB)
+
+#endif // BlobURL_h
diff --git a/WebCore/html/File.cpp b/WebCore/html/File.cpp
index 109e0d3..c804f34 100644
--- a/WebCore/html/File.cpp
+++ b/WebCore/html/File.cpp
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "File.h"
 
+#include "BlobData.h"
 #include "FileSystem.h"
 #include "MIMETypeRegistry.h"
 
@@ -37,6 +38,13 @@ File::File(ScriptExecutionContext* scriptExecutionContext, const String& path)
     Init();
 }
 
+File::File(ScriptExecutionContext* scriptExecutionContext, const String& path, const KURL& url, const String& type)
+    : Blob(scriptExecutionContext, url, type, BlobDataItem::toEndOfFile)
+{
+    // FIXME: To be removed when we switch to using BlobData.
+     m_items.append(FileBlobItem::create(path));
+}
+
 #if ENABLE(DIRECTORY_UPLOAD)
 File::File(ScriptExecutionContext* scriptExecutionContext, const String& relativePath, const String& filePath)
     : Blob(scriptExecutionContext, FileBlobItem::create(filePath, relativePath))
diff --git a/WebCore/html/File.h b/WebCore/html/File.h
index c0aecc8..06a73c5 100644
--- a/WebCore/html/File.h
+++ b/WebCore/html/File.h
@@ -39,6 +39,12 @@ public:
         return adoptRef(new File(scriptExecutionContext, path));
     }
 
+    // For deserialization.
+    static PassRefPtr<File> create(ScriptExecutionContext* scriptExecutionContext, const String& path, const KURL& url, const String& type)
+    {
+        return adoptRef(new File(scriptExecutionContext, path, url, type));
+    }
+
 #if ENABLE(DIRECTORY_UPLOAD)
     static PassRefPtr<File> create(ScriptExecutionContext* scriptExecutionContext, const String& relativePath, const String& path)
     {
@@ -60,11 +66,15 @@ public:
 
 private:
     File(ScriptExecutionContext*, const String& path);
-    void Init();
+
+    // For deserialization.
+    File(ScriptExecutionContext*, const String& path, const KURL&, const String& type);
 
 #if ENABLE(DIRECTORY_UPLOAD)
     File(ScriptExecutionContext*, const String& relativePath, const String& path);
 #endif
+
+    void Init();
 };
 
 } // namespace WebCore
diff --git a/WebCore/platform/BlobData.cpp b/WebCore/platform/BlobData.cpp
new file mode 100644
index 0000000..bb256d0
--- /dev/null
+++ b/WebCore/platform/BlobData.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "BlobData.h"
+
+namespace WebCore {
+
+const long long BlobDataItem::toEndOfFile = -1;
+const double BlobDataItem::doNotCheckFileChange = 0;
+
+void BlobDataItem::copy(const BlobDataItem& item)
+{
+    type = item.type;
+    data = item.data; // This is OK because the underlying storage is Vector<char>.
+    path = item.path.crossThreadString();
+    url = item.url.copy();
+    offset = item.offset;
+    length = item.length;
+    expectedModificationTime = item.expectedModificationTime;
+}
+
+PassOwnPtr<BlobData> BlobData::copy() const
+{
+    OwnPtr<BlobData> blobData = adoptPtr(new BlobData());
+    blobData->m_contentType = m_contentType.crossThreadString();
+    blobData->m_contentDisposition = m_contentDisposition.crossThreadString();
+    blobData->m_items.resize(m_items.size());
+    for (size_t i = 0; i < m_items.size(); ++i)
+        blobData->m_items.at(i).copy(m_items.at(i));
+
+    return blobData.release();
+}
+
+void BlobData::appendData(const CString& data)
+{
+    m_items.append(BlobDataItem(data));
+}
+
+void BlobData::appendFile(const String& path)
+{
+    m_items.append(BlobDataItem(path));
+}
+
+void BlobData::appendFile(const String& path, long long offset, long long length, double expectedModificationTime)
+{
+    m_items.append(BlobDataItem(path, offset, length, expectedModificationTime));
+}
+
+void BlobData::appendBlob(const KURL& url, long long offset, long long length)
+{
+    m_items.append(BlobDataItem(url, offset, length));
+}
+
+void BlobData::swapItems(BlobDataItemList& items)
+{
+    m_items.swap(items);
+}
+
+} // namespace WebCore
diff --git a/WebCore/platform/BlobData.h b/WebCore/platform/BlobData.h
new file mode 100644
index 0000000..17cdfdd
--- /dev/null
+++ b/WebCore/platform/BlobData.h
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BlobData_h
+#define BlobData_h
+
+#include "KURL.h"
+#include "PlatformString.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/Vector.h>
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+struct BlobDataItem {
+    static const long long toEndOfFile;
+    static const double doNotCheckFileChange;
+
+    // Default constructor.
+    BlobDataItem()
+        : offset(0)
+        , length(toEndOfFile)
+        , expectedModificationTime(doNotCheckFileChange)
+    {
+    }
+
+    // Constructor for String type.
+    BlobDataItem(const CString& data)
+        : type(Data)
+        , data(data)
+        , offset(0)
+        , length(toEndOfFile)
+        , expectedModificationTime(doNotCheckFileChange)
+    {
+    }
+
+    // Constructor for File type (complete file).
+    BlobDataItem(const String& path)
+        : type(File)
+        , path(path)
+        , offset(0)
+        , length(toEndOfFile)
+        , expectedModificationTime(doNotCheckFileChange)
+    {
+    }
+
+    // Constructor for File type (partial file).
+    BlobDataItem(const String& path, long long offset, long long length, double expectedModificationTime)
+        : type(File)
+        , path(path)
+        , offset(offset)
+        , length(length)
+        , expectedModificationTime(expectedModificationTime)
+    {
+    }
+    
+    // Constructor for Blob type.
+    BlobDataItem(const KURL& url, long long offset, long long length)
+        : type(Blob)
+        , url(url)
+        , offset(offset)
+        , length(length)
+        , expectedModificationTime(doNotCheckFileChange)
+    {
+    }
+
+    // Gets a copy of the data suitable for passing to another thread.
+    void copy(const BlobDataItem&);
+
+    enum { Data, File, Blob } type;
+    
+    // For Data type.
+    CString data;
+
+    // For File type.
+    String path;
+
+    // For Blob type.
+    KURL url;
+
+    // For File and Blob type.
+    long long offset;
+    long long length;
+
+    // For File type only.
+    double expectedModificationTime;
+};
+
+typedef Vector<BlobDataItem> BlobDataItemList;
+
+class BlobData {
+public:
+    static PassOwnPtr<BlobData> create()
+    {
+        return adoptPtr(new BlobData());
+    }
+
+    // Gets a copy of the data suitable for passing to another thread.
+    PassOwnPtr<BlobData> copy() const;
+
+    const String& contentType() const { return m_contentType; }
+    void setContentType(const String& contentType) { m_contentType = contentType; }
+
+    const String& contentDisposition() const { return m_contentDisposition; }
+    void setContentDisposition(const String& contentDisposition) { m_contentDisposition = contentDisposition; }
+
+    const BlobDataItemList& items() const { return m_items; }
+    void swapItems(BlobDataItemList&);
+    
+    void appendData(const CString&);
+    void appendFile(const String& path);
+    void appendFile(const String& path, long long offset, long long length, double expectedModificationTime);
+    void appendBlob(const KURL&, long long offset, long long length);
+
+private:
+    BlobData() { }
+
+    String m_contentType;
+    String m_contentDisposition;
+    BlobDataItemList m_items;
+};
+
+} // namespace WebCore
+
+#endif // BlobData_h
diff --git a/WebCore/platform/BlobRegistry.h b/WebCore/platform/BlobRegistry.h
new file mode 100644
index 0000000..fd33ba5
--- /dev/null
+++ b/WebCore/platform/BlobRegistry.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef BlobRegistry_h
+#define BlobRegistry_h
+
+#if ENABLE(BLOB)
+
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class BlobData;
+class KURL;
+class ResourceError;
+class ResourceHandle;
+class ResourceHandleClient;
+class ResourceRequest;
+class ResourceResponse;
+
+// BlobRegistry is not thread-safe. It should only be called from main thread.
+class BlobRegistry {
+public:
+    static BlobRegistry& instance();
+
+    virtual void registerBlobURL(const KURL&, PassOwnPtr<BlobData>) = 0;
+    virtual void registerBlobURL(const KURL&, const KURL& srcURL) = 0;
+    virtual void unregisterBlobURL(const KURL&) = 0;
+    virtual PassRefPtr<ResourceHandle> createResourceHandle(const ResourceRequest&, ResourceHandleClient*) = 0;
+    virtual bool loadResourceSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data) = 0;
+
+    virtual ~BlobRegistry() { }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(BLOB)
+
+#endif // BlobRegistry_h

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list