Title: [243325] trunk/Source/WebKit
Revision
243325
Author
[email protected]
Date
2019-03-21 14:03:43 -0700 (Thu, 21 Mar 2019)

Log Message

Stop using LegacySync messages in WebPasteboardProxy
https://bugs.webkit.org/show_bug.cgi?id=196060

Reviewed by Chris Dumez.

* UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::getPasteboardTypes):
(WebKit::WebPasteboardProxy::getPasteboardPathnamesForType):
(WebKit::WebPasteboardProxy::getPasteboardStringForType):
(WebKit::WebPasteboardProxy::getPasteboardStringsForType):
(WebKit::WebPasteboardProxy::getPasteboardBufferForType):
(WebKit::WebPasteboardProxy::pasteboardCopy):
(WebKit::WebPasteboardProxy::getPasteboardChangeCount):
(WebKit::WebPasteboardProxy::getPasteboardUniqueName):
(WebKit::WebPasteboardProxy::getPasteboardColor):
(WebKit::WebPasteboardProxy::getPasteboardURL):
(WebKit::WebPasteboardProxy::addPasteboardTypes):
(WebKit::WebPasteboardProxy::setPasteboardTypes):
(WebKit::WebPasteboardProxy::setPasteboardURL):
(WebKit::WebPasteboardProxy::setPasteboardColor):
(WebKit::WebPasteboardProxy::setPasteboardStringForType):
(WebKit::WebPasteboardProxy::setPasteboardBufferForType):
(WebKit::WebPasteboardProxy::getNumberOfFiles):
(WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
(WebKit::WebPasteboardProxy::writeCustomData):
(WebKit::WebPasteboardProxy::readStringFromPasteboard):
(WebKit::WebPasteboardProxy::readURLFromPasteboard):
(WebKit::WebPasteboardProxy::readBufferFromPasteboard):
(WebKit::WebPasteboardProxy::getPasteboardItemsCount):
(WebKit::WebPasteboardProxy::allPasteboardItemInfo):
(WebKit::WebPasteboardProxy::informationForItemAtIndex):
* UIProcess/WebPasteboardProxy.cpp:
(WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
(WebKit::WebPasteboardProxy::writeCustomData):
* UIProcess/WebPasteboardProxy.h:
* UIProcess/WebPasteboardProxy.messages.in:
* UIProcess/gtk/WebPasteboardProxyGtk.cpp:
(WebKit::WebPasteboardProxy::writeToClipboard):
(WebKit::WebPasteboardProxy::readFromClipboard):
* UIProcess/wpe/WebPasteboardProxyWPE.cpp:
(WebKit::WebPasteboardProxy::getPasteboardTypes):
(WebKit::WebPasteboardProxy::readStringFromPasteboard):
(WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
(WebKit::WebPasteboardProxy::writeStringToPasteboard):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (243324 => 243325)


--- trunk/Source/WebKit/ChangeLog	2019-03-21 20:51:56 UTC (rev 243324)
+++ trunk/Source/WebKit/ChangeLog	2019-03-21 21:03:43 UTC (rev 243325)
@@ -1,3 +1,50 @@
+2019-03-21  Alex Christensen  <[email protected]>
+
+        Stop using LegacySync messages in WebPasteboardProxy
+        https://bugs.webkit.org/show_bug.cgi?id=196060
+
+        Reviewed by Chris Dumez.
+
+        * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
+        (WebKit::WebPasteboardProxy::getPasteboardTypes):
+        (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType):
+        (WebKit::WebPasteboardProxy::getPasteboardStringForType):
+        (WebKit::WebPasteboardProxy::getPasteboardStringsForType):
+        (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
+        (WebKit::WebPasteboardProxy::pasteboardCopy):
+        (WebKit::WebPasteboardProxy::getPasteboardChangeCount):
+        (WebKit::WebPasteboardProxy::getPasteboardUniqueName):
+        (WebKit::WebPasteboardProxy::getPasteboardColor):
+        (WebKit::WebPasteboardProxy::getPasteboardURL):
+        (WebKit::WebPasteboardProxy::addPasteboardTypes):
+        (WebKit::WebPasteboardProxy::setPasteboardTypes):
+        (WebKit::WebPasteboardProxy::setPasteboardURL):
+        (WebKit::WebPasteboardProxy::setPasteboardColor):
+        (WebKit::WebPasteboardProxy::setPasteboardStringForType):
+        (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
+        (WebKit::WebPasteboardProxy::getNumberOfFiles):
+        (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
+        (WebKit::WebPasteboardProxy::writeCustomData):
+        (WebKit::WebPasteboardProxy::readStringFromPasteboard):
+        (WebKit::WebPasteboardProxy::readURLFromPasteboard):
+        (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
+        (WebKit::WebPasteboardProxy::getPasteboardItemsCount):
+        (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
+        (WebKit::WebPasteboardProxy::informationForItemAtIndex):
+        * UIProcess/WebPasteboardProxy.cpp:
+        (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
+        (WebKit::WebPasteboardProxy::writeCustomData):
+        * UIProcess/WebPasteboardProxy.h:
+        * UIProcess/WebPasteboardProxy.messages.in:
+        * UIProcess/gtk/WebPasteboardProxyGtk.cpp:
+        (WebKit::WebPasteboardProxy::writeToClipboard):
+        (WebKit::WebPasteboardProxy::readFromClipboard):
+        * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
+        (WebKit::WebPasteboardProxy::getPasteboardTypes):
+        (WebKit::WebPasteboardProxy::readStringFromPasteboard):
+        (WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
+        (WebKit::WebPasteboardProxy::writeStringToPasteboard):
+
 2019-03-21  Andy Estes  <[email protected]>
 
         [iOS] Apple Pay should be available in documents with no user agent scripts

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm (243324 => 243325)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm	2019-03-21 20:51:56 UTC (rev 243324)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm	2019-03-21 21:03:43 UTC (rev 243325)
@@ -38,14 +38,18 @@
 namespace WebKit {
 using namespace WebCore;
 
-void WebPasteboardProxy::getPasteboardTypes(const String& pasteboardName, Vector<String>& pasteboardTypes)
+void WebPasteboardProxy::getPasteboardTypes(const String& pasteboardName, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
 {
+    Vector<String> pasteboardTypes;
     PlatformPasteboard(pasteboardName).getTypes(pasteboardTypes);
+    completionHandler(WTFMove(pasteboardTypes));
 }
 
 void WebPasteboardProxy::getPasteboardPathnamesForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType,
-    Vector<String>& pathnames, SandboxExtension::HandleArray& sandboxExtensions)
+    CompletionHandler<void(Vector<String>&& pathnames, SandboxExtension::HandleArray&& sandboxExtensions)>&& completionHandler)
 {
+    Vector<String> pathnames;
+    SandboxExtension::HandleArray sandboxExtensions;
     for (auto* webProcessProxy : m_webProcessProxyList) {
         if (!webProcessProxy->hasConnection(connection))
             continue;
@@ -63,119 +67,117 @@
         }
 #endif
     }
+    completionHandler(WTFMove(pathnames), WTFMove(sandboxExtensions));
 }
 
-void WebPasteboardProxy::getPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, String& string)
+void WebPasteboardProxy::getPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(String&&)>&& completionHandler)
 {
-    string = PlatformPasteboard(pasteboardName).stringForType(pasteboardType);
+    completionHandler(PlatformPasteboard(pasteboardName).stringForType(pasteboardType));
 }
 
-void WebPasteboardProxy::getPasteboardStringsForType(const String& pasteboardName, const String& pasteboardType, Vector<String>& strings)
+void WebPasteboardProxy::getPasteboardStringsForType(const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
 {
-    strings = PlatformPasteboard(pasteboardName).allStringsForType(pasteboardType);
+    completionHandler(PlatformPasteboard(pasteboardName).allStringsForType(pasteboardType));
 }
 
-void WebPasteboardProxy::getPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, SharedMemory::Handle& handle, uint64_t& size)
+void WebPasteboardProxy::getPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&& completionHandler)
 {
     RefPtr<SharedBuffer> buffer = PlatformPasteboard(pasteboardName).bufferForType(pasteboardType);
     if (!buffer)
-        return;
-    size = buffer->size();
+        return completionHandler({ }, 0);
+    uint64_t size = buffer->size();
     if (!size)
-        return;
+        return completionHandler({ }, 0);
     RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::allocate(size);
     if (!sharedMemoryBuffer)
-        return;
+        return completionHandler({ }, 0);
     memcpy(sharedMemoryBuffer->data(), buffer->data(), size);
+    SharedMemory::Handle handle;
     sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly);
+    completionHandler(WTFMove(handle), size);
 }
 
-void WebPasteboardProxy::pasteboardCopy(const String& fromPasteboard, const String& toPasteboard, uint64_t& newChangeCount)
+void WebPasteboardProxy::pasteboardCopy(const String& fromPasteboard, const String& toPasteboard, CompletionHandler<void(uint64_t)>&& completionHandler)
 {
-    newChangeCount = PlatformPasteboard(toPasteboard).copy(fromPasteboard);
+    completionHandler(PlatformPasteboard(toPasteboard).copy(fromPasteboard));
 }
 
-void WebPasteboardProxy::getPasteboardChangeCount(const String& pasteboardName, uint64_t& changeCount)
+void WebPasteboardProxy::getPasteboardChangeCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
 {
-    changeCount = PlatformPasteboard(pasteboardName).changeCount();
+    completionHandler(PlatformPasteboard(pasteboardName).changeCount());
 }
 
-void WebPasteboardProxy::getPasteboardUniqueName(String& pasteboardName)
+void WebPasteboardProxy::getPasteboardUniqueName(CompletionHandler<void(String&&)>&& completionHandler)
 {
-    pasteboardName = PlatformPasteboard::uniqueName();
+    completionHandler(PlatformPasteboard::uniqueName());
 }
 
-void WebPasteboardProxy::getPasteboardColor(const String& pasteboardName, WebCore::Color& color)
+void WebPasteboardProxy::getPasteboardColor(const String& pasteboardName, CompletionHandler<void(WebCore::Color&&)>&& completionHandler)
 {
-    color = PlatformPasteboard(pasteboardName).color();    
+    completionHandler(PlatformPasteboard(pasteboardName).color());
 }
 
-void WebPasteboardProxy::getPasteboardURL(const String& pasteboardName, WTF::String& urlString)
+void WebPasteboardProxy::getPasteboardURL(const String& pasteboardName, CompletionHandler<void(const String&)>&& completionHandler)
 {
-    urlString = PlatformPasteboard(pasteboardName).url().string();
+    completionHandler(PlatformPasteboard(pasteboardName).url().string());
 }
 
-void WebPasteboardProxy::addPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, uint64_t& newChangeCount)
+void WebPasteboardProxy::addPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(uint64_t)>&& completionHandler)
 {
-    newChangeCount = PlatformPasteboard(pasteboardName).addTypes(pasteboardTypes);
+    completionHandler(PlatformPasteboard(pasteboardName).addTypes(pasteboardTypes));
 }
 
-void WebPasteboardProxy::setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, uint64_t& newChangeCount)
+void WebPasteboardProxy::setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(uint64_t)>&& completionHandler)
 {
-    newChangeCount = PlatformPasteboard(pasteboardName).setTypes(pasteboardTypes);
+    completionHandler(PlatformPasteboard(pasteboardName).setTypes(pasteboardTypes));
 }
 
-void WebPasteboardProxy::setPasteboardURL(IPC::Connection& connection, const PasteboardURL& pasteboardURL, const String& pasteboardName, uint64_t& newChangeCount)
+void WebPasteboardProxy::setPasteboardURL(IPC::Connection& connection, const PasteboardURL& pasteboardURL, const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
 {
     for (auto* webProcessProxy : m_webProcessProxyList) {
         if (!webProcessProxy->hasConnection(connection))
             continue;
 
-        if (!webProcessProxy->checkURLReceivedFromWebProcess(pasteboardURL.url.string())) {
-            newChangeCount = 0;
-            return;
-        }
+        if (!webProcessProxy->checkURLReceivedFromWebProcess(pasteboardURL.url.string()))
+            return completionHandler(0);
 
-        newChangeCount = PlatformPasteboard(pasteboardName).setURL(pasteboardURL);
-        return;
+        return completionHandler(PlatformPasteboard(pasteboardName).setURL(pasteboardURL));
     }
-    newChangeCount = 0;
+    completionHandler(0);
 }
 
-void WebPasteboardProxy::setPasteboardColor(const String& pasteboardName, const WebCore::Color& color, uint64_t& newChangeCount)
+void WebPasteboardProxy::setPasteboardColor(const String& pasteboardName, const WebCore::Color& color, CompletionHandler<void(uint64_t)>&& completionHandler)
 {
-    newChangeCount = PlatformPasteboard(pasteboardName).setColor(color);
+    completionHandler(PlatformPasteboard(pasteboardName).setColor(color));
 }
 
-void WebPasteboardProxy::setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String& string, uint64_t& newChangeCount)
+void WebPasteboardProxy::setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String& string, CompletionHandler<void(uint64_t)>&& completionHandler)
 {
-    newChangeCount = PlatformPasteboard(pasteboardName).setStringForType(string, pasteboardType);
+    completionHandler(PlatformPasteboard(pasteboardName).setStringForType(string, pasteboardType));
 }
 
