Changeset 243325 in webkit


Ignore:
Timestamp:
Mar 21, 2019 2:03:43 PM (5 years ago)
Author:
achristensen@apple.com
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):

Location:
trunk/Source/WebKit
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r243324 r243325  
     12019-03-21  Alex Christensen  <achristensen@webkit.org>
     2
     3        Stop using LegacySync messages in WebPasteboardProxy
     4        https://bugs.webkit.org/show_bug.cgi?id=196060
     5
     6        Reviewed by Chris Dumez.
     7
     8        * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
     9        (WebKit::WebPasteboardProxy::getPasteboardTypes):
     10        (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType):
     11        (WebKit::WebPasteboardProxy::getPasteboardStringForType):
     12        (WebKit::WebPasteboardProxy::getPasteboardStringsForType):
     13        (WebKit::WebPasteboardProxy::getPasteboardBufferForType):
     14        (WebKit::WebPasteboardProxy::pasteboardCopy):
     15        (WebKit::WebPasteboardProxy::getPasteboardChangeCount):
     16        (WebKit::WebPasteboardProxy::getPasteboardUniqueName):
     17        (WebKit::WebPasteboardProxy::getPasteboardColor):
     18        (WebKit::WebPasteboardProxy::getPasteboardURL):
     19        (WebKit::WebPasteboardProxy::addPasteboardTypes):
     20        (WebKit::WebPasteboardProxy::setPasteboardTypes):
     21        (WebKit::WebPasteboardProxy::setPasteboardURL):
     22        (WebKit::WebPasteboardProxy::setPasteboardColor):
     23        (WebKit::WebPasteboardProxy::setPasteboardStringForType):
     24        (WebKit::WebPasteboardProxy::setPasteboardBufferForType):
     25        (WebKit::WebPasteboardProxy::getNumberOfFiles):
     26        (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
     27        (WebKit::WebPasteboardProxy::writeCustomData):
     28        (WebKit::WebPasteboardProxy::readStringFromPasteboard):
     29        (WebKit::WebPasteboardProxy::readURLFromPasteboard):
     30        (WebKit::WebPasteboardProxy::readBufferFromPasteboard):
     31        (WebKit::WebPasteboardProxy::getPasteboardItemsCount):
     32        (WebKit::WebPasteboardProxy::allPasteboardItemInfo):
     33        (WebKit::WebPasteboardProxy::informationForItemAtIndex):
     34        * UIProcess/WebPasteboardProxy.cpp:
     35        (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite):
     36        (WebKit::WebPasteboardProxy::writeCustomData):
     37        * UIProcess/WebPasteboardProxy.h:
     38        * UIProcess/WebPasteboardProxy.messages.in:
     39        * UIProcess/gtk/WebPasteboardProxyGtk.cpp:
     40        (WebKit::WebPasteboardProxy::writeToClipboard):
     41        (WebKit::WebPasteboardProxy::readFromClipboard):
     42        * UIProcess/wpe/WebPasteboardProxyWPE.cpp:
     43        (WebKit::WebPasteboardProxy::getPasteboardTypes):
     44        (WebKit::WebPasteboardProxy::readStringFromPasteboard):
     45        (WebKit::WebPasteboardProxy::writeWebContentToPasteboard):
     46        (WebKit::WebPasteboardProxy::writeStringToPasteboard):
     47
    1482019-03-21  Andy Estes  <aestes@apple.com>
    249
  • trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm

    r241749 r243325  
    3939using namespace WebCore;
    4040
    41 void WebPasteboardProxy::getPasteboardTypes(const String& pasteboardName, Vector<String>& pasteboardTypes)
    42 {
     41void WebPasteboardProxy::getPasteboardTypes(const String& pasteboardName, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
     42{
     43    Vector<String> pasteboardTypes;
    4344    PlatformPasteboard(pasteboardName).getTypes(pasteboardTypes);
     45    completionHandler(WTFMove(pasteboardTypes));
    4446}
    4547
    4648void WebPasteboardProxy::getPasteboardPathnamesForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType,
    47     Vector<String>& pathnames, SandboxExtension::HandleArray& sandboxExtensions)
    48 {
     49    CompletionHandler<void(Vector<String>&& pathnames, SandboxExtension::HandleArray&& sandboxExtensions)>&& completionHandler)
     50{
     51    Vector<String> pathnames;
     52    SandboxExtension::HandleArray sandboxExtensions;
    4953    for (auto* webProcessProxy : m_webProcessProxyList) {
    5054        if (!webProcessProxy->hasConnection(connection))
     
    6468#endif
    6569    }
    66 }
    67 
    68 void WebPasteboardProxy::getPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, String& string)
    69 {
    70     string = PlatformPasteboard(pasteboardName).stringForType(pasteboardType);
    71 }
    72 
    73 void WebPasteboardProxy::getPasteboardStringsForType(const String& pasteboardName, const String& pasteboardType, Vector<String>& strings)
    74 {
    75     strings = PlatformPasteboard(pasteboardName).allStringsForType(pasteboardType);
    76 }
    77 
    78 void WebPasteboardProxy::getPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, SharedMemory::Handle& handle, uint64_t& size)
     70    completionHandler(WTFMove(pathnames), WTFMove(sandboxExtensions));
     71}
     72
     73void WebPasteboardProxy::getPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(String&&)>&& completionHandler)
     74{
     75    completionHandler(PlatformPasteboard(pasteboardName).stringForType(pasteboardType));
     76}
     77
     78void WebPasteboardProxy::getPasteboardStringsForType(const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
     79{
     80    completionHandler(PlatformPasteboard(pasteboardName).allStringsForType(pasteboardType));
     81}
     82
     83void WebPasteboardProxy::getPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&& completionHandler)
    7984{
    8085    RefPtr<SharedBuffer> buffer = PlatformPasteboard(pasteboardName).bufferForType(pasteboardType);
    8186    if (!buffer)
    82         return;
    83     size = buffer->size();
     87        return completionHandler({ }, 0);
     88    uint64_t size = buffer->size();
    8489    if (!size)
    85         return;
     90        return completionHandler({ }, 0);
    8691    RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::allocate(size);
    8792    if (!sharedMemoryBuffer)
    88         return;
     93        return completionHandler({ }, 0);
    8994    memcpy(sharedMemoryBuffer->data(), buffer->data(), size);
     95    SharedMemory::Handle handle;
    9096    sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly);
    91 }
    92 
    93 void WebPasteboardProxy::pasteboardCopy(const String& fromPasteboard, const String& toPasteboard, uint64_t& newChangeCount)
    94 {
    95     newChangeCount = PlatformPasteboard(toPasteboard).copy(fromPasteboard);
    96 }
    97 
    98 void WebPasteboardProxy::getPasteboardChangeCount(const String& pasteboardName, uint64_t& changeCount)
    99 {
    100     changeCount = PlatformPasteboard(pasteboardName).changeCount();
    101 }
    102 
    103 void WebPasteboardProxy::getPasteboardUniqueName(String& pasteboardName)
    104 {
    105     pasteboardName = PlatformPasteboard::uniqueName();
    106 }
    107 
    108 void WebPasteboardProxy::getPasteboardColor(const String& pasteboardName, WebCore::Color& color)
    109 {
    110     color = PlatformPasteboard(pasteboardName).color();   
    111 }
    112 
    113 void WebPasteboardProxy::getPasteboardURL(const String& pasteboardName, WTF::String& urlString)
    114 {
    115     urlString = PlatformPasteboard(pasteboardName).url().string();
    116 }
    117 
    118 void WebPasteboardProxy::addPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, uint64_t& newChangeCount)
    119 {
    120     newChangeCount = PlatformPasteboard(pasteboardName).addTypes(pasteboardTypes);
    121 }
    122 
    123 void WebPasteboardProxy::setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, uint64_t& newChangeCount)
    124 {
    125     newChangeCount = PlatformPasteboard(pasteboardName).setTypes(pasteboardTypes);
    126 }
    127 
    128 void WebPasteboardProxy::setPasteboardURL(IPC::Connection& connection, const PasteboardURL& pasteboardURL, const String& pasteboardName, uint64_t& newChangeCount)
     97    completionHandler(WTFMove(handle), size);
     98}
     99
     100void WebPasteboardProxy::pasteboardCopy(const String& fromPasteboard, const String& toPasteboard, CompletionHandler<void(uint64_t)>&& completionHandler)
     101{
     102    completionHandler(PlatformPasteboard(toPasteboard).copy(fromPasteboard));
     103}
     104
     105void WebPasteboardProxy::getPasteboardChangeCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
     106{
     107    completionHandler(PlatformPasteboard(pasteboardName).changeCount());
     108}
     109
     110void WebPasteboardProxy::getPasteboardUniqueName(CompletionHandler<void(String&&)>&& completionHandler)
     111{
     112    completionHandler(PlatformPasteboard::uniqueName());
     113}
     114
     115void WebPasteboardProxy::getPasteboardColor(const String& pasteboardName, CompletionHandler<void(WebCore::Color&&)>&& completionHandler)
     116{
     117    completionHandler(PlatformPasteboard(pasteboardName).color());
     118}
     119
     120void WebPasteboardProxy::getPasteboardURL(const String& pasteboardName, CompletionHandler<void(const String&)>&& completionHandler)
     121{
     122    completionHandler(PlatformPasteboard(pasteboardName).url().string());
     123}
     124
     125void WebPasteboardProxy::addPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(uint64_t)>&& completionHandler)
     126{
     127    completionHandler(PlatformPasteboard(pasteboardName).addTypes(pasteboardTypes));
     128}
     129
     130void WebPasteboardProxy::setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(uint64_t)>&& completionHandler)
     131{
     132    completionHandler(PlatformPasteboard(pasteboardName).setTypes(pasteboardTypes));
     133}
     134
     135void WebPasteboardProxy::setPasteboardURL(IPC::Connection& connection, const PasteboardURL& pasteboardURL, const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
    129136{
    130137    for (auto* webProcessProxy : m_webProcessProxyList) {
     
    132139            continue;
    133140
    134         if (!webProcessProxy->checkURLReceivedFromWebProcess(pasteboardURL.url.string())) {
    135             newChangeCount = 0;
    136             return;
    137         }
    138 
    139         newChangeCount = PlatformPasteboard(pasteboardName).setURL(pasteboardURL);
    140         return;
     141        if (!webProcessProxy->checkURLReceivedFromWebProcess(pasteboardURL.url.string()))
     142            return completionHandler(0);
     143
     144        return completionHandler(PlatformPasteboard(pasteboardName).setURL(pasteboardURL));
    141145    }
    142     newChangeCount = 0;
    143 }
    144 
    145 void WebPasteboardProxy::setPasteboardColor(const String& pasteboardName, const WebCore::Color& color, uint64_t& newChangeCount)
    146 {
    147     newChangeCount = PlatformPasteboard(pasteboardName).setColor(color);
    148 }
    149 
    150 void WebPasteboardProxy::setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String& string, uint64_t& newChangeCount)
    151 {
    152     newChangeCount = PlatformPasteboard(pasteboardName).setStringForType(string, pasteboardType);
    153 }
    154 
    155 void WebPasteboardProxy::setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle& handle, uint64_t size, uint64_t& newChangeCount)
    156 {
    157     if (handle.isNull()) {
    158         newChangeCount = PlatformPasteboard(pasteboardName).setBufferForType(0, pasteboardType);
    159         return;
    160     }
     146    completionHandler(0);
     147}
     148
     149void WebPasteboardProxy::setPasteboardColor(const String& pasteboardName, const WebCore::Color& color, CompletionHandler<void(uint64_t)>&& completionHandler)
     150{
     151    completionHandler(PlatformPasteboard(pasteboardName).setColor(color));
     152}
     153
     154void WebPasteboardProxy::setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String& string, CompletionHandler<void(uint64_t)>&& completionHandler)
     155{
     156    completionHandler(PlatformPasteboard(pasteboardName).setStringForType(string, pasteboardType));
     157}
     158
     159void WebPasteboardProxy::setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle& handle, uint64_t size, CompletionHandler<void(uint64_t)>&& completionHandler)
     160{
     161    if (handle.isNull())
     162        return completionHandler(PlatformPasteboard(pasteboardName).setBufferForType(0, pasteboardType));
    161163    RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::map(handle, SharedMemory::Protection::ReadOnly);
    162164    auto buffer = SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), size);
    163     newChangeCount = PlatformPasteboard(pasteboardName).setBufferForType(buffer.ptr(), pasteboardType);
    164 }
    165 
    166 void WebPasteboardProxy::getNumberOfFiles(const String& pasteboardName, uint64_t& numberOfFiles)
    167 {
    168     numberOfFiles = PlatformPasteboard(pasteboardName).numberOfFiles();
    169 }
    170 
    171 void WebPasteboardProxy::typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin, Vector<String>& types)
    172 {
    173     types = PlatformPasteboard(pasteboardName).typesSafeForDOMToReadAndWrite(origin);
    174 }
    175 
    176 void WebPasteboardProxy::writeCustomData(const WebCore::PasteboardCustomData& data, const String& pasteboardName, uint64_t& newChangeCount)
    177 {
    178     newChangeCount = PlatformPasteboard(pasteboardName).write(data);
     165    completionHandler(PlatformPasteboard(pasteboardName).setBufferForType(buffer.ptr(), pasteboardType));
     166}
     167
     168void WebPasteboardProxy::getNumberOfFiles(const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
     169{
     170    completionHandler(PlatformPasteboard(pasteboardName).numberOfFiles());
     171}
     172
     173void WebPasteboardProxy::typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
     174{
     175    completionHandler(PlatformPasteboard(pasteboardName).typesSafeForDOMToReadAndWrite(origin));
     176}
     177
     178void WebPasteboardProxy::writeCustomData(const WebCore::PasteboardCustomData& data, const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
     179{
     180    completionHandler(PlatformPasteboard(pasteboardName).write(data));
    179181}
    180182
     
    201203}
    202204
    203 void WebPasteboardProxy::readStringFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, WTF::String& value)
    204 {
    205     value = PlatformPasteboard(pasteboardName).readString(index, pasteboardType);
    206 }
    207 
    208 void WebPasteboardProxy::readURLFromPasteboard(uint64_t index, const String& pasteboardName, String& url, String& title)
    209 {
    210     url = PlatformPasteboard(pasteboardName).readURL(index, title);
    211 }
    212 
    213 void WebPasteboardProxy::readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, SharedMemory::Handle& handle, uint64_t& size)
     205void WebPasteboardProxy::readStringFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(String&&)>&& completionHandler)
     206{
     207    completionHandler(PlatformPasteboard(pasteboardName).readString(index, pasteboardType));
     208}
     209
     210void WebPasteboardProxy::readURLFromPasteboard(uint64_t index, const String& pasteboardName, CompletionHandler<void(String&& url, String&& title)>&& completionHandler)
     211{
     212    String title;
     213    String url = PlatformPasteboard(pasteboardName).readURL(index, title);
     214    completionHandler(WTFMove(url), WTFMove(title));
     215}
     216
     217void WebPasteboardProxy::readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(SharedMemory::Handle&&, uint64_t size)>&& completionHandler)
    214218{
    215219    RefPtr<SharedBuffer> buffer = PlatformPasteboard(pasteboardName).readBuffer(index, pasteboardType);
    216220    if (!buffer)
    217         return;
    218     size = buffer->size();
     221        return completionHandler({ }, 0);
     222    uint64_t size = buffer->size();
    219223    if (!size)
    220         return;
     224        return completionHandler({ }, 0);
    221225    RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::allocate(size);
    222226    if (!sharedMemoryBuffer)
    223         return;
     227        return completionHandler({ }, 0);
    224228    memcpy(sharedMemoryBuffer->data(), buffer->data(), size);
     229    SharedMemory::Handle handle;
    225230    sharedMemoryBuffer->createHandle(handle, SharedMemory::Protection::ReadOnly);
    226 }
    227 
    228 void WebPasteboardProxy::getPasteboardItemsCount(const String& pasteboardName, uint64_t& itemsCount)
    229 {
    230     itemsCount = PlatformPasteboard(pasteboardName).count();
    231 }
    232 
    233 void WebPasteboardProxy::allPasteboardItemInfo(const String& pasteboardName, Vector<PasteboardItemInfo>& allInfo)
    234 {
    235     allInfo = PlatformPasteboard(pasteboardName).allPasteboardItemInfo();
    236 }
    237 
    238 void WebPasteboardProxy::informationForItemAtIndex(int index, const String& pasteboardName, PasteboardItemInfo& info)
    239 {
    240     info = PlatformPasteboard(pasteboardName).informationForItemAtIndex(index);
     231    completionHandler(WTFMove(handle), size);
     232}
     233
     234void WebPasteboardProxy::getPasteboardItemsCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&& completionHandler)
     235{
     236    completionHandler(PlatformPasteboard(pasteboardName).count());
     237}
     238
     239void WebPasteboardProxy::allPasteboardItemInfo(const String& pasteboardName, CompletionHandler<void(Vector<PasteboardItemInfo>&&)>&& completionHandler)
     240{
     241    completionHandler(PlatformPasteboard(pasteboardName).allPasteboardItemInfo());
     242}
     243
     244void WebPasteboardProxy::informationForItemAtIndex(int index, const String& pasteboardName, CompletionHandler<void(PasteboardItemInfo&&)>&& completionHandler)
     245{
     246    completionHandler(PlatformPasteboard(pasteboardName).informationForItemAtIndex(index));
    241247}
    242248
  • trunk/Source/WebKit/UIProcess/WebPasteboardProxy.cpp

    r223195 r243325  
    6464#if !PLATFORM(COCOA)
    6565
    66 void WebPasteboardProxy::typesSafeForDOMToReadAndWrite(const String&, const String&, Vector<String>& types)
     66void WebPasteboardProxy::typesSafeForDOMToReadAndWrite(const String&, const String&, CompletionHandler<void(Vector<String>&&)>&& completionHandler)
    6767{
    68     types = { };
     68    completionHandler({ });
    6969}
    7070
    71 void WebPasteboardProxy::writeCustomData(const WebCore::PasteboardCustomData&, const String&, uint64_t& newChangeCount)
     71void WebPasteboardProxy::writeCustomData(const WebCore::PasteboardCustomData&, const String&, CompletionHandler<void(uint64_t)>&& completionHandler)
    7272{
    73     newChangeCount = 0;
     73    completionHandler(0);
    7474}
    7575
  • trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h

    r241749 r243325  
    7474    void writeImageToPasteboard(const WebCore::PasteboardImage&, const String& pasteboardName);
    7575    void writeStringToPasteboard(const String& pasteboardType, const String&, const String& pasteboardName);
    76     void readStringFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, WTF::String&);
    77     void readURLFromPasteboard(uint64_t index, const String& pasteboardName, String& url, String& title);
    78     void readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, SharedMemory::Handle&, uint64_t& size);
    79     void getPasteboardItemsCount(const String& pasteboardName, uint64_t& itemsCount);
    80     void allPasteboardItemInfo(const String& pasteboardName, Vector<WebCore::PasteboardItemInfo>&);
    81     void informationForItemAtIndex(int index, const String& pasteboardName, WebCore::PasteboardItemInfo& filename);
     76    void readStringFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(String&&)>&&);
     77    void readURLFromPasteboard(uint64_t index, const String& pasteboardName, CompletionHandler<void(String&& url, String&& title)>&&);
     78    void readBufferFromPasteboard(uint64_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(SharedMemory::Handle&&, uint64_t size)>&&);
     79    void getPasteboardItemsCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
     80    void allPasteboardItemInfo(const String& pasteboardName, CompletionHandler<void(Vector<WebCore::PasteboardItemInfo>&&)>&&);
     81    void informationForItemAtIndex(int index, const String& pasteboardName, CompletionHandler<void(WebCore::PasteboardItemInfo&&)>&&);
    8282    void updateSupportedTypeIdentifiers(const Vector<String>& identifiers, const String& pasteboardName);
    8383#endif
    8484#if PLATFORM(COCOA)
    85     void getNumberOfFiles(const String& pasteboardName, uint64_t& numberOfFiles);
    86     void getPasteboardTypes(const String& pasteboardName, Vector<String>& pasteboardTypes);
    87     void getPasteboardPathnamesForType(IPC::Connection&, const String& pasteboardName, const String& pasteboardType, Vector<String>& pathnames, SandboxExtension::HandleArray&);
    88     void getPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, String&);
    89     void getPasteboardStringsForType(const String& pasteboardName, const String& pasteboardType, Vector<String>&);
    90     void getPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, SharedMemory::Handle&, uint64_t& size);
    91     void pasteboardCopy(const String& fromPasteboard, const String& toPasteboard, uint64_t& newChangeCount);
    92     void getPasteboardChangeCount(const String& pasteboardName, uint64_t& changeCount);
    93     void getPasteboardUniqueName(String& pasteboardName);
    94     void getPasteboardColor(const String& pasteboardName, WebCore::Color&);
    95     void getPasteboardURL(const String& pasteboardName, WTF::String&);
    96     void addPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, uint64_t& newChangeCount);
    97     void setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, uint64_t& newChangeCount);
    98     void setPasteboardURL(IPC::Connection&, const WebCore::PasteboardURL&, const String& pasteboardName, uint64_t& newChangeCount);
    99     void setPasteboardColor(const String&, const WebCore::Color&, uint64_t&);
    100     void setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String&, uint64_t& newChangeCount);
    101     void setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle&, uint64_t size, uint64_t& newChangeCount);
     85    void getNumberOfFiles(const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
     86    void getPasteboardTypes(const String& pasteboardName, CompletionHandler<void(Vector<String>&&)>&&);
     87    void getPasteboardPathnamesForType(IPC::Connection&, const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(Vector<String>&& pathnames, SandboxExtension::HandleArray&&)>&&);
     88    void getPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(String&&)>&&);
     89    void getPasteboardStringsForType(const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(Vector<String>&&)>&&);
     90    void getPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&&);
     91    void pasteboardCopy(const String& fromPasteboard, const String& toPasteboard, CompletionHandler<void(uint64_t)>&&);
     92    void getPasteboardChangeCount(const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
     93    void getPasteboardUniqueName(CompletionHandler<void(String&&)>&&);
     94    void getPasteboardColor(const String& pasteboardName, CompletionHandler<void(WebCore::Color&&)>&&);
     95    void getPasteboardURL(const String& pasteboardName, CompletionHandler<void(const String&)>&&);
     96    void addPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(uint64_t)>&&);
     97    void setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes, CompletionHandler<void(uint64_t)>&&);
     98    void setPasteboardURL(IPC::Connection&, const WebCore::PasteboardURL&, const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
     99    void setPasteboardColor(const String&, const WebCore::Color&, CompletionHandler<void(uint64_t)>&&);
     100    void setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String&, CompletionHandler<void(uint64_t)>&&);
     101    void setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle&, uint64_t size, CompletionHandler<void(uint64_t)>&&);
    102102#endif
    103103
    104     void writeCustomData(const WebCore::PasteboardCustomData&, const String& pasteboardName, uint64_t& newChangeCount);
    105     void typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin, Vector<String>& types);
     104    void writeCustomData(const WebCore::PasteboardCustomData&, const String& pasteboardName, CompletionHandler<void(uint64_t)>&&);
     105    void typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin, CompletionHandler<void(Vector<String>&&)>&&);
    106106
    107107#if PLATFORM(GTK)
    108108    void writeToClipboard(const String& pasteboardName, const WebSelectionData&);
    109     void readFromClipboard(const String& pasteboardName, WebSelectionData&);
     109    void readFromClipboard(const String& pasteboardName, CompletionHandler<void(WebSelectionData&&)>&&);
    110110
    111111    WebFrameProxy* m_primarySelectionOwner { nullptr };
     
    114114
    115115#if USE(LIBWPE)
    116     void getPasteboardTypes(Vector<String>& pasteboardTypes);
    117     void readStringFromPasteboard(uint64_t index, const String& pasteboardType, WTF::String&);
     116    void getPasteboardTypes(CompletionHandler<void(Vector<String>&&)>&&);
     117    void readStringFromPasteboard(uint64_t index, const String& pasteboardType, CompletionHandler<void(String&&)>&&);
    118118    void writeWebContentToPasteboard(const WebCore::PasteboardWebContent&);
    119119    void writeStringToPasteboard(const String& pasteboardType, const String&);
  • trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in

    r241749 r243325  
    2727    WriteImageToPasteboard(struct WebCore::PasteboardImage pasteboardImage, String pasteboardName)
    2828    WriteStringToPasteboard(String pasteboardType, String text, String pasteboardName)
    29     ReadStringFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (String string) LegacySync
    30     ReadURLFromPasteboard(uint64_t index, String pasteboardName) -> (String url, String title) LegacySync
    31     ReadBufferFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (WebKit::SharedMemory::Handle handle, uint64_t size) LegacySync
    32     GetPasteboardItemsCount(String pasteboardName) -> (uint64_t itemsCount) LegacySync
    33     AllPasteboardItemInfo(String pasteboardName) -> (Vector<WebCore::PasteboardItemInfo> allInfo) LegacySync
    34     InformationForItemAtIndex(uint64_t index, String pasteboardName) -> (struct WebCore::PasteboardItemInfo info) LegacySync
     29    ReadStringFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (String string) Delayed
     30    ReadURLFromPasteboard(uint64_t index, String pasteboardName) -> (String url, String title) Delayed
     31    ReadBufferFromPasteboard(uint64_t index, String pasteboardType, String pasteboardName) -> (WebKit::SharedMemory::Handle handle, uint64_t size) Delayed
     32    GetPasteboardItemsCount(String pasteboardName) -> (uint64_t itemsCount) Delayed
     33    AllPasteboardItemInfo(String pasteboardName) -> (Vector<WebCore::PasteboardItemInfo> allInfo) Delayed
     34    InformationForItemAtIndex(uint64_t index, String pasteboardName) -> (struct WebCore::PasteboardItemInfo info) Delayed
    3535    UpdateSupportedTypeIdentifiers(Vector<String> identifiers, String pasteboardName)
    3636#endif
    3737
    38     WriteCustomData(struct WebCore::PasteboardCustomData data, String pasteboardName) -> (uint64_t changeCount) LegacySync
    39     TypesSafeForDOMToReadAndWrite(String pasteboardName, String origin) -> (Vector<String> types) LegacySync
     38    WriteCustomData(struct WebCore::PasteboardCustomData data, String pasteboardName) -> (uint64_t changeCount) Delayed
     39    TypesSafeForDOMToReadAndWrite(String pasteboardName, String origin) -> (Vector<String> types) Delayed
    4040
    4141#if PLATFORM(COCOA)
    4242    # Pasteboard messages.
    43     GetNumberOfFiles(String pasteboardName) -> (uint64_t numberOfFiles) LegacySync
    44     GetPasteboardTypes(String pasteboardName) -> (Vector<String> types) LegacySync
    45     GetPasteboardPathnamesForType(String pasteboardName, String pasteboardType) -> (Vector<String> pathnames, WebKit::SandboxExtension::HandleArray sandboxExtensions) LegacySync WantsConnection
    46     GetPasteboardStringForType(String pasteboardName, String pasteboardType) -> (String string) LegacySync
    47     GetPasteboardStringsForType(String pasteboardName, String pasteboardType) -> (Vector<String> strings) LegacySync
    48     GetPasteboardBufferForType(String pasteboardName, String pasteboardType) -> (WebKit::SharedMemory::Handle handle, uint64_t size) LegacySync
    49     PasteboardCopy(String fromPasteboard, String toPasteboard) -> (uint64_t changeCount) LegacySync
    50     GetPasteboardChangeCount(String pasteboardName) -> (uint64_t changeCount) LegacySync
    51     GetPasteboardUniqueName() -> (String pasteboardName) LegacySync
    52     GetPasteboardColor(String pasteboardName) -> (WebCore::Color color) LegacySync
    53     GetPasteboardURL(String pasteboardName) -> (String urlString) LegacySync
    54     AddPasteboardTypes(String pasteboardName, Vector<String> pasteboardTypes) -> (uint64_t changeCount) LegacySync
    55     SetPasteboardTypes(String pasteboardName, Vector<String> pasteboardTypes) -> (uint64_t changeCount) LegacySync
    56     SetPasteboardURL(struct WebCore::PasteboardURL pasteboardURL, String pasteboardName) -> (uint64_t changeCount) LegacySync WantsConnection
    57     SetPasteboardColor(String pasteboardName, WebCore::Color color) -> (uint64_t changeCount) LegacySync
    58     SetPasteboardStringForType(String pasteboardName, String pasteboardType, String string) -> (uint64_t changeCount) LegacySync
    59     SetPasteboardBufferForType(String pasteboardName, String pasteboardType, WebKit::SharedMemory::Handle handle, uint64_t size) -> (uint64_t changeCount) LegacySync
     43    GetNumberOfFiles(String pasteboardName) -> (uint64_t numberOfFiles) Delayed
     44    GetPasteboardTypes(String pasteboardName) -> (Vector<String> types) Delayed
     45    GetPasteboardPathnamesForType(String pasteboardName, String pasteboardType) -> (Vector<String> pathnames, WebKit::SandboxExtension::HandleArray sandboxExtensions) Delayed WantsConnection
     46    GetPasteboardStringForType(String pasteboardName, String pasteboardType) -> (String string) Delayed
     47    GetPasteboardStringsForType(String pasteboardName, String pasteboardType) -> (Vector<String> strings) Delayed
     48    GetPasteboardBufferForType(String pasteboardName, String pasteboardType) -> (WebKit::SharedMemory::Handle handle, uint64_t size) Delayed
     49    PasteboardCopy(String fromPasteboard, String toPasteboard) -> (uint64_t changeCount) Delayed
     50    GetPasteboardChangeCount(String pasteboardName) -> (uint64_t changeCount) Delayed
     51    GetPasteboardUniqueName() -> (String pasteboardName) Delayed
     52    GetPasteboardColor(String pasteboardName) -> (WebCore::Color color) Delayed
     53    GetPasteboardURL(String pasteboardName) -> (String urlString) Delayed
     54    AddPasteboardTypes(String pasteboardName, Vector<String> pasteboardTypes) -> (uint64_t changeCount) Delayed
     55    SetPasteboardTypes(String pasteboardName, Vector<String> pasteboardTypes) -> (uint64_t changeCount) Delayed
     56    SetPasteboardURL(struct WebCore::PasteboardURL pasteboardURL, String pasteboardName) -> (uint64_t changeCount) Delayed WantsConnection
     57    SetPasteboardColor(String pasteboardName, WebCore::Color color) -> (uint64_t changeCount) Delayed
     58    SetPasteboardStringForType(String pasteboardName, String pasteboardType, String string) -> (uint64_t changeCount) Delayed
     59    SetPasteboardBufferForType(String pasteboardName, String pasteboardType, WebKit::SharedMemory::Handle handle, uint64_t size) -> (uint64_t changeCount) Delayed
    6060#endif
    6161
    6262#if PLATFORM(GTK)
    63     WriteToClipboard(String pasteboardName, struct WebKit::WebSelectionData pasteboardContent) LegacySync
    64     ReadFromClipboard(String pasteboardName) -> (struct WebKit::WebSelectionData pasteboardContent) LegacySync
     63    WriteToClipboard(String pasteboardName, struct WebKit::WebSelectionData pasteboardContent)
     64    ReadFromClipboard(String pasteboardName) -> (struct WebKit::WebSelectionData pasteboardContent) Delayed
    6565#endif
    6666
    6767#if USE(LIBWPE)
    68     GetPasteboardTypes() -> (Vector<String> types) LegacySync
    69     ReadStringFromPasteboard(uint64_t index, String pasteboardType) -> (String string) LegacySync
    70     WriteWebContentToPasteboard(struct WebCore::PasteboardWebContent content) LegacySync
    71     WriteStringToPasteboard(String pasteboardType, String text) LegacySync
     68    GetPasteboardTypes() -> (Vector<String> types) Delayed
     69    ReadStringFromPasteboard(uint64_t index, String pasteboardType) -> (String string) Delayed
     70    WriteWebContentToPasteboard(struct WebCore::PasteboardWebContent content)
     71    WriteStringToPasteboard(String pasteboardType, String text)
    7272#endif
    7373}
  • trunk/Source/WebKit/UIProcess/gtk/WebPasteboardProxyGtk.cpp

    r228373 r243325  
    4545}
    4646
    47 void WebPasteboardProxy::readFromClipboard(const String& pasteboardName, WebSelectionData& selection)
     47void WebPasteboardProxy::readFromClipboard(const String& pasteboardName, CompletionHandler<void(WebSelectionData&&)>&& completionHandler)
    4848{
    49     selection = WebSelectionData(PlatformPasteboard(pasteboardName).readFromClipboard());
     49    completionHandler(WebSelectionData(PlatformPasteboard(pasteboardName).readFromClipboard()));
    5050}
    5151
  • trunk/Source/WebKit/UIProcess/wpe/WebPasteboardProxyWPE.cpp

    r235265 r243325  
    3333using namespace WebCore;
    3434
    35 void WebPasteboardProxy::getPasteboardTypes(Vector<String>& pasteboardTypes)
     35void WebPasteboardProxy::getPasteboardTypes(CompletionHandler<void(Vector<String>&&)>&& completionHandler)
    3636{
     37    Vector<String> pasteboardTypes;
    3738    PlatformPasteboard().getTypes(pasteboardTypes);
     39    completionHandler(WTFMove(pasteboardTypes));
    3840}
    3941
    40 void WebPasteboardProxy::readStringFromPasteboard(uint64_t index, const String& pasteboardType, WTF::String& value)
     42void WebPasteboardProxy::readStringFromPasteboard(uint64_t index, const String& pasteboardType, CompletionHandler<void(String&&)>&& completionHandler)
    4143{
    42     value = PlatformPasteboard().readString(index, pasteboardType);
     44    completionHandler(PlatformPasteboard().readString(index, pasteboardType));
    4345}
    4446
Note: See TracChangeset for help on using the changeset viewer.