Changeset 198869 in webkit
- Timestamp:
- Mar 30, 2016 6:21:04 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r198864 r198869 1 2016-03-30 Brady Eidson <beidson@apple.com> 2 3 Make BlobData use ThreadSafeSharedBuffer instead of RawData. 4 https://bugs.webkit.org/show_bug.cgi?id=156041 5 6 Reviewed by Alex Christensen. 7 8 No new tests (No change in behavior). 9 10 * Modules/fetch/FetchBody.cpp: 11 (WebCore::FetchBody::consumeText): 12 (WebCore::FetchBody::extractFromText): 13 (WebCore::blobFromArrayBuffer): 14 * Modules/fetch/FetchBody.h: 15 * Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp: 16 (WebCore::ThreadableWebSocketChannelClientWrapper::didReceiveBinaryData): 17 * Modules/websockets/ThreadableWebSocketChannelClientWrapper.h: 18 * Modules/websockets/WebSocket.cpp: 19 (WebCore::WebSocket::didReceiveBinaryData): 20 * Modules/websockets/WebSocket.h: 21 * Modules/websockets/WebSocketChannel.cpp: 22 (WebCore::WebSocketChannel::processFrame): 23 * Modules/websockets/WebSocketChannel.h: 24 * Modules/websockets/WebSocketChannelClient.h: 25 (WebCore::WebSocketChannelClient::didReceiveBinaryData): 26 * Modules/websockets/WorkerThreadableWebSocketChannel.cpp: 27 (WebCore::WorkerThreadableWebSocketChannel::Peer::didReceiveBinaryData): 28 * Modules/websockets/WorkerThreadableWebSocketChannel.h: 29 * fileapi/Blob.cpp: 30 (WebCore::Blob::Blob): 31 * fileapi/Blob.h: 32 (WebCore::Blob::create): 33 * fileapi/WebKitBlobBuilder.h: 34 * platform/network/BlobData.cpp: 35 (WebCore::BlobData::BlobData): 36 (WebCore::BlobDataItem::length): 37 (WebCore::BlobData::appendData): 38 (WebCore::BlobData::setContentType): Deleted. 39 * platform/network/BlobData.h: 40 (WebCore::BlobDataItem::type): 41 (WebCore::BlobDataItem::data): 42 (WebCore::BlobDataItem::file): 43 (WebCore::BlobDataItem::BlobDataItem): 44 (WebCore::BlobData::create): 45 (WebCore::RawData::create): Deleted. 46 (WebCore::RawData::data): Deleted. 47 (WebCore::RawData::length): Deleted. 48 (WebCore::RawData::RawData): Deleted. 49 * platform/network/BlobPart.h: 50 (WebCore::BlobPart::BlobPart): 51 (WebCore::BlobPart::data): 52 (WebCore::BlobPart::moveData): 53 * platform/network/BlobRegistryImpl.cpp: 54 (WebCore::BlobRegistryImpl::appendStorageItems): 55 (WebCore::BlobRegistryImpl::registerFileBlobURL): 56 (WebCore::BlobRegistryImpl::registerBlobURL): 57 (WebCore::BlobRegistryImpl::registerBlobURLForSlice): 58 * platform/network/BlobResourceHandle.cpp: 59 (WebCore::BlobResourceHandle::getSizeForNext): 60 (WebCore::BlobResourceHandle::readSync): 61 (WebCore::BlobResourceHandle::readDataSync): 62 (WebCore::BlobResourceHandle::readFileSync): 63 (WebCore::BlobResourceHandle::readAsync): 64 (WebCore::BlobResourceHandle::readDataAsync): 65 (WebCore::BlobResourceHandle::readFileAsync): 66 * platform/network/BlobResourceHandle.h: 67 * platform/network/FormData.cpp: 68 (WebCore::appendBlobResolved): 69 * platform/network/soup/ResourceHandleSoup.cpp: 70 (WebCore::blobIsOutOfDate): 71 (WebCore::addEncodedBlobItemToSoupMessageBody): 72 * platform/text/LineEnding.cpp: 73 (WebCore::normalizeToCROrLF): 74 (WebCore::normalizeLineEndingsToNative): 75 (WebCore::normalizeLineEndingsToCR): Deleted. 76 (WebCore::normalizeLineEndingsToLF): Deleted. 77 * platform/text/LineEnding.h: 78 * xml/XMLHttpRequest.cpp: 79 (WebCore::XMLHttpRequest::responseBlob): 80 1 81 2016-03-30 Enrica Casucci <enrica@apple.com> 2 82 -
trunk/Source/WebCore/Modules/fetch/FetchBody.cpp
r198665 r198869 202 202 203 203 if (type == Consumer::Type::ArrayBuffer) { 204 Vector< char> data = extractFromText();204 Vector<uint8_t> data = extractFromText(); 205 205 fulfillPromiseWithArrayBuffer(promise, data.data(), data.size()); 206 206 return; … … 233 233 } 234 234 235 Vector< char> FetchBody::extractFromText() const235 Vector<uint8_t> FetchBody::extractFromText() const 236 236 { 237 237 ASSERT(m_type == Type::Text); 238 238 // FIXME: This double allocation is not efficient. Might want to fix that at WTFString level. 239 239 CString data = m_text.utf8(); 240 Vector< char> value(data.length());240 Vector<uint8_t> value(data.length()); 241 241 memcpy(value.data(), data.data(), data.length()); 242 242 return value; … … 246 246 { 247 247 if (!buffer) 248 return Blob::create(Vector< char>(), contentType);248 return Blob::create(Vector<uint8_t>(), contentType); 249 249 250 250 // FIXME: We should try to move buffer to Blob without doing this copy. 251 Vector< char> value(buffer->byteLength());251 Vector<uint8_t> value(buffer->byteLength()); 252 252 memcpy(value.data(), buffer->data(), buffer->byteLength()); 253 253 return Blob::create(WTFMove(value), contentType); -
trunk/Source/WebCore/Modules/fetch/FetchBody.h
r198665 r198869 88 88 void consume(FetchBodyOwner&, Consumer::Type, DeferredWrapper&&); 89 89 90 Vector< char> extractFromText() const;90 Vector<uint8_t> extractFromText() const; 91 91 bool processIfEmptyOrDisturbed(Consumer::Type, DeferredWrapper&); 92 92 void consumeArrayBuffer(Consumer::Type, DeferredWrapper&); -
trunk/Source/WebCore/Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp
r194496 r198869 181 181 } 182 182 183 void ThreadableWebSocketChannelClientWrapper::didReceiveBinaryData(Vector< char>&& binaryData)184 { 185 ref(); 186 Vector< char>* capturedData = new Vector<char>(WTFMove(binaryData));183 void ThreadableWebSocketChannelClientWrapper::didReceiveBinaryData(Vector<uint8_t>&& binaryData) 184 { 185 ref(); 186 Vector<uint8_t>* capturedData = new Vector<uint8_t>(WTFMove(binaryData)); 187 187 m_pendingTasks.append(std::make_unique<ScriptExecutionContext::Task>([this, capturedData] (ScriptExecutionContext&) { 188 188 if (m_client) -
trunk/Source/WebCore/Modules/websockets/ThreadableWebSocketChannelClientWrapper.h
r184709 r198869 80 80 void didConnect(); 81 81 void didReceiveMessage(const String& message); 82 void didReceiveBinaryData(Vector< char>&&);82 void didReceiveBinaryData(Vector<uint8_t>&&); 83 83 void didUpdateBufferedAmount(unsigned long bufferedAmount); 84 84 void didStartClosingHandshake(); -
trunk/Source/WebCore/Modules/websockets/WebSocket.cpp
r198482 r198869 562 562 } 563 563 564 void WebSocket::didReceiveBinaryData(Vector< char>&& binaryData)564 void WebSocket::didReceiveBinaryData(Vector<uint8_t>&& binaryData) 565 565 { 566 566 LOG(Network, "WebSocket %p didReceiveBinaryData() %lu byte binary message", this, static_cast<unsigned long>(binaryData.size())); -
trunk/Source/WebCore/Modules/websockets/WebSocket.h
r198482 r198869 101 101 void didConnect() override; 102 102 void didReceiveMessage(const String& message) override; 103 void didReceiveBinaryData(Vector< char>&&) override;103 void didReceiveBinaryData(Vector<uint8_t>&&) override; 104 104 void didReceiveMessageError() override; 105 105 void didUpdateBufferedAmount(unsigned long bufferedAmount) override; -
trunk/Source/WebCore/Modules/websockets/WebSocketChannel.cpp
r194496 r198869 587 587 // make sure that the member variables are in a consistent state before 588 588 // the handler is invoked. 589 Vector< char> continuousFrameData = WTFMove(m_continuousFrameData);589 Vector<uint8_t> continuousFrameData = WTFMove(m_continuousFrameData); 590 590 m_hasContinuousFrame = false; 591 591 if (m_continuousFrameOpCode == WebSocketFrame::OpCodeText) { … … 627 627 case WebSocketFrame::OpCodeBinary: 628 628 if (frame.final) { 629 Vector< char> binaryData(frame.payloadLength);629 Vector<uint8_t> binaryData(frame.payloadLength); 630 630 memcpy(binaryData.data(), frame.payload, frame.payloadLength); 631 631 skipBuffer(frameEnd - m_buffer.data()); -
trunk/Source/WebCore/Modules/websockets/WebSocketChannel.h
r197563 r198869 205 205 bool m_hasContinuousFrame; 206 206 WebSocketFrame::OpCode m_continuousFrameOpCode; 207 Vector< char> m_continuousFrameData;207 Vector<uint8_t> m_continuousFrameData; 208 208 unsigned short m_closeEventCode; 209 209 String m_closeEventReason; -
trunk/Source/WebCore/Modules/websockets/WebSocketChannelClient.h
r183234 r198869 44 44 virtual void didConnect() { } 45 45 virtual void didReceiveMessage(const String&) { } 46 virtual void didReceiveBinaryData(Vector< char>&&) { }46 virtual void didReceiveBinaryData(Vector<uint8_t>&&) { } 47 47 virtual void didReceiveMessageError() { } 48 48 virtual void didUpdateBufferedAmount(unsigned long /* bufferedAmount */) { } -
trunk/Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.cpp
r194496 r198869 289 289 } 290 290 291 void WorkerThreadableWebSocketChannel::Peer::didReceiveBinaryData(Vector< char>&& binaryData)292 { 293 ASSERT(isMainThread()); 294 295 RefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper = m_workerClientWrapper; 296 Vector< char>* capturedData = new Vector<char>(WTFMove(binaryData));291 void WorkerThreadableWebSocketChannel::Peer::didReceiveBinaryData(Vector<uint8_t>&& binaryData) 292 { 293 ASSERT(isMainThread()); 294 295 RefPtr<ThreadableWebSocketChannelClientWrapper> workerClientWrapper = m_workerClientWrapper; 296 Vector<uint8_t>* capturedData = new Vector<uint8_t>(WTFMove(binaryData)); 297 297 m_loaderProxy.postTaskForModeToWorkerGlobalScope([workerClientWrapper, capturedData] (ScriptExecutionContext& context) { 298 298 ASSERT_UNUSED(context, context.isWorkerGlobalScope()); -
trunk/Source/WebCore/Modules/websockets/WorkerThreadableWebSocketChannel.h
r197563 r198869 101 101 void didConnect() override; 102 102 void didReceiveMessage(const String& message) override; 103 void didReceiveBinaryData(Vector< char>&&) override;103 void didReceiveBinaryData(Vector<uint8_t>&&) override; 104 104 void didUpdateBufferedAmount(unsigned long bufferedAmount) override; 105 105 void didStartClosingHandshake() override; -
trunk/Source/WebCore/fileapi/Blob.cpp
r197563 r198869 78 78 } 79 79 80 Blob::Blob(Vector< char> data, const String& contentType)80 Blob::Blob(Vector<uint8_t> data, const String& contentType) 81 81 : m_type(contentType) 82 82 , m_size(data.size()) -
trunk/Source/WebCore/fileapi/Blob.h
r197563 r198869 49 49 } 50 50 51 static Ref<Blob> create(Vector< char> data, const String& contentType)51 static Ref<Blob> create(Vector<uint8_t> data, const String& contentType) 52 52 { 53 53 return adoptRef(*new Blob(WTFMove(data), contentType)); … … 92 92 protected: 93 93 Blob(); 94 Blob(Vector< char>, const String& contentType);94 Blob(Vector<uint8_t>, const String& contentType); 95 95 Blob(Vector<BlobPart>, const String& contentType); 96 96 -
trunk/Source/WebCore/fileapi/WebKitBlobBuilder.h
r189650 r198869 56 56 private: 57 57 Vector<BlobPart> m_items; 58 Vector< char> m_appendableData;58 Vector<uint8_t> m_appendableData; 59 59 }; 60 60 -
trunk/Source/WebCore/platform/network/BlobData.cpp
r183234 r198869 40 40 namespace WebCore { 41 41 42 BlobData::BlobData(const String& contentType) 43 : m_contentType(contentType) 44 { 45 ASSERT(Blob::isNormalizedContentType(contentType)); 46 } 47 42 48 const long long BlobDataItem::toEndOfFile = -1; 43 49 … … 47 53 return m_length; 48 54 49 switch ( type) {50 case Data:55 switch (m_type) { 56 case Type::Data: 51 57 ASSERT_NOT_REACHED(); 52 58 return m_length; 53 case File:54 return file->size();59 case Type::File: 60 return m_file->size(); 55 61 } 56 62 … … 59 65 } 60 66 61 void BlobData:: setContentType(const String& contentType)67 void BlobData::appendData(const ThreadSafeDataBuffer& data) 62 68 { 63 ASSERT(Blob::isNormalizedContentType(contentType)); 64 m_contentType = contentType; 65 } 66 67 void BlobData::appendData(PassRefPtr<RawData> data) 68 { 69 size_t dataSize = data->length(); 69 size_t dataSize = data.data() ? data.data()->size() : 0; 70 70 appendData(data, 0, dataSize); 71 71 } 72 72 73 void BlobData::appendData( PassRefPtr<RawData>data, long long offset, long long length)73 void BlobData::appendData(const ThreadSafeDataBuffer& data, long long offset, long long length) 74 74 { 75 75 m_items.append(BlobDataItem(data, offset, length)); -
trunk/Source/WebCore/platform/network/BlobData.h
r194496 r198869 33 33 34 34 #include "BlobDataFileReference.h" 35 #include "ThreadSafeDataBuffer.h" 35 36 #include "URL.h" 36 37 #include <wtf/Forward.h> 37 38 #include <wtf/RefCounted.h> 39 #include <wtf/ThreadSafeRefCounted.h> 38 40 #include <wtf/text/WTFString.h> 39 41 40 42 namespace WebCore { 41 43 42 class RawData : public RefCounted<RawData>{44 class BlobDataItem { 43 45 public: 44 static Ref<RawData> create(Vector<char>&& data)45 {46 return adoptRef(*new RawData(WTFMove(data)));47 }48 49 static Ref<RawData> create(const char* data, size_t size)50 {51 Vector<char> dataVector(size);52 memcpy(dataVector.data(), data, size);53 return adoptRef(*new RawData(WTFMove(dataVector)));54 }55 56 const char* data() const { return m_data.data(); }57 size_t length() const { return m_data.size(); }58 59 private:60 RawData(Vector<char>&& data)61 : m_data(WTFMove(data))62 {63 }64 65 Vector<char> m_data;66 };67 68 struct BlobDataItem {69 46 WEBCORE_EXPORT static const long long toEndOfFile; 70 47 71 enum {48 enum class Type { 72 49 Data, 73 50 File 74 } type; 51 }; 52 53 Type type() const { return m_type; } 75 54 76 55 // For Data type. 77 RefPtr<RawData> data;56 const ThreadSafeDataBuffer& data() const { return m_data; } 78 57 79 58 // For File type. 80 RefPtr<BlobDataFileReference> file;59 BlobDataFileReference* file() const { return m_file.get(); } 81 60 82 61 long long offset() const { return m_offset; } … … 87 66 88 67 explicit BlobDataItem(PassRefPtr<BlobDataFileReference> file) 89 : type(File)90 , file(file)68 : m_type(Type::File) 69 , m_file(file) 91 70 , m_offset(0) 92 71 , m_length(toEndOfFile) … … 94 73 } 95 74 96 BlobDataItem( PassRefPtr<RawData>data, long long offset, long long length)97 : type(Data)98 , data(data)75 BlobDataItem(ThreadSafeDataBuffer data, long long offset, long long length) 76 : m_type(Type::Data) 77 , m_data(data) 99 78 , m_offset(offset) 100 79 , m_length(length) … … 103 82 104 83 BlobDataItem(BlobDataFileReference* file, long long offset, long long length) 105 : type(File)106 , file(file)84 : m_type(Type::File) 85 , m_file(file) 107 86 , m_offset(offset) 108 87 , m_length(length) 109 88 { 110 89 } 90 91 Type m_type; 92 ThreadSafeDataBuffer m_data; 93 RefPtr<BlobDataFileReference> m_file; 111 94 112 95 long long m_offset; … … 116 99 typedef Vector<BlobDataItem> BlobDataItemList; 117 100 118 class BlobData : public RefCounted<BlobData> {101 class BlobData : public ThreadSafeRefCounted<BlobData> { 119 102 public: 120 static Ref<BlobData> create( )103 static Ref<BlobData> create(const String& contentType) 121 104 { 122 return adoptRef(*new BlobData );105 return adoptRef(*new BlobData(contentType)); 123 106 } 124 107 125 108 const String& contentType() const { return m_contentType; } 126 WEBCORE_EXPORT void setContentType(const String&);127 109 128 110 const BlobDataItemList& items() const { return m_items; } 129 111 void swapItems(BlobDataItemList&); 130 112 131 void appendData( PassRefPtr<RawData>);113 void appendData(const ThreadSafeDataBuffer&); 132 114 void appendFile(PassRefPtr<BlobDataFileReference>); 133 115 134 116 private: 135 117 friend class BlobRegistryImpl; 118 BlobData(const String& contentType); 136 119 137 void appendData( PassRefPtr<RawData>, long long offset, long long length);120 void appendData(const ThreadSafeDataBuffer&, long long offset, long long length); 138 121 void appendFile(BlobDataFileReference*, long long offset, long long length); 139 122 -
trunk/Source/WebCore/platform/network/BlobPart.h
r194496 r198869 43 43 } 44 44 45 BlobPart(Vector< char> data)45 BlobPart(Vector<uint8_t> data) 46 46 : m_type(Data) 47 47 , m_data(WTFMove(data)) … … 57 57 Type type() const { return m_type; } 58 58 59 const Vector< char>& data() const59 const Vector<uint8_t>& data() const 60 60 { 61 61 ASSERT(m_type == Data); … … 63 63 } 64 64 65 Vector< char> moveData()65 Vector<uint8_t> moveData() 66 66 { 67 67 ASSERT(m_type == Data); … … 82 82 private: 83 83 Type m_type; 84 Vector< char> m_data;84 Vector<uint8_t> m_data; 85 85 URL m_url; 86 86 }; -
trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp
r196174 r198869 99 99 long long currentLength = iter->length() - offset; 100 100 long long newLength = currentLength > length ? length : currentLength; 101 if (iter->type == BlobDataItem::Data)102 blobData->appendData(iter->data , iter->offset() + offset, newLength);101 if (iter->type() == BlobDataItem::Type::Data) 102 blobData->appendData(iter->data(), iter->offset() + offset, newLength); 103 103 else { 104 ASSERT(iter->type == BlobDataItem::File);105 blobData->appendFile(iter->file .get(), iter->offset() + offset, newLength);104 ASSERT(iter->type() == BlobDataItem::Type::File); 105 blobData->appendFile(iter->file(), iter->offset() + offset, newLength); 106 106 } 107 107 length -= newLength; … … 116 116 registerBlobResourceHandleConstructor(); 117 117 118 RefPtr<BlobData> blobData = BlobData::create(); 119 blobData->setContentType(contentType); 118 RefPtr<BlobData> blobData = BlobData::create(contentType); 120 119 121 120 blobData->appendFile(file); … … 128 127 registerBlobResourceHandleConstructor(); 129 128 130 RefPtr<BlobData> blobData = BlobData::create(); 131 blobData->setContentType(contentType); 129 RefPtr<BlobData> blobData = BlobData::create(contentType); 132 130 133 131 // The blob data is stored in the "canonical" way. That is, it only contains a list of Data and File items. … … 140 138 switch (part.type()) { 141 139 case BlobPart::Data: { 142 RefPtr<RawData> rawData = RawData::create(part.moveData()); 143 blobData->appendData(rawData.release()); 140 auto movedData = part.moveData(); 141 auto data = ThreadSafeDataBuffer::adoptVector(movedData); 142 blobData->appendData(data); 144 143 break; 145 144 } … … 197 196 198 197 unsigned long long newLength = end - start; 199 RefPtr<BlobData> newData = BlobData::create(); 200 newData->setContentType(originalData->contentType()); 198 RefPtr<BlobData> newData = BlobData::create(originalData->contentType()); 201 199 202 200 appendStorageItems(newData.get(), originalData->items(), start, newLength); -
trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp
r198665 r198869 254 254 255 255 const BlobDataItem& item = m_blobData->items().at(m_sizeItemCount); 256 switch (item.type ) {257 case BlobDataItem:: Data:256 switch (item.type()) { 257 case BlobDataItem::Type::Data: 258 258 didGetSize(item.length()); 259 259 break; 260 case BlobDataItem:: File:260 case BlobDataItem::Type::File: 261 261 // Files know their sizes, but asking the stream to verify that the file wasn't modified. 262 262 if (m_async) 263 m_asyncStream->getSize(item.file ->path(), item.file->expectedModificationTime());263 m_asyncStream->getSize(item.file()->path(), item.file()->expectedModificationTime()); 264 264 else 265 didGetSize(m_stream->getSize(item.file ->path(), item.file->expectedModificationTime()));265 didGetSize(m_stream->getSize(item.file()->path(), item.file()->expectedModificationTime())); 266 266 break; 267 267 default: … … 352 352 const BlobDataItem& item = m_blobData->items().at(m_readItemCount); 353 353 int bytesRead = 0; 354 if (item.type == BlobDataItem::Data)354 if (item.type() == BlobDataItem::Type::Data) 355 355 bytesRead = readDataSync(item, buf + offset, remaining); 356 else if (item.type == BlobDataItem::File)356 else if (item.type() == BlobDataItem::Type::File) 357 357 bytesRead = readFileSync(item, buf + offset, remaining); 358 358 else … … 390 390 if (bytesToRead > m_totalRemainingSize) 391 391 bytesToRead = static_cast<int>(m_totalRemainingSize); 392 memcpy(buf, item.data ->data() + item.offset() + m_currentItemReadSize, bytesToRead);392 memcpy(buf, item.data().data() + item.offset() + m_currentItemReadSize, bytesToRead); 393 393 m_totalRemainingSize -= bytesToRead; 394 394 … … 412 412 if (bytesToRead > m_totalRemainingSize) 413 413 bytesToRead = m_totalRemainingSize; 414 bool success = m_stream->openForRead(item.file ->path(), item.offset() + m_currentItemReadSize, bytesToRead);414 bool success = m_stream->openForRead(item.file()->path(), item.offset() + m_currentItemReadSize, bytesToRead); 415 415 m_currentItemReadSize = 0; 416 416 if (!success) { … … 453 453 454 454 const BlobDataItem& item = m_blobData->items().at(m_readItemCount); 455 if (item.type == BlobDataItem::Data)455 if (item.type() == BlobDataItem::Type::Data) 456 456 readDataAsync(item); 457 else if (item.type == BlobDataItem::File)457 else if (item.type() == BlobDataItem::Type::File) 458 458 readFileAsync(item); 459 459 else … … 465 465 ASSERT(isMainThread()); 466 466 ASSERT(m_async); 467 ASSERT(item.data().data()); 468 467 469 Ref<BlobResourceHandle> protect(*this); 468 470 … … 470 472 if (bytesToRead > m_totalRemainingSize) 471 473 bytesToRead = m_totalRemainingSize; 472 consumeData( item.data->data() + item.offset() + m_currentItemReadSize, static_cast<int>(bytesToRead));474 consumeData(reinterpret_cast<const char*>(item.data().data()->data()) + item.offset() + m_currentItemReadSize, static_cast<int>(bytesToRead)); 473 475 m_currentItemReadSize = 0; 474 476 } … … 487 489 if (bytesToRead > m_totalRemainingSize) 488 490 bytesToRead = static_cast<int>(m_totalRemainingSize); 489 m_asyncStream->openForRead(item.file ->path(), item.offset() + m_currentItemReadSize, bytesToRead);491 m_asyncStream->openForRead(item.file()->path(), item.offset() + m_currentItemReadSize, bytesToRead); 490 492 m_fileOpened = true; 491 493 m_currentItemReadSize = 0; -
trunk/Source/WebCore/platform/network/BlobResourceHandle.h
r197563 r198869 45 45 class ResourceHandleClient; 46 46 class ResourceRequest; 47 structBlobDataItem;47 class BlobDataItem; 48 48 49 49 class BlobResourceHandle final : public FileStreamClient, public ResourceHandle { -
trunk/Source/WebCore/platform/network/FormData.cpp
r195450 r198869 294 294 for (; it != itend; ++it) { 295 295 const BlobDataItem& blobItem = *it; 296 if (blobItem.type == BlobDataItem::Data) 297 formData->appendData(blobItem.data->data() + static_cast<int>(blobItem.offset()), static_cast<int>(blobItem.length())); 298 else if (blobItem.type == BlobDataItem::File) 299 formData->appendFileRange(blobItem.file->path(), blobItem.offset(), blobItem.length(), blobItem.file->expectedModificationTime()); 296 if (blobItem.type() == BlobDataItem::Type::Data) { 297 ASSERT(blobItem.data().data()); 298 formData->appendData(blobItem.data().data()->data() + static_cast<int>(blobItem.offset()), static_cast<int>(blobItem.length())); 299 } else if (blobItem.type() == BlobDataItem::Type::File) 300 formData->appendFileRange(blobItem.file()->path(), blobItem.offset(), blobItem.length(), blobItem.file()->expectedModificationTime()); 300 301 else 301 302 ASSERT_NOT_REACHED(); -
trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
r197563 r198869 770 770 static bool blobIsOutOfDate(const BlobDataItem& blobItem) 771 771 { 772 ASSERT(blobItem.type == BlobDataItem:: File);773 if (!isValidFileTime(blobItem.file ->expectedModificationTime()))772 ASSERT(blobItem.type == BlobDataItem::Type::File); 773 if (!isValidFileTime(blobItem.file()->expectedModificationTime())) 774 774 return false; 775 775 776 776 time_t fileModificationTime; 777 if (!getFileModificationTime(blobItem.file ->path(), fileModificationTime))777 if (!getFileModificationTime(blobItem.file()->path(), fileModificationTime)) 778 778 return true; 779 779 780 return fileModificationTime != static_cast<time_t>(blobItem.file ->expectedModificationTime());780 return fileModificationTime != static_cast<time_t>(blobItem.file()->expectedModificationTime()); 781 781 } 782 782 783 783 static void addEncodedBlobItemToSoupMessageBody(SoupMessage* message, const BlobDataItem& blobItem, unsigned long& totalBodySize) 784 784 { 785 if (blobItem.type == BlobDataItem::Data) {785 if (blobItem.type() == BlobDataItem::Type::Data) { 786 786 totalBodySize += blobItem.length(); 787 soup_message_body_append(message->request_body, SOUP_MEMORY_TEMPORARY, blobItem.data ->data() + blobItem.offset(), blobItem.length());788 return; 789 } 790 791 ASSERT(blobItem.type == BlobDataItem:: File);787 soup_message_body_append(message->request_body, SOUP_MEMORY_TEMPORARY, blobItem.data().data()->data() + blobItem.offset(), blobItem.length()); 788 return; 789 } 790 791 ASSERT(blobItem.type == BlobDataItem::Type::File); 792 792 if (blobIsOutOfDate(blobItem)) 793 793 return; 794 794 795 addFileToSoupMessageBody(message, blobItem.file ->path(), blobItem.offset(), blobItem.length() == BlobDataItem::toEndOfFile ? 0 : blobItem.length(), totalBodySize);795 addFileToSoupMessageBody(message, blobItem.file()->path(), blobItem.offset(), blobItem.length() == BlobDataItem::toEndOfFile ? 0 : blobItem.length(), totalBodySize); 796 796 } 797 797 -
trunk/Source/WebCore/platform/text/LineEnding.cpp
r197591 r198869 154 154 namespace WebCore { 155 155 156 void normalizeToCROrLF(const CString& from, Vector<char>& result, bool toCR);157 158 156 // Normalize all line-endings to CR or LF. 159 void normalizeToCROrLF(const CString& from, Vector<char>& result, bool toCR)157 static void normalizeToCROrLF(const CString& from, Vector<uint8_t>& result, bool toCR) 160 158 { 161 159 // Compute the new length. … … 182 180 size_t oldResultSize = result.size(); 183 181 result.grow(oldResultSize + newLen); 184 char* q = result.data() + oldResultSize;182 uint8_t* q = result.data() + oldResultSize; 185 183 186 184 // If no need to fix the string, just copy the string over. … … 215 213 } 216 214 217 void normalizeLineEndingsToCR(const CString& from, Vector<char>& result) 218 { 219 normalizeToCROrLF(from, result, true); 220 } 221 222 void normalizeLineEndingsToLF(const CString& from, Vector<char>& result) 223 { 224 normalizeToCROrLF(from, result, false); 225 } 226 227 void normalizeLineEndingsToNative(const CString& from, Vector<char>& result) 215 void normalizeLineEndingsToNative(const CString& from, Vector<uint8_t>& result) 228 216 { 229 217 #if OS(WINDOWS) … … 231 219 internalNormalizeLineEndingsToCRLF(from, buffer); 232 220 #else 233 normalize LineEndingsToLF(from, result);221 normalizeToCROrLF(from, result, false); 234 222 #endif 235 223 } -
trunk/Source/WebCore/platform/text/LineEnding.h
r95901 r198869 41 41 CString normalizeLineEndingsToCRLF(const CString& from); 42 42 43 // Normalize all line-endings in the given string to CR and append the result to the given buffer.44 void normalizeLineEndingsToCR(const CString& from, Vector<char>& result);45 46 // Normalize all line-endings in the given string to LF and append the result to the given buffer.47 void normalizeLineEndingsToLF(const CString& from, Vector<char>& result);48 49 43 // Normalize all line-endings in the given string to the native line-endings and append the result to the given buffer. 50 44 // (Normalize to CRLF on Windows and normalize to LF on all other platforms.) 51 void normalizeLineEndingsToNative(const CString& from, Vector< char>& result);45 void normalizeLineEndingsToNative(const CString& from, Vector<uint8_t>& result); 52 46 53 47 } // namespace WebCore -
trunk/Source/WebCore/xml/XMLHttpRequest.cpp
r197706 r198869 239 239 if (m_binaryResponseBuilder) { 240 240 // FIXME: We just received the data from NetworkProcess, and are sending it back. This is inefficient. 241 Vector< char> data;241 Vector<uint8_t> data; 242 242 data.append(m_binaryResponseBuilder->data(), m_binaryResponseBuilder->size()); 243 243 String normalizedContentType = Blob::normalizedContentType(responseMIMEType()); // responseMIMEType defaults to text/xml which may be incorrect. -
trunk/Source/WebKit2/ChangeLog
r198865 r198869 1 2016-03-30 Brady Eidson <beidson@apple.com> 2 3 Make BlobData use ThreadSafeSharedBuffer instead of RawData. 4 https://bugs.webkit.org/show_bug.cgi?id=156041 5 6 Reviewed by Alex Christensen. 7 8 * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp: 9 (WebKit::NetworkBlobRegistry::filesInBlob): 10 * Shared/WebCoreArgumentCoders.cpp: 11 (IPC::ArgumentCoder<BlobPart>::decode): 12 1 13 2016-03-30 Daniel Bates <dabates@apple.com> 2 14 -
trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp
r196174 r198869 142 142 Vector<RefPtr<BlobDataFileReference>> result; 143 143 for (const BlobDataItem& item : blobData->items()) { 144 if (item.type == BlobDataItem::File)145 result.append(item.file );144 if (item.type() == BlobDataItem::Type::File) 145 result.append(item.file()); 146 146 } 147 147 -
trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
r197592 r198869 1862 1862 switch (type) { 1863 1863 case BlobPart::Data: { 1864 Vector< char> data;1864 Vector<uint8_t> data; 1865 1865 if (!decoder.decode(data)) 1866 1866 return false;
Note: See TracChangeset
for help on using the changeset viewer.