-void WebPasteboardProxy::setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle& handle, uint64_t size, uint64_t& newChangeCount)
+void WebPasteboardProxy::setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle& handle, uint64_t size, CompletionHandler<void(uint64_t)>&& completionHandler)
 {
-    if (handle.isNull()) {
-        newChangeCount = PlatformPasteboard(pasteboardName).setBufferForType(0, pasteboardType);
-        return;
-    }
+    if (handle.isNull())
+        return completionHandler(PlatformPasteboard(pasteboardName).setBufferForType(0, pasteboardType));
     RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly);
     auto buffer = SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), size);
-    newChangeCount = PlatformPasteboard(pasteboardName).setBufferForType(buffer.ptr(), pasteboardType);
+    completionHandler(PlatformPasteboard(pasteboardName).setBufferForType(buffer.ptr(), pasteboardType));
 }
 
-void WebPasteboardProxy::getNumberOfFiles(const String& pasteboardName, uint64_t& numberOfFiles)
+void WebPasteboardProxy::getNumberOfFiles(const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
 {
-    numberOfFiles = PlatformPasteboard(pasteboardName).numberOfFiles();
+    completionHandler(PlatformPasteboard(pasteboardName).numberOfFiles());
 }
 
-void WebPasteboardProxy::typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin, Vector<String>& types)
+void WebPasteboardProxy::typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
 {
-    types = PlatformPasteboard(pasteboardName).typesSafeForDOMToReadAndWrite(origin);
+    completionHandler(PlatformPasteboard(pasteboardName).typesSafeForDOMToReadAndWrite(origin));
 }
 
