Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(892)

Unified Diff: third_party/WebKit/Source/core/clipboard/DataObjectItem.cpp

Issue 1876653003: Register clipboard image blob in the browser process to copy data less. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/test/mock_webclipboard_impl.cc ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/clipboard/DataObjectItem.cpp
diff --git a/third_party/WebKit/Source/core/clipboard/DataObjectItem.cpp b/third_party/WebKit/Source/core/clipboard/DataObjectItem.cpp
index 84fcd5638fec0a1e3727bca7d4b7b5280ae2b1b3..f7f309810c3aaf1a3ef65ae88402b444975e8ab3 100644
--- a/third_party/WebKit/Source/core/clipboard/DataObjectItem.cpp
+++ b/third_party/WebKit/Source/core/clipboard/DataObjectItem.cpp
@@ -116,20 +116,10 @@ Blob* DataObjectItem::getAsFile() const
ASSERT(m_source == PasteboardSource);
if (type() == mimeTypeImagePng) {
- // FIXME: This is pretty inefficient. We copy the data from the browser
- // to the renderer. We then place it in a blob in WebKit, which
- // registers it and copies it *back* to the browser. When a consumer
- // wants to read the data, we then copy the data back into the renderer.
- // https://bugs.webkit.org/show_bug.cgi?id=58107 has been filed to track
- // improvements to this code (in particular, add a registerClipboardBlob
- // method to the blob registry; that way the data is only copied over
- // into the renderer when it's actually read, not when the blob is
- // initially constructed).
- RefPtr<SharedBuffer> data = static_cast<PassRefPtr<SharedBuffer>>(Platform::current()->clipboard()->readImage(WebClipboard::BufferStandard));
- OwnPtr<BlobData> blobData = BlobData::create();
- blobData->appendBytes(data->data(), data->size());
- blobData->setContentType(mimeTypeImagePng);
- return Blob::create(BlobDataHandle::create(blobData.release(), data->size()));
+ WebBlobInfo blobInfo = Platform::current()->clipboard()->readImage(WebClipboard::BufferStandard);
+ if (blobInfo.size() < 0)
+ return nullptr;
+ return Blob::create(BlobDataHandle::create(blobInfo.uuid(), blobInfo.type(), blobInfo.size()));
}
return nullptr;
« no previous file with comments | « content/test/mock_webclipboard_impl.cc ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698