Changeset 168333 in webkit
- Timestamp:
- May 5, 2014 5:42:52 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 2 deleted
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r168327 r168333 1 2014-05-05 Alexey Proskuryakov <ap@apple.com> 2 3 Stop using BlobData on client side 4 https://bugs.webkit.org/show_bug.cgi?id=132582 5 6 Reviewed by Sam Weinig. 7 8 Blob registration now uses either a single file path, or a vector of much simpler 9 BlobPart objects, not an array with arbitrarily sliced blobs or files, which can't happen. 10 11 * Modules/websockets/WebSocket.cpp:(WebCore::WebSocket::didReceiveBinaryData): 12 Use a new simpler Blob constructor. 13 14 * WebCore.xcodeproj/project.pbxproj: Added BlobPart, removed BlobRegistrationData. 15 16 * bindings/js/JSBlobCustom.cpp: (WebCore::JSBlobConstructor::constructJSBlob): 17 Use Vector<BlobPart> instead of BlobData (1 line of code instead of 5). 18 19 * dom/DataTransfer.cpp: (WebCore::DataTransfer::hasFileOfType): Updated for 20 File::contentTypeFromFilePathOrName rename. 21 22 * fileapi/Blob.cpp: (WebCore::Blob::Blob): 23 * fileapi/Blob.h: 24 (WebCore::Blob::create): 25 (WebCore::Blob::deserialize): 26 * fileapi/File.cpp: 27 (WebCore::File::File): 28 (WebCore::File::contentTypeFromFilePathOrName): 29 (WebCore::createBlobDataForFileWithType): Deleted. 30 (WebCore::createBlobDataForFile): Deleted. 31 (WebCore::createBlobDataForFileWithName): Deleted. 32 (WebCore::File::contentTypeFromFilePath): Deleted. 33 * fileapi/File.h: (WebCore::File::deserialize): Deleted. 34 Added and updated constructors to not use BlobData. Changed special case constructors 35 to use name tags instead of non-enforced comments. 36 37 * fileapi/ThreadableBlobRegistry.h: 38 * fileapi/ThreadableBlobRegistry.cpp: 39 (WebCore::BlobRegistryContext::BlobRegistryContext): Updated with new data members 40 that were split out of BlobData. 41 (WebCore::ThreadableBlobRegistry::registerFileBlobURL): Added. 42 (WebCore::ThreadableBlobRegistry::registerBlobURL): Updated to pass Content-Type 43 explicitly, as it's no longer hidden in BlobData. 44 45 * fileapi/WebKitBlobBuilder.h: 46 * fileapi/WebKitBlobBuilder.cpp: 47 (WebCore::BlobBuilder::append): 48 (WebCore::BlobBuilder::finalize): 49 (WebCore::BlobBuilder::appendBytesData): Deleted. 50 Updated to use BlobPart. There is no longer any need to special case Files, 51 the registry takes care of that. 52 53 * platform/network/BlobData.h: 54 * platform/network/BlobData.cpp: 55 (WebCore::BlobDataItem::detachFromCurrentThread): Deleted. 56 (WebCore::BlobData::detachFromCurrentThread): Deleted. 57 BlobData will only be used on main thread by the registry. 58 59 * platform/network/BlobPart.h: Added. A new class to encapsulate a list of blobs 60 that are combined into a new blob, as exposed to JS via Blob constructor. 61 62 * platform/network/BlobRegistry.h: 63 * platform/network/BlobRegistryImpl.cpp: 64 (WebCore::BlobRegistryImpl::registerFileBlobURL): 65 (WebCore::BlobRegistryImpl::registerBlobURL): 66 * platform/network/BlobRegistryImpl.h: 67 Updated for the new registration methods. We no longer have arbitrary BlobDatas 68 coming in. 69 70 * platform/network/FormData.cpp: Don't include BlobData for now (but really, 71 BlobStorageData is the same thing, and they will be merged soon). 72 Unfortunately, FormData is used by both client and registry side, and there is 73 no clear delimitation at the time. 74 75 * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::responseBlob): Use the new simpler 76 way to create a Blob. 77 1 78 2014-05-05 Benjamin Poulain <benjamin@webkit.org> 2 79 -
trunk/Source/WebCore/Modules/websockets/WebSocket.cpp
r168183 r168333 36 36 37 37 #include "Blob.h" 38 #include "BlobData.h"39 38 #include "CloseEvent.h" 40 39 #include "ContentSecurityPolicy.h" … … 521 520 case BinaryTypeBlob: { 522 521 // FIXME: We just received the data from NetworkProcess, and are sending it back. This is inefficient. 523 auto blobData = std::make_unique<BlobData>(); 524 blobData->appendData(RawData::create(std::move(*binaryData)), 0, BlobDataItem::toEndOfFile); 525 RefPtr<Blob> blob = Blob::create(std::move(blobData)); 522 RefPtr<Blob> blob = Blob::create(std::move(*binaryData), emptyString()); 526 523 dispatchEvent(MessageEvent::create(blob.release(), SecurityOrigin::create(m_url)->toString())); 527 524 break; -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r168316 r168333 5965 5965 E1C657271816F9FE00256CDD /* CryptoAlgorithmParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C657261816F9FE00256CDD /* CryptoAlgorithmParameters.h */; }; 5966 5966 E1C8BE5D0E8BD15A0064CB7D /* JSWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1C8BE5C0E8BD15A0064CB7D /* JSWorker.cpp */; }; 5967 E1C94AF9191303F000D5A893 /* BlobPart.h in Headers */ = {isa = PBXBuildFile; fileRef = E1C94AF7191303F000D5A893 /* BlobPart.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5967 5968 E1CA5CBC0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1CA5CBB0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp */; }; 5968 5969 E1CAA5C60E8BD23600A73ECA /* JSWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CAA5C50E8BD23600A73ECA /* JSWorker.h */; }; … … 13371 13372 E1C6CFC21746D293007B87A1 /* DOMWindowConstructors.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DOMWindowConstructors.idl; sourceTree = "<group>"; }; 13372 13373 E1C8BE5C0E8BD15A0064CB7D /* JSWorker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorker.cpp; sourceTree = "<group>"; }; 13374 E1C94AF7191303F000D5A893 /* BlobPart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobPart.h; sourceTree = "<group>"; }; 13373 13375 E1CA5CBB0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerCustom.cpp; sourceTree = "<group>"; }; 13374 13376 E1CAA5C50E8BD23600A73ECA /* JSWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorker.h; sourceTree = "<group>"; }; … … 16056 16058 2EDEF1ED121B0EFC00726DB2 /* BlobData.cpp */, 16057 16059 2EDEF1EE121B0EFC00726DB2 /* BlobData.h */, 16060 E1C94AF7191303F000D5A893 /* BlobPart.h */, 16058 16061 E14A94D616DFDF950068DE82 /* BlobRegistry.cpp */, 16059 16062 2EDEF1EF121B0EFC00726DB2 /* BlobRegistry.h */, … … 25423 25426 D0CE58F9125E4CC200F3F199 /* ResourceLoadScheduler.h in Headers */, 25424 25427 8A81BF8511DCFD9000DA2B98 /* ResourceLoadTiming.h in Headers */, 25428 E1C94AF9191303F000D5A893 /* BlobPart.h in Headers */, 25425 25429 7EE6846D12D26E3800E79415 /* ResourceRequest.h in Headers */, 25426 25430 514C767D0CE923A1007EF3CD /* ResourceRequestBase.h in Headers */, -
trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp
r168126 r168333 135 135 } 136 136 137 BlobDataItemList items = blobBuilder.finalize(); 138 auto blobData = std::make_unique<BlobData>(); 139 blobData->setContentType(Blob::normalizedContentType(type)); 140 blobData->swapItems(items); 141 142 RefPtr<Blob> blob = Blob::create(std::move(blobData)); 137 RefPtr<Blob> blob = Blob::create(blobBuilder.finalize(), Blob::normalizedContentType(type)); 143 138 144 139 return JSValue::encode(CREATE_DOM_WRAPPER(jsConstructor->globalObject(), Blob, blob.get())); -
trunk/Source/WebCore/dom/DataTransfer.cpp
r167784 r168333 190 190 191 191 for (const String& filename : m_pasteboard->readFilenames()) { 192 if (equalIgnoringCase(File::contentTypeFromFilePath (filename, File::AllContentTypes), type))192 if (equalIgnoringCase(File::contentTypeFromFilePathOrName(filename, File::AllContentTypes), type)) 193 193 return true; 194 194 } -
trunk/Source/WebCore/fileapi/Blob.cpp
r168209 r168333 67 67 68 68 69 Blob::Blob(UninitializedContructor) 70 { 71 } 72 69 73 Blob::Blob() 70 74 : m_size(0) 71 75 { 72 auto blobData = std::make_unique<BlobData>();73 74 // Create a new internal URL and register it with the provided blob data.75 76 m_internalURL = BlobURL::createInternalURL(); 76 ThreadableBlobRegistry::registerBlobURL(m_internalURL, std::move(blobData));77 ThreadableBlobRegistry::registerBlobURL(m_internalURL, Vector<BlobPart>(), String()); 77 78 } 78 79 79 Blob::Blob( std::unique_ptr<BlobData> blobData)80 : m_type( blobData->contentType())80 Blob::Blob(Vector<char> data, const String& contentType) 81 : m_type(contentType) 81 82 { 82 ASSERT(blobData); 83 84 // Create a new internal URL and register it with the provided blob data. 83 Vector<BlobPart> blobParts; 84 blobParts.append(BlobPart(std::move(data))); 85 85 m_internalURL = BlobURL::createInternalURL(); 86 m_size = ThreadableBlobRegistry::registerBlobURL(m_internalURL, std::move(blob Data));86 m_size = ThreadableBlobRegistry::registerBlobURL(m_internalURL, std::move(blobParts), contentType); 87 87 } 88 88 89 Blob::Blob(const URL& srcURL, const String& type, long long size) 89 Blob::Blob(Vector<BlobPart> blobParts, const String& contentType) 90 : m_type(contentType) 91 { 92 m_internalURL = BlobURL::createInternalURL(); 93 m_size = ThreadableBlobRegistry::registerBlobURL(m_internalURL, std::move(blobParts), contentType); 94 } 95 96 Blob::Blob(DeserializationContructor, const URL& srcURL, const String& type, long long size) 90 97 : m_type(Blob::normalizedContentType(type)) 91 98 , m_size(size) 92 99 { 93 // Create a new internal URL and register it with the same blob data as the source URL.94 100 m_internalURL = BlobURL::createInternalURL(); 95 101 ThreadableBlobRegistry::registerBlobURL(0, m_internalURL, srcURL); … … 100 106 : m_type(Blob::normalizedContentType(type)) 101 107 { 102 // Create a new internal URL and register it with the same blob data as the source URL.103 108 m_internalURL = BlobURL::createInternalURL(); 104 109 m_size = ThreadableBlobRegistry::registerBlobURLForSlice(m_internalURL, srcURL, start, end); -
trunk/Source/WebCore/fileapi/Blob.h
r168183 r168333 32 32 #define Blob_h 33 33 34 #include "BlobData.h" 35 #include "URL.h" 34 #include "BlobPart.h" 36 35 #include "ScriptWrappable.h" 37 36 #include "URLRegistry.h" … … 51 50 } 52 51 53 static PassRefPtr<Blob> create( std::unique_ptr<BlobData> blobData)52 static PassRefPtr<Blob> create(Vector<char> data, const String& contentType) 54 53 { 55 return adoptRef(new Blob(std::move(blobData))); 54 return adoptRef(new Blob(std::move(data), contentType)); 55 } 56 57 static PassRefPtr<Blob> create(Vector<BlobPart> blobParts, const String& contentType) 58 { 59 return adoptRef(new Blob(std::move(blobParts), contentType)); 56 60 } 57 61 … … 59 63 { 60 64 ASSERT(Blob::isNormalizedContentType(type)); 61 return adoptRef(new Blob( srcURL, type, size));65 return adoptRef(new Blob(deserializationContructor, srcURL, type, size)); 62 66 } 63 67 … … 90 94 protected: 91 95 Blob(); 92 Blob(std::unique_ptr<BlobData>); 96 Blob(Vector<char>, const String& contentType); 97 Blob(Vector<BlobPart>, const String& contentType); 93 98 94 // For deserialization. 95 Blob(const URL& srcURL, const String& type, long long size); 99 enum UninitializedContructor { uninitializedContructor }; 100 Blob(UninitializedContructor); 101 102 enum DeserializationContructor { deserializationContructor }; 103 Blob(DeserializationContructor, const URL& srcURL, const String& type, long long size); 96 104 97 105 #if ENABLE(BLOB) -
trunk/Source/WebCore/fileapi/File.cpp
r168126 r168333 27 27 #include "File.h" 28 28 29 #include "BlobURL.h" 29 30 #include "FileMetadata.h" 30 31 #include "FileSystem.h" 31 32 #include "MIMETypeRegistry.h" 33 #include "ThreadableBlobRegistry.h" 32 34 #include <wtf/CurrentTime.h> 33 35 #include <wtf/DateMath.h> … … 36 38 namespace WebCore { 37 39 38 static std::unique_ptr<BlobData> createBlobDataForFileWithType(const String& path, const String& contentType)39 {40 auto blobData = std::make_unique<BlobData>();41 ASSERT(Blob::isNormalizedContentType(contentType));42 blobData->setContentType(contentType);43 blobData->appendFile(path);44 return blobData;45 }46 47 static std::unique_ptr<BlobData> createBlobDataForFile(const String& path, File::ContentTypeLookupPolicy policy)48 {49 return createBlobDataForFileWithType(path, File::contentTypeFromFilePath(path, policy));50 }51 52 static std::unique_ptr<BlobData> createBlobDataForFileWithName(const String& path, const String& fileSystemName, File::ContentTypeLookupPolicy policy)53 {54 return createBlobDataForFileWithType(path, File::contentTypeFromFilePath(fileSystemName, policy));55 }56 57 40 File::File(const String& path, ContentTypeLookupPolicy policy) 58 : Blob( createBlobDataForFile(path, policy))41 : Blob(uninitializedContructor) 59 42 , m_path(path) 60 43 , m_name(pathGetFileName(path)) 61 44 { 45 m_internalURL = BlobURL::createInternalURL(); 46 m_type = contentTypeFromFilePathOrName(path, policy); 47 m_size = -1; 48 ThreadableBlobRegistry::registerFileBlobURL(m_internalURL, path, m_type); 62 49 } 63 50 64 File::File(const String& path, const URL& url, const String& type) 65 : Blob(url, type, -1) 51 File::File(const String& path, const String& name, ContentTypeLookupPolicy policy) 52 : Blob(uninitializedContructor) 53 , m_path(path) 54 , m_name(name) 55 { 56 m_internalURL = BlobURL::createInternalURL(); 57 m_type = contentTypeFromFilePathOrName(name, policy); 58 m_size = -1; 59 ThreadableBlobRegistry::registerFileBlobURL(m_internalURL, path, m_type); 60 } 61 62 File::File(DeserializationContructor, const String& path, const URL& url, const String& type) 63 : Blob(deserializationContructor, url, type, -1) 66 64 , m_path(path) 67 65 { 68 66 m_name = pathGetFileName(path); 69 // FIXME: File object serialization/deserialization does not include 70 // newer file object data members: m_name and m_relativePath. 67 // FIXME: File object serialization/deserialization does not include m_name. 71 68 // See SerializedScriptValue.cpp 72 }73 74 File::File(const String& path, const String& name, ContentTypeLookupPolicy policy)75 : Blob(createBlobDataForFileWithName(path, name, policy))76 , m_path(path)77 , m_name(name)78 {79 69 } 80 70 … … 98 88 } 99 89 100 String File::contentTypeFromFilePath (const String& name, File::ContentTypeLookupPolicy policy)90 String File::contentTypeFromFilePathOrName(const String& name, File::ContentTypeLookupPolicy policy) 101 91 { 102 92 String type; -
trunk/Source/WebCore/fileapi/File.h
r168183 r168333 33 33 namespace WebCore { 34 34 35 struct FileMetadata;36 35 class URL; 37 36 38 class File : public Blob {37 class File final : public Blob { 39 38 public: 40 39 // AllContentTypes should only be used when the full path/name are trusted; otherwise, it could … … 52 51 static PassRefPtr<File> deserialize(const String& path, const URL& srcURL, const String& type) 53 52 { 54 return adoptRef(new File( path, srcURL, type));53 return adoptRef(new File(deserializationContructor, path, srcURL, type)); 55 54 } 56 55 … … 72 71 double lastModifiedDate() const; 73 72 74 static String contentTypeFromFilePath (const String&, ContentTypeLookupPolicy);73 static String contentTypeFromFilePathOrName(const String&, ContentTypeLookupPolicy); 75 74 76 75 private: … … 78 77 File(const String& path, const String& name, ContentTypeLookupPolicy); 79 78 80 // For deserialization. 81 File(const String& path, const URL& srcURL, const String& type); 79 File(DeserializationContructor, const String& path, const URL& srcURL, const String& type); 82 80 83 81 String m_path; -
trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp
r168127 r168333 32 32 #include "ThreadableBlobRegistry.h" 33 33 34 #include "Blob Data.h"34 #include "BlobPart.h" 35 35 #include "BlobRegistry.h" 36 36 #include "BlobURL.h" … … 51 51 WTF_MAKE_FAST_ALLOCATED; 52 52 public: 53 BlobRegistryContext(const URL& url, std::unique_ptr<BlobData> blobData) 54 : url(url.copy()) 55 , blobData(std::move(blobData)) 56 { 57 this->blobData->detachFromCurrentThread(); 53 BlobRegistryContext(const URL& url, Vector<BlobPart> blobParts, const String& contentType) 54 : url(url.copy()) 55 , contentType(contentType.isolatedCopy()) 56 , blobParts(std::move(blobParts)) 57 { 58 for (BlobPart& part : blobParts) 59 part.detachFromCurrentThread(); 58 60 } 59 61 … … 66 68 BlobRegistryContext(const URL& url) 67 69 : url(url.copy()) 70 { 71 } 72 73 BlobRegistryContext(const URL& url, const String& path, const String& contentType) 74 : url(url.copy()) 75 , path(path.isolatedCopy()) 76 , contentType(contentType.isolatedCopy()) 68 77 { 69 78 } … … 71 80 URL url; 72 81 URL srcURL; 73 std::unique_ptr<BlobData> blobData; 82 String path; 83 String contentType; 84 Vector<BlobPart> blobParts; 74 85 }; 75 86 … … 89 100 } 90 101 91 unsigned long long ThreadableBlobRegistry::registerBlobURL(const URL& url, std::unique_ptr<BlobData> blobData) 102 void ThreadableBlobRegistry::registerFileBlobURL(const URL& url, const String& path, const String& contentType) 103 { 104 if (isMainThread()) 105 blobRegistry().registerFileBlobURL(url, path, contentType); 106 else { 107 // BlobRegistryContext performs an isolated copy of data. 108 BlobRegistryContext* context = new BlobRegistryContext(url, path, contentType); 109 BinarySemaphore semaphore; 110 callOnMainThread([context] { 111 std::unique_ptr<BlobRegistryContext> blobRegistryContext(context); 112 blobRegistry().registerFileBlobURL(blobRegistryContext->url, blobRegistryContext->path, blobRegistryContext->contentType); 113 }); 114 } 115 } 116 117 unsigned long long ThreadableBlobRegistry::registerBlobURL(const URL& url, Vector<BlobPart> blobParts, const String& contentType) 92 118 { 93 119 unsigned long long resultSize; 94 120 if (isMainThread()) 95 resultSize = blobRegistry().registerBlobURL(url, std::move(blob Data));96 else { 97 // BlobRegistryContext performs an isolated copy of data. 98 BlobRegistryContext* context = new BlobRegistryContext(url, std::move(blob Data));121 resultSize = blobRegistry().registerBlobURL(url, std::move(blobParts), contentType); 122 else { 123 // BlobRegistryContext performs an isolated copy of data. 124 BlobRegistryContext* context = new BlobRegistryContext(url, std::move(blobParts), contentType); 99 125 BinarySemaphore semaphore; 100 126 callOnMainThread([context, &semaphore, &resultSize] { 101 127 std::unique_ptr<BlobRegistryContext> blobRegistryContext(context); 102 resultSize = blobRegistry().registerBlobURL(blobRegistryContext->url, std::move(blobRegistryContext->blob Data));128 resultSize = blobRegistry().registerBlobURL(blobRegistryContext->url, std::move(blobRegistryContext->blobParts), blobRegistryContext->contentType); 103 129 semaphore.signal(); 104 130 }); … … 169 195 #else 170 196 171 unsigned long long ThreadableBlobRegistry::registerBlobURL(const URL&, std::unique_ptr<BlobData>) 197 void ThreadableBlobRegistry::registerFileBlobURL(const URL&, const String&, const String&) 198 { 199 } 200 201 unsigned long long ThreadableBlobRegistry::registerBlobURL(const URL&, Vector<BlobPart>, const String&) 172 202 { 173 203 return 0; -
trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h
r168126 r168333 32 32 #define ThreadableBlobRegistry_h 33 33 34 #include <wtf/PassRefPtr.h> 34 #include <wtf/Forward.h> 35 #include <wtf/Vector.h> 35 36 36 37 namespace WebCore { 37 38 38 class Blob Data;39 class BlobPart; 39 40 class URL; 40 41 class SecurityOrigin; … … 42 43 class ThreadableBlobRegistry { 43 44 public: 44 static unsigned long long registerBlobURL(const URL&, std::unique_ptr<BlobData>); 45 static void registerFileBlobURL(const URL&, const String& path, const String& contentType); 46 static unsigned long long registerBlobURL(const URL&, Vector<BlobPart> blobParts, const String& contentType); 45 47 static void registerBlobURL(SecurityOrigin*, const URL&, const URL& srcURL); 46 48 static void unregisterBlobURL(const URL&); -
trunk/Source/WebCore/fileapi/WebKitBlobBuilder.cpp
r168209 r168333 76 76 return; 77 77 78 appendBytesData(arrayBuffer->data(), arrayBuffer->byteLength());78 m_appendableData.append(static_cast<const char*>(arrayBuffer->data()), arrayBuffer->byteLength()); 79 79 } 80 80 … … 84 84 return; 85 85 86 appendBytesData(arrayBufferView->baseAddress(), arrayBufferView->byteLength());86 m_appendableData.append(static_cast<const char*>(arrayBufferView->baseAddress()), arrayBufferView->byteLength()); 87 87 } 88 88 #endif … … 93 93 return; 94 94 if (!m_appendableData.isEmpty()) 95 m_items.append(BlobDataItem(RawData::create(std::move(m_appendableData)))); 96 if (blob->isFile()) { 97 File* file = toFile(blob); 98 m_items.append(BlobDataItem(file->path(), 0, BlobDataItem::toEndOfFile, invalidFileTime())); 99 } else { 100 long long blobSize = static_cast<long long>(blob->size()); 101 m_items.append(BlobDataItem(blob->url(), 0, blobSize)); 102 } 95 m_items.append(BlobPart(std::move(m_appendableData))); 96 m_items.append(BlobPart(blob->url())); 103 97 } 104 98 105 void BlobBuilder::appendBytesData(const void* data, size_t length) 106 { 107 m_appendableData.append(static_cast<const char*>(data), length); 108 } 109 110 BlobDataItemList BlobBuilder::finalize() 99 Vector<BlobPart> BlobBuilder::finalize() 111 100 { 112 101 if (!m_appendableData.isEmpty()) 113 m_items.append(Blob DataItem(RawData::create(std::move(m_appendableData))));102 m_items.append(BlobPart(std::move(m_appendableData))); 114 103 return std::move(m_items); 115 104 } -
trunk/Source/WebCore/fileapi/WebKitBlobBuilder.h
r168126 r168333 32 32 #define WebKitBlobBuilder_h 33 33 34 #include "BlobData.h" 35 #include <wtf/Forward.h> 34 #include "BlobPart.h" 36 35 37 36 namespace JSC { … … 55 54 #endif 56 55 57 BlobDataItemListfinalize();56 Vector<BlobPart> finalize(); 58 57 59 58 private: 60 void appendBytesData(const void*, size_t); 61 62 BlobDataItemList m_items; 59 Vector<BlobPart> m_items; 63 60 Vector<char> m_appendableData; 64 61 }; -
trunk/Source/WebCore/platform/network/BlobData.cpp
r168032 r168333 46 46 const long long BlobDataItem::toEndOfFile = -1; 47 47 48 void BlobDataItem::detachFromCurrentThread()49 {50 path = path.isolatedCopy();51 url = url.copy();52 }53 54 void BlobData::detachFromCurrentThread()55 {56 m_contentType = m_contentType.isolatedCopy();57 m_contentDisposition = m_contentDisposition.isolatedCopy();58 for (size_t i = 0; i < m_items.size(); ++i)59 m_items.at(i).detachFromCurrentThread();60 }61 62 48 void BlobData::setContentType(const String& contentType) 63 49 { -
trunk/Source/WebCore/platform/network/BlobData.h
r168201 r168333 41 41 namespace WebCore { 42 42 43 // FIXME: RawData doesn't need to be ThreadSafeRefCounted any more. We can probably switch to another data buffer type now. 43 44 class RawData : public ThreadSafeRefCounted<RawData> { 44 45 public: … … 119 120 } 120 121 121 // Detaches from current thread so that it can be passed to another thread.122 void detachFromCurrentThread();123 124 122 enum { 125 123 Data, … … 162 160 BlobData() { } 163 161 164 // Detaches from current thread so that it can be passed to another thread.165 void detachFromCurrentThread();166 167 162 const String& contentType() const { return m_contentType; } 168 163 void setContentType(const String&); -
trunk/Source/WebCore/platform/network/BlobRegistry.h
r168126 r168333 32 32 #define BlobRegistry_h 33 33 34 #include <wtf/PassOwnPtr.h> 34 #include <wtf/Forward.h> 35 #include <wtf/Vector.h> 35 36 36 37 namespace WebCore { 37 38 38 class BlobData; 39 class BlobStorageData; 39 class BlobPart; 40 40 class BlobRegistry; 41 41 class URL; … … 46 46 class BlobRegistry { 47 47 public: 48 49 // Registers a blob URL referring to the specified file. 50 virtual void registerFileBlobURL(const URL&, const String& path, const String& contentType) = 0; 51 48 52 // Registers a blob URL referring to the specified blob data. 49 virtual unsigned long long registerBlobURL(const URL&, std::unique_ptr<BlobData>) = 0;53 virtual unsigned long long registerBlobURL(const URL&, Vector<BlobPart>, const String& contentType) = 0; 50 54 51 55 // Registers a new blob URL referring to the blob data identified by the specified srcURL. -
trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp
r168201 r168333 35 35 #if ENABLE(BLOB) 36 36 37 #include "BlobPart.h" 37 38 #include "BlobResourceHandle.h" 38 39 #include "BlobStorageData.h" … … 117 118 } 118 119 119 unsigned long long BlobRegistryImpl::registerBlobURL(const URL& url, std::unique_ptr<BlobData> blobData)120 void BlobRegistryImpl::registerFileBlobURL(const URL& url, const String& path, const String& contentType) 120 121 { 121 122 ASSERT(isMainThread()); 122 123 registerBlobResourceHandleConstructor(); 123 124 124 RefPtr<BlobStorageData> blobStorageData = BlobStorageData::create(blobData->contentType()); 125 RefPtr<BlobStorageData> blobStorageData = BlobStorageData::create(contentType); 126 127 // FIXME: Factor out size and modification tracking for a cleaner implementation. 128 FileMetadata metadata; 129 if (!getFileMetadata(path, metadata)) 130 return; 131 132 blobStorageData->m_data.appendFile(path, 0, metadata.length, metadata.modificationTime); 133 m_blobs.set(url.string(), blobStorageData); 134 } 135 136 unsigned long long BlobRegistryImpl::registerBlobURL(const URL& url, Vector<BlobPart> blobParts, const String& contentType) 137 { 138 ASSERT(isMainThread()); 139 registerBlobResourceHandleConstructor(); 140 141 RefPtr<BlobStorageData> blobStorageData = BlobStorageData::create(contentType); 125 142 126 143 // The blob data is stored in the "canonical" way. That is, it only contains a list of Data and File items. … … 130 147 // All the Blob items in the passing blob data are resolved and expanded into a set of Data and File items. 131 148 132 // FIXME: BlobDataItems contain a lot of information that we do not expect to be present when registering a new blob,133 // these data members are only used inside the registry. Use a more appropriate type than BlobData.134 135 149 unsigned long long size = 0; 136 for (const BlobDataItem& item : blobData->items()) { 137 switch (item.type) { 138 case BlobDataItem::Data: 139 blobStorageData->m_data.appendData(item.data, 0, item.data->length()); 140 size += item.data->length(); 150 for (BlobPart& part : blobParts) { 151 switch (part.type()) { 152 case BlobPart::Data: { 153 unsigned long long partSize = part.data().size(); 154 RefPtr<RawData> rawData = RawData::create(part.moveData()); 155 size += partSize; 156 blobStorageData->m_data.appendData(rawData.release(), 0, partSize); 141 157 break; 142 case BlobDataItem::File: { 143 ASSERT(!item.offset); 144 ASSERT(item.length == BlobDataItem::toEndOfFile); 145 ASSERT(!isValidFileTime(item.expectedModificationTime)); 146 147 // FIXME: Factor out size and modification tracking for a cleaner implementation. 148 FileMetadata metadata; 149 if (!getFileMetadata(item.path, metadata)) 158 } 159 case BlobPart::Blob: { 160 if (!m_blobs.contains(part.url().string())) 150 161 return 0; 151 152 blobStorageData->m_data.appendFile(item.path, 0, metadata.length, metadata.modificationTime);153 size += metadata.length;162 unsigned long long partSize = blobSize(part.url()); // As a side effect, this calculates sizes of all files in the blob. 163 size += partSize; 164 appendStorageItems(blobStorageData.get(), m_blobs.get(part.url().string())->items(), 0, partSize); 154 165 break; 155 166 } 156 case BlobDataItem::Blob:157 if (!m_blobs.contains(item.url.string()))158 return 0;159 size += blobSize(item.url); // As a side effect, this calculates sizes of all files in the blob.160 ASSERT(blobSize(item.url) == static_cast<unsigned long long>(item.length));161 appendStorageItems(blobStorageData.get(), m_blobs.get(item.url.string())->items(), item.offset, item.length);162 break;163 167 } 164 168 } -
trunk/Source/WebCore/platform/network/BlobRegistryImpl.h
r168126 r168333 46 46 47 47 // BlobRegistryImpl is not thread-safe. It should only be called from main thread. 48 class BlobRegistryImpl : public BlobRegistry {48 class BlobRegistryImpl final : public BlobRegistry { 49 49 WTF_MAKE_FAST_ALLOCATED; 50 50 public: … … 58 58 void appendStorageItems(BlobStorageData*, const BlobDataItemList&, long long offset, long long length); 59 59 60 virtual unsigned long long registerBlobURL(const URL&, std::unique_ptr<BlobData>) override; 60 virtual void registerFileBlobURL(const WebCore::URL&, const String& path, const String& contentType) override; 61 virtual unsigned long long registerBlobURL(const URL&, Vector<BlobPart>, const String& contentType) override; 61 62 virtual void registerBlobURL(const URL&, const URL& srcURL) override; 62 63 virtual unsigned long long registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end) override; -
trunk/Source/WebCore/platform/network/FormData.cpp
r168199 r168333 24 24 #include "FormData.h" 25 25 26 #include "BlobData.h"27 26 #include "BlobRegistryImpl.h" 27 #include "BlobStorageData.h" 28 28 #include "BlobURL.h" 29 29 #include "Chrome.h" -
trunk/Source/WebCore/xml/XMLHttpRequest.cpp
r168209 r168333 25 25 26 26 #include "Blob.h" 27 #include "BlobData.h"28 27 #include "ContentSecurityPolicy.h" 29 28 #include "CrossOriginAccessControl.h" … … 290 289 if (m_binaryResponseBuilder) { 291 290 // FIXME: We just received the data from NetworkProcess, and are sending it back. This is inefficient. 292 unsigned size = m_binaryResponseBuilder->size(); 293 auto blobData = std::make_unique<BlobData>(); 294 blobData->appendData(RawData::create(m_binaryResponseBuilder->data(), size), 0, BlobDataItem::toEndOfFile); 295 String normalizedContentType = Blob::normalizedContentType(responseMIMEType()); 296 blobData->setContentType(normalizedContentType); // responseMIMEType defaults to text/xml which may be incorrect. 291 Vector<char> data; 292 data.append(m_binaryResponseBuilder->data(), m_binaryResponseBuilder->size()); 293 String normalizedContentType = Blob::normalizedContentType(responseMIMEType()); // responseMIMEType defaults to text/xml which may be incorrect. 294 m_responseBlob = Blob::create(std::move(data), normalizedContentType); 297 295 m_binaryResponseBuilder.clear(); 298 m_responseBlob = Blob::create(std::move(blobData));299 296 } else { 300 297 // If we errored out or got no data, we still return a blob, just an empty one. -
trunk/Source/WebKit2/CMakeLists.txt
r167488 r168333 270 270 Shared/Downloads/DownloadManager.cpp 271 271 272 Shared/FileAPI/BlobRegistrationData.cpp273 274 272 Shared/Network/NetworkProcessCreationParameters.cpp 275 273 Shared/Network/NetworkResourceLoadParameters.cpp -
trunk/Source/WebKit2/ChangeLog
r168325 r168333 1 2014-05-05 Alexey Proskuryakov <ap@apple.com> 2 3 Stop using BlobData on client side 4 https://bugs.webkit.org/show_bug.cgi?id=132582 5 6 Reviewed by Sam Weinig. 7 8 Update for WebCore changes. 9 10 * CMakeLists.txt: 11 * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp: 12 (WebKit::NetworkBlobRegistry::registerFileBlobURL): 13 (WebKit::NetworkBlobRegistry::registerBlobURL): 14 * NetworkProcess/FileAPI/NetworkBlobRegistry.h: 15 * NetworkProcess/NetworkConnectionToWebProcess.cpp: 16 (WebKit::NetworkConnectionToWebProcess::registerFileBlobURL): 17 (WebKit::NetworkConnectionToWebProcess::registerBlobURL): 18 * NetworkProcess/NetworkConnectionToWebProcess.h: 19 * NetworkProcess/NetworkConnectionToWebProcess.messages.in: 20 * Shared/FileAPI/BlobRegistrationData.cpp: Removed. 21 * Shared/FileAPI/BlobRegistrationData.h: Removed. 22 * Shared/WebCoreArgumentCoders.cpp: 23 (IPC::ArgumentCoder<BlobPart>::encode): 24 (IPC::ArgumentCoder<BlobPart>::decode): 25 * Shared/WebCoreArgumentCoders.h: 26 * WebKit2.xcodeproj/project.pbxproj: 27 * WebProcess/FileAPI/BlobRegistryProxy.cpp: 28 (WebKit::BlobRegistryProxy::registerFileBlobURL): 29 (WebKit::BlobRegistryProxy::registerBlobURL): 30 * WebProcess/FileAPI/BlobRegistryProxy.h: 31 1 32 2014-05-05 Beth Dakin <bdakin@apple.com> 2 33 -
trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp
r168126 r168333 30 30 31 31 #include "SandboxExtension.h" 32 #include <WebCore/BlobPart.h> 32 33 #include <WebCore/BlobRegistryImpl.h> 33 34 #include <wtf/NeverDestroyed.h> … … 49 50 } 50 51 51 uint64_t NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess* connection, const URL& url, std::unique_ptr<BlobData> data, const Vector<RefPtr<SandboxExtension>>& newSandboxExtensions)52 void NetworkBlobRegistry::registerFileBlobURL(NetworkConnectionToWebProcess* connection, const URL& url, const String& path, PassRefPtr<SandboxExtension> sandboxExtension, const String& contentType) 52 53 { 53 54 ASSERT(!m_sandboxExtensions.contains(url.string())); 54 55 55 // Combine new extensions for File items and existing extensions for inner Blob items.56 Vector<RefPtr<SandboxExtension>> sandboxExtensions = newSandboxExtensions; 57 const BlobDataItemList& items = data->items();58 for (size_t i = 0, count = items.size(); i < count; ++i) {59 if (items[i].type == BlobDataItem::Blob)60 sandboxExtensions.appendVector(m_sandboxExtensions.get(items[i].url.string()));56 blobRegistry().registerFileBlobURL(url, path, contentType); 57 58 if (sandboxExtension) { 59 Vector<RefPtr<SandboxExtension>> extensionsVector; 60 extensionsVector.append(sandboxExtension); 61 m_sandboxExtensions.add(url.string(), std::move(extensionsVector)); 61 62 } 62 63 63 uint64_t resultSize = blobRegistry().registerBlobURL(url, std::move(data)); 64 ASSERT(!m_blobsForConnection.get(connection).contains(url)); 65 BlobForConnectionMap::iterator mapIterator = m_blobsForConnection.find(connection); 66 if (mapIterator == m_blobsForConnection.end()) 67 mapIterator = m_blobsForConnection.add(connection, HashSet<URL>()).iterator; 68 mapIterator->value.add(url); 69 } 70 71 uint64_t NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess* connection, const URL& url, Vector<WebCore::BlobPart> blobParts, const String& contentType) 72 { 73 ASSERT(!m_sandboxExtensions.contains(url.string())); 74 75 // Combine existing extensions for inner Blob items. 76 Vector<RefPtr<SandboxExtension>> sandboxExtensions; 77 for (const BlobPart& part : blobParts) { 78 if (part.type() == BlobPart::Blob) 79 sandboxExtensions.appendVector(m_sandboxExtensions.get(part.url().string())); 80 } 81 82 uint64_t resultSize = blobRegistry().registerBlobURL(url, std::move(blobParts), contentType); 64 83 65 84 if (!sandboxExtensions.isEmpty()) 66 m_sandboxExtensions.add(url.string(), s andboxExtensions);85 m_sandboxExtensions.add(url.string(), std::move(sandboxExtensions)); 67 86 68 87 ASSERT(!m_blobsForConnection.get(connection).contains(url)); -
trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.h
r168126 r168333 34 34 35 35 namespace WebCore { 36 class Blob Data;36 class BlobPart; 37 37 } 38 38 … … 48 48 static NetworkBlobRegistry& shared(); 49 49 50 uint64_t registerBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&, std::unique_ptr<WebCore::BlobData>, const Vector<RefPtr<SandboxExtension>>&); 50 void registerFileBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&, const String& path, PassRefPtr<SandboxExtension>, const String& contentType); 51 uint64_t registerBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&, Vector<WebCore::BlobPart>, const String& contentType); 51 52 void registerBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&, const WebCore::URL& srcURL); 52 53 uint64_t registerBlobURLForSlice(NetworkConnectionToWebProcess*, const WebCore::URL&, const WebCore::URL& srcURL, int64_t start, int64_t end); -
trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp
r168126 r168333 29 29 #if ENABLE(NETWORK_PROCESS) 30 30 31 #include "BlobRegistrationData.h"32 31 #include "ConnectionStack.h" 33 32 #include "NetworkBlobRegistry.h" … … 39 38 #include "RemoteNetworkingContext.h" 40 39 #include "SessionTracker.h" 41 #include <WebCore/BlobData.h>42 40 #include <WebCore/PlatformCookieJar.h> 43 41 #include <WebCore/ResourceLoaderOptions.h> … … 226 224 227 225 #if ENABLE(BLOB) 228 void NetworkConnectionToWebProcess::registerBlobURL(const URL& url, const BlobRegistrationData& data, uint64_t& resultSize) 229 { 230 Vector<RefPtr<SandboxExtension>> extensions; 231 for (size_t i = 0, count = data.sandboxExtensions().size(); i < count; ++i) { 232 if (RefPtr<SandboxExtension> extension = SandboxExtension::create(data.sandboxExtensions()[i])) 233 extensions.append(extension); 234 } 235 236 resultSize = NetworkBlobRegistry::shared().registerBlobURL(this, url, data.releaseData(), extensions); 226 void NetworkConnectionToWebProcess::registerFileBlobURL(const URL& url, const String& path, const SandboxExtension::Handle& extensionHandle, const String& contentType) 227 { 228 RefPtr<SandboxExtension> extension = SandboxExtension::create(extensionHandle); 229 230 NetworkBlobRegistry::shared().registerFileBlobURL(this, url, path, extension.release(), contentType); 231 } 232 233 void NetworkConnectionToWebProcess::registerBlobURL(const URL& url, Vector<BlobPart> blobParts, const String& contentType, uint64_t& resultSize) 234 { 235 resultSize = NetworkBlobRegistry::shared().registerBlobURL(this, url, std::move(blobParts), contentType); 237 236 } 238 237 -
trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h
r168126 r168333 42 42 namespace WebKit { 43 43 44 class BlobRegistrationData;45 44 class NetworkConnectionToWebProcess; 46 45 class NetworkResourceLoader; … … 89 88 90 89 #if ENABLE(BLOB) 91 void registerBlobURL(const WebCore::URL&, const BlobRegistrationData&, uint64_t& resultSize); 90 void registerFileBlobURL(const WebCore::URL&, const String& path, const SandboxExtension::Handle&, const String& contentType); 91 void registerBlobURL(const WebCore::URL&, Vector<WebCore::BlobPart>, const String& contentType, uint64_t& resultSize); 92 92 void registerBlobURLFromURL(const WebCore::URL&, const WebCore::URL& srcURL); 93 93 void registerBlobURLForSlice(const WebCore::URL&, const WebCore::URL& srcURL, int64_t start, int64_t end, uint64_t& resultSize); -
trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in
r168126 r168333 45 45 46 46 #if ENABLE(BLOB) 47 RegisterBlobURL(WebCore::URL url, WebKit::BlobRegistrationData data) -> (uint64_t resultSize) 47 RegisterFileBlobURL(WebCore::URL url, String path, WebKit::SandboxExtension::Handle extensionHandle, String contentType) 48 RegisterBlobURL(WebCore::URL url, Vector<WebCore::BlobPart> blobParts, String contentType) -> (uint64_t resultSize) 48 49 RegisterBlobURLFromURL(WebCore::URL url, WebCore::URL srcURL) 49 50 RegisterBlobURLForSlice(WebCore::URL url, WebCore::URL srcURL, int64_t start, int64_t end) -> (uint64_t resultSize) -
trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
r168228 r168333 30 30 #include "ShareableBitmap.h" 31 31 #include <WebCore/AuthenticationChallenge.h> 32 #include <WebCore/BlobPart.h> 32 33 #include <WebCore/CertificateInfo.h> 33 34 #include <WebCore/Cookie.h> … … 1973 1974 } 1974 1975 1976 void ArgumentCoder<BlobPart>::encode(ArgumentEncoder& encoder, const BlobPart& blobPart) 1977 { 1978 encoder << static_cast<uint32_t>(blobPart.type()); 1979 switch (blobPart.type()) { 1980 case BlobPart::Data: 1981 encoder << blobPart.data(); 1982 break; 1983 case BlobPart::Blob: 1984 encoder << blobPart.url(); 1985 break; 1986 } 1987 } 1988 1989 bool ArgumentCoder<BlobPart>::decode(ArgumentDecoder& decoder, BlobPart& blobPart) 1990 { 1991 uint32_t type; 1992 if (!decoder.decode(type)) 1993 return false; 1994 1995 switch (type) { 1996 case BlobPart::Data: { 1997 Vector<char> data; 1998 if (!decoder.decode(data)) 1999 return false; 2000 blobPart = BlobPart(std::move(data)); 2001 break; 2002 } 2003 case BlobPart::Blob: { 2004 String url; 2005 if (!decoder.decode(url)) 2006 return false; 2007 blobPart = BlobPart(URL(URL(), url)); 2008 break; 2009 } 2010 default: 2011 return false; 2012 } 2013 2014 return true; 2015 } 2016 1975 2017 } // namespace IPC -
trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h
r167266 r168333 32 32 class AffineTransform; 33 33 class AuthenticationChallenge; 34 class BlobPart; 34 35 class CertificateInfo; 35 36 class Color; … … 425 426 }; 426 427 428 template<> struct ArgumentCoder<WebCore::BlobPart> { 429 static void encode(ArgumentEncoder&, const WebCore::BlobPart&); 430 static bool decode(ArgumentDecoder&, WebCore::BlobPart&); 431 }; 432 427 433 } // namespace IPC 428 434 -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r168260 r168333 1529 1529 E170876B16D6CA6900F99226 /* BlobRegistryProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E170876916D6CA6900F99226 /* BlobRegistryProxy.cpp */; }; 1530 1530 E170876C16D6CA6900F99226 /* BlobRegistryProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = E170876A16D6CA6900F99226 /* BlobRegistryProxy.h */; }; 1531 E170877016D6CFE500F99226 /* BlobRegistrationData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E170876E16D6CFE400F99226 /* BlobRegistrationData.cpp */; };1532 E170877116D6CFE500F99226 /* BlobRegistrationData.h in Headers */ = {isa = PBXBuildFile; fileRef = E170876F16D6CFE500F99226 /* BlobRegistrationData.h */; };1533 1531 E179088D169BAA62006904C7 /* SecItemShim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18E6947169B77C8009B6670 /* SecItemShim.cpp */; }; 1534 1532 E179088F169BAA6A006904C7 /* SecItemShim.h in Headers */ = {isa = PBXBuildFile; fileRef = E18E6948169B77C8009B6670 /* SecItemShim.h */; }; … … 3441 3439 DF58C6351371ACA000F9A37C /* NativeWebWheelEventMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NativeWebWheelEventMac.mm; sourceTree = "<group>"; }; 3442 3440 E105FE5318D7B9DE008F57A8 /* EditingRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingRange.h; sourceTree = "<group>"; }; 3443 E115C715190F8A2500ECC516 /* com.apple.WebKit.Databases.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file; path = com.apple.WebKit.Databases.sb; sourceTree = "<group>"; };3441 E115C715190F8A2500ECC516 /* com.apple.WebKit.Databases.sb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = com.apple.WebKit.Databases.sb; sourceTree = "<group>"; }; 3444 3442 E133FD891423DD7F00FC7BFB /* WebKit.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = WebKit.icns; path = Resources/WebKit.icns; sourceTree = "<group>"; }; 3445 3443 E13833EB189C33C8001E2350 /* LocalStorageDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalStorageDetails.h; sourceTree = "<group>"; }; … … 3453 3451 E170876916D6CA6900F99226 /* BlobRegistryProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BlobRegistryProxy.cpp; path = WebProcess/FileAPI/BlobRegistryProxy.cpp; sourceTree = "<group>"; }; 3454 3452 E170876A16D6CA6900F99226 /* BlobRegistryProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BlobRegistryProxy.h; path = WebProcess/FileAPI/BlobRegistryProxy.h; sourceTree = "<group>"; }; 3455 E170876E16D6CFE400F99226 /* BlobRegistrationData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BlobRegistrationData.cpp; path = FileAPI/BlobRegistrationData.cpp; sourceTree = "<group>"; };3456 E170876F16D6CFE500F99226 /* BlobRegistrationData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BlobRegistrationData.h; path = FileAPI/BlobRegistrationData.h; sourceTree = "<group>"; };3457 3453 E1798C7716E6818800240139 /* NetworkBlobRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkBlobRegistry.cpp; path = NetworkProcess/FileAPI/NetworkBlobRegistry.cpp; sourceTree = "<group>"; }; 3458 3454 E1798C7816E6818800240139 /* NetworkBlobRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkBlobRegistry.h; path = NetworkProcess/FileAPI/NetworkBlobRegistry.h; sourceTree = "<group>"; }; … … 6578 6574 isa = PBXGroup; 6579 6575 children = ( 6580 E170876E16D6CFE400F99226 /* BlobRegistrationData.cpp */,6581 E170876F16D6CFE500F99226 /* BlobRegistrationData.h */,6582 6576 ); 6583 6577 name = FileAPI; … … 6671 6665 518E8EF916B2091C00E91429 /* AuthenticationManager.h in Headers */, 6672 6666 512F58A312A883AD00629530 /* AuthenticationManagerMessages.h in Headers */, 6673 E170877116D6CFE500F99226 /* BlobRegistrationData.h in Headers */,6674 6667 E170876C16D6CA6900F99226 /* BlobRegistryProxy.h in Headers */, 6675 6668 4F601432155C5AA2001FBDE0 /* BlockingResponseMap.h in Headers */, … … 8155 8148 518E8EFB16B2091C00E91429 /* AuthenticationManager.mac.mm in Sources */, 8156 8149 512F58A212A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp in Sources */, 8157 E170877016D6CFE500F99226 /* BlobRegistrationData.cpp in Sources */,8158 8150 E170876B16D6CA6900F99226 /* BlobRegistryProxy.cpp in Sources */, 8159 8151 BCF18638167D071E00A1A85A /* CacheModel.cpp in Sources */, -
trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp
r168126 r168333 29 29 #if ENABLE(BLOB) && ENABLE(NETWORK_PROCESS) 30 30 31 #include "BlobRegistrationData.h"32 31 #include "NetworkConnectionToWebProcessMessages.h" 33 32 #include "NetworkProcessConnection.h" 34 33 #include "WebCoreArgumentCoders.h" 35 34 #include "WebProcess.h" 36 #include <WebCore/BlobData.h>37 35 38 36 using namespace WebCore; … … 40 38 namespace WebKit { 41 39 42 unsigned long long BlobRegistryProxy::registerBlobURL(const URL& url, std::unique_ptr<BlobData> blobData) 40 void BlobRegistryProxy::registerFileBlobURL(const WebCore::URL& url, const String& path, const String& contentType) 41 { 42 ASSERT(WebProcess::shared().usesNetworkProcess()); 43 44 SandboxExtension::Handle extensionHandle; 45 46 // File path can be empty when submitting a form file input without a file, see bug 111778. 47 if (!path.isEmpty()) 48 SandboxExtension::createHandle(path, SandboxExtension::ReadOnly, extensionHandle); 49 50 WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterFileBlobURL(url, path, extensionHandle, contentType), 0); 51 } 52 53 unsigned long long BlobRegistryProxy::registerBlobURL(const URL& url, Vector<BlobPart> blobParts, const String& contentType) 43 54 { 44 55 ASSERT(WebProcess::shared().usesNetworkProcess()); 45 56 46 57 uint64_t resultSize; 47 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::RegisterBlobURL(url, BlobRegistrationData(std::move(blobData))), Messages::NetworkConnectionToWebProcess::RegisterBlobURL::Reply(resultSize), 0))58 if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::RegisterBlobURL(url, blobParts, contentType), Messages::NetworkConnectionToWebProcess::RegisterBlobURL::Reply(resultSize), 0)) 48 59 return 0; 49 60 return resultSize; -
trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h
r168126 r168333 33 33 namespace WebKit { 34 34 35 class BlobRegistryProxy : public WebCore::BlobRegistry {35 class BlobRegistryProxy final : public WebCore::BlobRegistry { 36 36 public: 37 virtual unsigned long long registerBlobURL(const WebCore::URL&, std::unique_ptr<WebCore::BlobData>) override; 37 virtual void registerFileBlobURL(const WebCore::URL&, const String& path, const String& contentType) override; 38 virtual unsigned long long registerBlobURL(const WebCore::URL&, Vector<WebCore::BlobPart>, const String& contentType) override; 38 39 virtual void registerBlobURL(const WebCore::URL&, const WebCore::URL& srcURL) override; 39 40 virtual void unregisterBlobURL(const WebCore::URL&) override;
Note: See TracChangeset
for help on using the changeset viewer.