-void WebPasteboardProxy::writeCustomData(const WebCore::PasteboardCustomData& data, const String& pasteboardName, uint64_t& newChangeCount)
+void WebPasteboardProxy::writeCustomData(const WebCore::PasteboardCustomData& data, const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
 {
-    newChangeCount = PlatformPasteboard(pasteboardName).write(data);
+    completionHandler(PlatformPasteboard(pasteboardName).write(data));
 }
 
 #if PLATFORM(IOS_FAMILY)
@@ -200,44 +202,48 @@
     PlatformPasteboard(pasteboardName).write(pasteboardType, text);
 }
 
-void WebPasteboardProxy::readStringFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, WTF::String& value)
+void WebPasteboardProxy::readStringFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(String&&)>&& completionHandler)
 {
-    value = PlatformPasteboard(pasteboardName).readString(index, pasteboardType);
+    completionHandler(PlatformPasteboard(pasteboardName).readString(index, pasteboardType));
 }
 
-void WebPasteboardProxy::readURLFromPasteboard(uint64_t index, const String& pasteboardName, String& url, String& title)
+void WebPasteboardProxy::readURLFromPasteboard(uint64_t index, const String& pasteboardName, CompletionHandler<void(String&& url, String&& title)>&& completionHandler)
 {
-    url = "" title);
+    String title;
+    String url = "" title);
+    completionHandler(WTFMove(url), WTFMove(title));
 }
 
-void WebPasteboardProxy::readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, SharedMemory::Handle& handle, uint64_t& size)
+void WebPasteboardProxy::readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(SharedMemory::Handle&&, uint64_t size)>&& completionHandler)
 {
     RefPtr<SharedBuffer> buffer = PlatformPasteboard(pasteboardName).readBuffer(index, pasteboardType);
     if (!buffer)
-        return;
-    size = buffer->size();
+        return completionHandler({ }, 0);
+    uint64_t size = buffer->size();
     if (!size)
-        return;
+        return completionHandler({ }, 0);
     RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::allocate(size);
     if (!sharedMemoryBuffer)
-        return;
+        return completionHandler({ }, 0);
     memcpy(sharedMemoryBuffer->data(), buffer->data(), size);
+    SharedMemory::Handle handle;
     sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly);
+    completionHandler(WTFMove(handle), size);
 }
 
-void WebPasteboardProxy::getPasteboardItemsCount(const String& pasteboardName, uint64_t& itemsCount)
+void WebPasteboardProxy::getPasteboardItemsCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
 {
-    itemsCount = PlatformPasteboard(pasteboardName).count();
+    completionHandler(PlatformPasteboard(pasteboardName).count());
 }
 
-void WebPasteboardProxy::allPasteboardItemInfo(const String& pasteboardName, Vector<PasteboardItemInfo>& allInfo)
+void WebPasteboardProxy::allPasteboardItemInfo(const String& pasteboardName, CompletionHandler<void(Vector<PasteboardItemInfo>&&)>&& completionHandler)
 {
-    allInfo = PlatformPasteboard(pasteboardName).allPasteboardItemInfo();
+    completionHandler(PlatformPasteboard(pasteboardName).allPasteboardItemInfo());
 }
 
-void WebPasteboardProxy::informationForItemAtIndex(int index, const String& pasteboardName, PasteboardItemInfo& info)
+void WebPasteboardProxy::informationForItemAtIndex(int index, const String& pasteboardName, CompletionHandler<void(PasteboardItemInfo&&)>&& completionHandler)
 {
-    info = PlatformPasteboard(pasteboardName).informationForItemAtIndex(index);
+    completionHandler(PlatformPasteboard(pasteboardName).informationForItemAtIndex(index));
 }
 
 void WebPasteboardProxy::updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName)

Modified: trunk/Source/WebKit/UIProcess/WebPasteboardProxy.cpp (243324 => 243325)


--- trunk/Source/WebKit/UIProcess/WebPasteboardProxy.cpp	2019-03-21 20:51:56 UTC (rev 243324)
+++ trunk/Source/WebKit/UIProcess/WebPasteboardProxy.cpp	2019-03-21 21:03:43 UTC (rev 243325)
@@ -63,14 +63,14 @@
 
 #if !PLATFORM(COCOA)
 
-void WebPasteboardProxy::typesSafeForDOMToReadAndWrite(const String&, const String&, Vector<String>& types)
+void WebPasteboardProxy::typesSafeForDOMToReadAndWrite(const String&, const String&, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
 {
-    types = { };
+    completionHandler({ });
 }
 
-void WebPasteboardProxy::writeCustomData(const WebCore::PasteboardCustomData&, const String&, uint64_t& newChangeCount)
+void WebPasteboardProxy::writeCustomData(const WebCore::PasteboardCustomData&, const String&, CompletionHandler<void(uint64_t)>&& completionHandler)
 {
-    newChangeCount = 0;
+    completionHandler(0);
 }
 
 #endif

Modified: trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h (243324 => 243325)


--- trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h	2019-03-21 20:51:56 UTC (rev 243324)
+++ trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h	2019-03-21 21:03:43 UTC (rev 243325)
@@ -73,40 +73,40 @@
     void writeWebContentToPasteboard(const WebCore::PasteboardWebContent&, const String& pasteboardName);
     void writeImageToPasteboard(const WebCore::PasteboardImage&, const String& pasteboardName);
     void writeStringToPasteboard(const String& pasteboardType, const String&, const String& pasteboardName);
-    void readStringFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, WTF::String&);
-    void readURLFromPasteboard(uint64_t index, const String& pasteboardName, String& url, String& title);
-    void readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, SharedMemory::Handle&, uint64_t& size);
-    void getPasteboardItemsCount(const String& pasteboardName, uint64_t& itemsCount);
-    void allPasteboardItemInfo(const String& pasteboardName, Vector<WebCore::PasteboardItemInfo>&);
-    void informationForItemAtIndex(int index, const String& pasteboardName, WebCore::PasteboardItemInfo& filename);
+    void readStringFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(String&&)>&&);
+    void readURLFromPasteboard(uint64_t index, const String& pasteboardName, CompletionHandler<void(String&& url, String&& title)>&&);
+    void readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(SharedMemory::Handle&&, uint64_t size)>&&);
+    void getPasteboardItemsCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
+    void allPasteboardItemInfo(const String& pasteboardName, CompletionHandler<void(Vector<WebCore::PasteboardItemInfo>&&)>&&);
+    void informationForItemAtIndex(int index, const String& pasteboardName, CompletionHandler<void(WebCore::PasteboardItemInfo&&)>&&);
     void updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName);
 #endif
 #if PLATFORM(COCOA)
-    void getNumberOfFiles(const String& pasteboardName, uint64_t& numberOfFiles);
-    void getPasteboardTypes(const String& pasteboardName, Vector<String>& pasteboardTypes);
-    void getPasteboardPathnamesForType(IPC::Connection&, const String& pasteboardName, const String& pasteboardType, Vector<String>& pathnames, SandboxExtension::HandleArray&);
-    void getPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, String&);
-    void getPasteboardStringsForType(const String& pasteboardName, const String& pasteboardType, Vector<String>&);
-    void getPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, SharedMemory::Handle&, uint64_t& size);
-    void pasteboardCopy(const String& fromPasteboard, const String& toPasteboard, uint64_t& newChangeCount);
-    void getPasteboardChangeCount(const String& pasteboardName, uint64_t& changeCount);
-    void getPasteboardUniqueName(String& pasteboardName);
-    void getPasteboardColor(const String& pasteboardName, WebCore::Color&);
-    void getPasteboardURL(const String& pasteboardName, WTF::String&);
-    void addPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, uint64_t& newChangeCount);
-    void setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, uint64_t& newChangeCount);
-    void setPasteboardURL(IPC::Connection&, const WebCore::PasteboardURL&, const String& pasteboardName, uint64_t& newChangeCount);
-    void setPasteboardColor(const String&, const WebCore::Color&, uint64_t&);
-    void setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String&, uint64_t& newChangeCount);
-    void setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle&, uint64_t size, uint64_t& newChangeCount);
+    void getNumberOfFiles(const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
+    void getPasteboardTypes(const String& pasteboardName, CompletionHandler<void(Vector<String>&&)>&&);
+    void getPasteboardPathnamesForType(IPC::Connection&, const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(Vector<String>&& pathnames, SandboxExtension::HandleArray&&)>&&);
+    void getPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(String&&)>&&);
+    void getPasteboardStringsForType(const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(Vector<String>&&)>&&);
+    void getPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&&);
+    void pasteboardCopy(const String& fromPasteboard, const String& toPasteboard, CompletionHandler<void(uint64_t)>&&);
+    void getPasteboardChangeCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
+    void getPasteboardUniqueName(CompletionHandler<void(String&&)>&&);
+    void getPasteboardColor(const String& pasteboardName, CompletionHandler<void(WebCore::Color&&)>&&);
+    void getPasteboardURL(const String& pasteboardName, CompletionHandler<void(const String&)>&&);
+    void addPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(uint64_t)>&&);
+    void setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(uint64_t)>&&);
+    void setPasteboardURL(IPC::Connection&, const WebCore::PasteboardURL&, const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
+    void setPasteboardColor(const String&, const WebCore::Color&, CompletionHandler<void(uint64_t)>&&);
+    void setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String&, CompletionHandler<void(uint64_t)>&&);
+    void setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle&, uint64_t size, CompletionHandler<void(uint64_t)>&&);
 #endif
 
-    void writeCustomData(const WebCore::PasteboardCustomData&, const String& pasteboardName, uint64_t& newChangeCount);
-    void typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin, Vector<String>& types);
+    void writeCustomData(const WebCore::PasteboardCustomData&, const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
+    void typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin, CompletionHandler<void(Vector<String>&&)>&&);
 
 #if PLATFORM(GTK)
     void writeToClipboard(const String& pasteboardName, const WebSelectionData&);
-    void readFromClipboard(const String& pasteboardName, WebSelectionData&);
+    void readFromClipboard(const String& pasteboardName, CompletionHandler<void(WebSelectionData&&)>&&);
 
     WebFrameProxy* m_primarySelectionOwner { nullptr };
     WebFrameProxy* m_frameWritingToClipboard { nullptr };
@@ -113,8 +113,8 @@
 #endif // PLATFORM(GTK)
 
 #if USE(LIBWPE)
-    void getPasteboardTypes(Vector<String>& pasteboardTypes);
-    void readStringFromPasteboard(uint64_t index, const String& pasteboardType, WTF::String&);
+    void getPasteboardTypes(CompletionHandler<void(Vector<String>&&)>&&);
+    void readStringFromPasteboard(uint64_t index, const String& pasteboardType, CompletionHandler<void(String&&)>&&);
     void writeWebContentToPasteboard(const WebCore::PasteboardWebContent&);
     void writeStringToPasteboard(const String& pasteboardType, const String&);
 #endif

Modified: trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in (243324 => 243325)


--- trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in	2019-03-21 20:51:56 UTC (rev 243324)
+++ trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in	2019-03-21 21:03:43 UTC (rev 243325)
@@ -26,48 +26,48 @@
     WriteWebContentToPasteboard(struct WebCore::PasteboardWebContent content, String pasteboardName)
     WriteImageToPasteboard(struct WebCore::PasteboardImage pasteboardImage, String pasteboardName)
     WriteStringToPasteboard(String pasteboardType, String text, String pasteboardName)
-    ReadStringFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (String string) LegacySync
-    ReadURLFromPasteboard(uint64_t index, String pasteboardName) -> (String url, String title) LegacySync
-    ReadBufferFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (WebKit::SharedMemory::Handle handle, uint64_t size) LegacySync
-    GetPasteboardItemsCount(String pasteboardName) -> (uint64_t itemsCount) LegacySync
-    AllPasteboardItemInfo(String pasteboardName) -> (Vector<WebCore::PasteboardItemInfo> allInfo) LegacySync
-    InformationForItemAtIndex(uint64_t index, String pasteboardName) -> (struct WebCore::PasteboardItemInfo info) LegacySync
+    ReadStringFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (String string) Delayed
+    ReadURLFromPasteboard(uint64_t index, String pasteboardName) -> (String url, String title) Delayed
+    ReadBufferFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (WebKit::SharedMemory::Handle handle, uint64_t size) Delayed
+    GetPasteboardItemsCount(String pasteboardName) -> (uint64_t itemsCount) Delayed
+    AllPasteboardItemInfo(String pasteboardName) -> (Vector<WebCore::PasteboardItemInfo> allInfo) Delayed
+    InformationForItemAtIndex(uint64_t index, String pasteboardName) -> (struct WebCore::PasteboardItemInfo info) Delayed
     UpdateSupportedTypeIdentifiers(Vector<String> identifiers, String pasteboardName)
 #endif
 
-    WriteCustomData(struct WebCore::PasteboardCustomData data, String pasteboardName) -> (uint64_t changeCount) LegacySync
-    TypesSafeForDOMToReadAndWrite(String pasteboardName, String origin) -> (Vector<String> types) LegacySync
+    WriteCustomData(struct WebCore::PasteboardCustomData data, String pasteboardName) -> (uint64_t changeCount) Delayed
+    TypesSafeForDOMToReadAndWrite(String pasteboardName, String origin) -> (Vector<String> types) Delayed
 
 #if PLATFORM(COCOA)
     # Pasteboard messages.
-    GetNumberOfFiles(String pasteboardName) -> (uint64_t numberOfFiles) LegacySync
-    GetPasteboardTypes(String pasteboardName) -> (Vector<String> types) LegacySync
-    GetPasteboardPathnamesForType(String pasteboardName, String pasteboardType) -> (Vector<String> pathnames, WebKit::SandboxExtension::HandleArray sandboxExtensions) LegacySync WantsConnection
-    GetPasteboardStringForType(String pasteboardName, String pasteboardType) -> (String string) LegacySync
-    GetPasteboardStringsForType(String pasteboardName, String pasteboardType) -> (Vector<String> strings) LegacySync
-    GetPasteboardBufferForType(String pasteboardName, String pasteboardType) -> (WebKit::SharedMemory::Handle handle, uint64_t size) LegacySync
-    PasteboardCopy(String fromPasteboard, String toPasteboard) -> (uint64_t changeCount) LegacySync
-    GetPasteboardChangeCount(String pasteboardName) -> (uint64_t changeCount) LegacySync
-    GetPasteboardUniqueName() -> (String pasteboardName) LegacySync
-    GetPasteboardColor(String pasteboardName) -> (WebCore::Color color) LegacySync
-    GetPasteboardURL(String pasteboardName) -> (String urlString) LegacySync
-    AddPasteboardTypes(String pasteboardName, Vector<String> pasteboardTypes) -> (uint64_t changeCount) LegacySync
-    SetPasteboardTypes(String pasteboardName, Vector<String> pasteboardTypes) -> (uint64_t changeCount) LegacySync
-    SetPasteboardURL(struct WebCore::PasteboardURL pasteboardURL, String pasteboardName) -> (uint64_t changeCount) LegacySync WantsConnection
-    SetPasteboardColor(String pasteboardName, WebCore::Color color) -> (uint64_t changeCount) LegacySync
-    SetPasteboardStringForType(String pasteboardName, String pasteboardType, String string) -> (uint64_t changeCount) LegacySync
-    SetPasteboardBufferForType(String pasteboardName, String pasteboardType, WebKit::SharedMemory::Handle handle, uint64_t size) -> (uint64_t changeCount) LegacySync
+    GetNumberOfFiles(String pasteboardName) -> (uint64_t numberOfFiles) Delayed
+    GetPasteboardTypes(String pasteboardName) -> (Vector<String> types) Delayed
+    GetPasteboardPathnamesForType(String pasteboardName, String pasteboardType) -> (Vector<String> pathnames, WebKit::SandboxExtension::HandleArray sandboxExtensions) Delayed WantsConnection
+    GetPasteboardStringForType(String pasteboardName, String pasteboardType) -> (String string) Delayed
+    GetPasteboardStringsForType(String pasteboardName, String pasteboardType) -> (Vector<String> strings) Delayed
+    GetPasteboardBufferForType(String pasteboardName, String pasteboardType) -> (WebKit::SharedMemory::Handle handle, uint64_t size) Delayed
+    PasteboardCopy(String fromPasteboard, String toPasteboard) -> (uint64_t changeCount) Delayed
+    GetPasteboardChangeCount(String pasteboardName) -> (uint64_t changeCount) Delayed
+    GetPasteboardUniqueName() -> (String pasteboardName) Delayed
+    GetPasteboardColor(String pasteboardName) -> (WebCore::Color color) Delayed
+    GetPasteboardURL(String pasteboardName) -> (String urlString) Delayed
+    AddPasteboardTypes(String pasteboardName, Vector<String> pasteboardTypes) -> (uint64_t changeCount) Delayed
+    SetPasteboardTypes(String pasteboardName, Vector<String> pasteboardTypes) -> (uint64_t changeCount) Delayed
+    SetPasteboardURL(struct WebCore::PasteboardURL pasteboardURL, String pasteboardName) -> (uint64_t changeCount) Delayed WantsConnection
+    SetPasteboardColor(String pasteboardName, WebCore::Color color) -> (uint64_t changeCount) Delayed
+    SetPasteboardStringForType(String pasteboardName, String pasteboardType, String string) -> (uint64_t changeCount) Delayed
+    SetPasteboardBufferForType(String pasteboardName, String pasteboardType, WebKit::SharedMemory::Handle handle, uint64_t size) -> (uint64_t changeCount) Delayed
 #endif
 
 #if PLATFORM(GTK)
-    WriteToClipboard(String pasteboardName, struct WebKit::WebSelectionData pasteboardContent) LegacySync
-    ReadFromClipboard(String pasteboardName) -> (struct WebKit::WebSelectionData pasteboardContent) LegacySync
+    WriteToClipboard(String pasteboardName, struct WebKit::WebSelectionData pasteboardContent)
+    ReadFromClipboard(String pasteboardName) -> (struct WebKit::WebSelectionData pasteboardContent) Delayed
 #endif
 
 #if USE(LIBWPE)
-    GetPasteboardTypes() -> (Vector<String> types) LegacySync
-    ReadStringFromPasteboard(uint64_t index, String pasteboardType) -> (String string) LegacySync
-    WriteWebContentToPasteboard(struct WebCore::PasteboardWebContent content) LegacySync
-    WriteStringToPasteboard(String pasteboardType, String text) LegacySync
+    GetPasteboardTypes() -> (Vector<String> types) Delayed
+    ReadStringFromPasteboard(uint64_t index, String pasteboardType) -> (String string) Delayed
+    WriteWebContentToPasteboard(struct WebCore::PasteboardWebContent content)
+    WriteStringToPasteboard(String pasteboardType, String text)
 #endif
 }

Modified: trunk/Source/WebKit/UIProcess/gtk/WebPasteboardProxyGtk.cpp (243324 => 243325)


--- trunk/Source/WebKit/UIProcess/gtk/WebPasteboardProxyGtk.cpp	2019-03-21 20:51:56 UTC (rev 243324)
+++ trunk/Source/WebKit/UIProcess/gtk/WebPasteboardProxyGtk.cpp	2019-03-21 21:03:43 UTC (rev 243325)
@@ -44,9 +44,9 @@
     });
 }
 
-void WebPasteboardProxy::readFromClipboard(const String& pasteboardName, WebSelectionData& selection)
+void WebPasteboardProxy::readFromClipboard(const String& pasteboardName, CompletionHandler<void(WebSelectionData&&)>&& completionHandler)
 {
-    selection = WebSelectionData(PlatformPasteboard(pasteboardName).readFromClipboard());
+    completionHandler(WebSelectionData(PlatformPasteboard(pasteboardName).readFromClipboard()));
 }
 
 void WebPasteboardProxy::setPrimarySelectionOwner(WebFrameProxy* frame)

Modified: trunk/Source/WebKit/UIProcess/wpe/WebPasteboardProxyWPE.cpp (243324 => 243325)


--- trunk/Source/WebKit/UIProcess/wpe/WebPasteboardProxyWPE.cpp	2019-03-21 20:51:56 UTC (rev 243324)
+++ trunk/Source/WebKit/UIProcess/wpe/WebPasteboardProxyWPE.cpp	2019-03-21 21:03:43 UTC (rev 243325)
@@ -32,14 +32,16 @@
 namespace WebKit {
 using namespace WebCore;
 
-void WebPasteboardProxy::getPasteboardTypes(Vector<String>& pasteboardTypes)
+void WebPasteboardProxy::getPasteboardTypes(CompletionHandler<void(Vector<String>&&)>&& completionHandler)
 {
+    Vector<String> pasteboardTypes;
     PlatformPasteboard().getTypes(pasteboardTypes);
+    completionHandler(WTFMove(pasteboardTypes));
 }
 
-void WebPasteboardProxy::readStringFromPasteboard(uint64_t index, const String& pasteboardType, WTF::String& value)
+void WebPasteboardProxy::readStringFromPasteboard(uint64_t index, const String& pasteboardType, CompletionHandler<void(String&&)>&& completionHandler)
 {
-    value = PlatformPasteboard().readString(index, pasteboardType);
+    completionHandler(PlatformPasteboard().readString(index, pasteboardType));
 }
 
 void WebPasteboardProxy::writeWebContentToPasteboard(const WebCore::PasteboardWebContent& content)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to