Diff
Modified: trunk/Source/WebCore/ChangeLog (109021 => 109022)
--- trunk/Source/WebCore/ChangeLog 2012-02-27 21:33:06 UTC (rev 109021)
+++ trunk/Source/WebCore/ChangeLog 2012-02-27 22:03:41 UTC (rev 109022)
@@ -1,3 +1,18 @@
+2012-02-27 Enrica Casucci <enr...@apple.com>
+
+ WebKit2: implement platform strategy to access Pasteboard in the UI process.
+ https://bugs.webkit.org/show_bug.cgi?id=79253
+ <rdar://problem/9971876>
+
+ Reviewed by Alexey Proskuryakov.
+
+ No new tests. No behavior change.
+
+ * platform/mac/PlatformPasteboardMac.mm:
+ (WebCore::PlatformPasteboard::bufferForType): There is no need
+ to create a SharedBuffer object if there is no NSData in the pasteboard
+ for the given pasteboard type.
+
2012-02-27 Adrienne Walker <e...@google.com>
[chromium] Unreviewed speculative Chromium win build fix.
Modified: trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm (109021 => 109022)
--- trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm 2012-02-27 21:33:06 UTC (rev 109021)
+++ trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm 2012-02-27 22:03:41 UTC (rev 109022)
@@ -45,7 +45,10 @@
PassRefPtr<SharedBuffer> PlatformPasteboard::bufferForType(const String& pasteboardType)
{
- return SharedBuffer::wrapNSData([[[m_pasteboard.get() dataForType:pasteboardType] copy] autorelease]);
+ NSData *data = "" dataForType:pasteboardType];
+ if (!data)
+ return 0;
+ return SharedBuffer::wrapNSData([[data copy] autorelease]);
}
void PlatformPasteboard::getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType)
Modified: trunk/Source/WebKit2/ChangeLog (109021 => 109022)
--- trunk/Source/WebKit2/ChangeLog 2012-02-27 21:33:06 UTC (rev 109021)
+++ trunk/Source/WebKit2/ChangeLog 2012-02-27 22:03:41 UTC (rev 109022)
@@ -1,3 +1,43 @@
+2012-02-27 Enrica Casucci <enr...@apple.com>
+
+ WebKit2: implement platform strategy to access Pasteboard in the UI process.
+ https://bugs.webkit.org/show_bug.cgi?id=79253
+ <rdar://problem/9971876>
+
+ Reviewed by Alexey Proskuryakov.
+
+ * UIProcess/WebContext.h:
+ * UIProcess/WebContext.messages.in: Added messages to access NSPasteboard
+ in the UI process.
+ * UIProcess/mac/WebContextMac.mm: Added methods corresponding to the
+ new messages.
+ (WebKit::WebContext::getPasteboardTypes):
+ (WebKit::WebContext::getPasteboardPathnamesForType):
+ (WebKit::WebContext::getPasteboardStringForType):
+ (WebKit::WebContext::getPasteboardBufferForType):
+ (WebKit::WebContext::pasteboardCopy):
+ (WebKit::WebContext::getPasteboardChangeCount):
+ (WebKit::WebContext::getPasteboardUniqueName):
+ (WebKit::WebContext::getPasteboardColor):
+ (WebKit::WebContext::setPasteboardTypes):
+ (WebKit::WebContext::setPasteboardPathnamesForType):
+ (WebKit::WebContext::setPasteboardStringForType):
+ (WebKit::WebContext::setPasteboardBufferForType):
+ * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: New implementation of the PasteboardStrategy using message exchange
+ with the UI process.
+ (WebKit::WebPlatformStrategies::getTypes):
+ (WebKit::WebPlatformStrategies::bufferForType):
+ (WebKit::WebPlatformStrategies::getPathnamesForType):
+ (WebKit::WebPlatformStrategies::stringForType):
+ (WebKit::WebPlatformStrategies::copy):
+ (WebKit::WebPlatformStrategies::changeCount):
+ (WebKit::WebPlatformStrategies::uniqueName):
+ (WebKit::WebPlatformStrategies::color):
+ (WebKit::WebPlatformStrategies::setTypes):
+ (WebKit::WebPlatformStrategies::setBufferForType):
+ (WebKit::WebPlatformStrategies::setPathnamesForType):
+ (WebKit::WebPlatformStrategies::setStringForType):
+
2012-02-27 Dan Bernstein <m...@apple.com>
<rdar://problem/9557598> REGRESSION (WebKit2): Non-activating links sometimes don’t work
Modified: trunk/Source/WebKit2/UIProcess/WebContext.h (109021 => 109022)
--- trunk/Source/WebKit2/UIProcess/WebContext.h 2012-02-27 21:33:06 UTC (rev 109021)
+++ trunk/Source/WebKit2/UIProcess/WebContext.h 2012-02-27 22:03:41 UTC (rev 109022)
@@ -224,7 +224,22 @@
void didGetSitesWithPluginData(const Vector<String>& sites, uint64_t callbackID);
void didClearPluginSiteData(uint64_t callbackID);
#endif
-
+
+#if PLATFORM(MAC)
+ void getPasteboardTypes(const String& pasteboardName, Vector<String>& pasteboardTypes);
+ void getPasteboardPathnamesForType(const String& pasteboardName, const String& pasteboardType, Vector<String>& pathnames);
+ void getPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, String&);
+ void getPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, SharedMemory::Handle&, uint64_t& size);
+ void pasteboardCopy(const String& fromPasteboard, const String& toPasteboard);
+ void getPasteboardChangeCount(const String& pasteboardName, uint64_t& changeCount);
+ void getPasteboardUniqueName(String& pasteboardName);
+ void getPasteboardColor(const String& pasteboardName, WebCore::Color&);
+ void setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes);
+ void setPasteboardPathnamesForType(const String& pasteboardName, const String& pasteboardType, const Vector<String>& pathnames);
+ void setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String&);
+ void setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle&, uint64_t size);
+#endif
+
void didGetWebCoreStatistics(const StatisticsData&, uint64_t callbackID);
// Implemented in generated WebContextMessageReceiver.cpp
Modified: trunk/Source/WebKit2/UIProcess/WebContext.messages.in (109021 => 109022)
--- trunk/Source/WebKit2/UIProcess/WebContext.messages.in 2012-02-27 21:33:06 UTC (rev 109021)
+++ trunk/Source/WebKit2/UIProcess/WebContext.messages.in 2012-02-27 22:03:41 UTC (rev 109022)
@@ -42,4 +42,20 @@
DidGetWebCoreStatistics(WebKit::StatisticsData statisticsData, uint64_t callbackID)
+#if PLATFORM(MAC)
+ # Pasteboard messages.
+
+ GetPasteboardTypes(WTF::String pasteboardName) -> (Vector<WTF::String> types)
+ GetPasteboardPathnamesForType(WTF::String pasteboardName, WTF::String pasteboardType) -> (Vector<WTF::String> pathnames)
+ GetPasteboardStringForType(WTF::String pasteboardName, WTF::String pasteboardType) -> (WTF::String string)
+ GetPasteboardBufferForType(WTF::String pasteboardName, WTF::String pasteboardType) -> (WebKit::SharedMemory::Handle handle, uint64_t size)
+ PasteboardCopy(WTF::String fromPasteboard, WTF::String toPasteboard)
+ GetPasteboardChangeCount(WTF::String pasteboardName) -> (uint64_t changeCount)
+ GetPasteboardUniqueName() -> (WTF::String pasteboardName)
+ GetPasteboardColor(WTF::String pasteboardName) -> (WebCore::Color color)
+ SetPasteboardTypes(WTF::String pasteboardName, Vector<WTF::String> pasteboardTypes)
+ SetPasteboardPathnamesForType(WTF::String pasteboardName, WTF::String pasteboardType, Vector<WTF::String> pathnames)
+ SetPasteboardStringForType(WTF::String pasteboardName, WTF::String pasteboardType, WTF::String string)
+ SetPasteboardBufferForType(WTF::String pasteboardName, WTF::String pasteboardType, WebKit::SharedMemory::Handle handle, uint64_t size)
+#endif
}
Modified: trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm (109021 => 109022)
--- trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm 2012-02-27 21:33:06 UTC (rev 109021)
+++ trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm 2012-02-27 22:03:41 UTC (rev 109022)
@@ -28,7 +28,9 @@
#import "WebKitSystemInterface.h"
#import "WebProcessCreationParameters.h"
+#import <WebCore/Color.h>
#import <WebCore/FileSystem.h>
+#import <WebCore/PlatformPasteboard.h>
#import <sys/param.h>
#if !defined(BUILDING_ON_SNOW_LEOPARD)
@@ -155,5 +157,77 @@
return [[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitOmitPDFSupport"];
}
+void WebContext::getPasteboardTypes(const String& pasteboardName, Vector<String>& pasteboardTypes)
+{
+ PlatformPasteboard(pasteboardName).getTypes(pasteboardTypes);
+}
+
+void WebContext::getPasteboardPathnamesForType(const String& pasteboardName, const String& pasteboardType, Vector<String>& pathnames)
+{
+ PlatformPasteboard(pasteboardName).getPathnamesForType(pathnames, pasteboardType);
+}
+
+void WebContext::getPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, String& string)
+{
+ string = PlatformPasteboard(pasteboardName).stringForType(pasteboardType);
+}
+
+void WebContext::getPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, SharedMemory::Handle& handle, uint64_t& size)
+{
+ RefPtr<SharedBuffer> buffer = PlatformPasteboard(pasteboardName).bufferForType(pasteboardType);
+ if (!buffer)
+ return;
+ size = buffer->size();
+ RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::create(size);
+ memcpy(sharedMemoryBuffer->data(), buffer->data(), size);
+ sharedMemoryBuffer->createHandle(handle, SharedMemory::ReadOnly);
+}
+
+void WebContext::pasteboardCopy(const String& fromPasteboard, const String& toPasteboard)
+{
+ PlatformPasteboard(toPasteboard).copy(fromPasteboard);
+}
+
+void WebContext::getPasteboardChangeCount(const String& pasteboardName, uint64_t& changeCount)
+{
+ changeCount = PlatformPasteboard(pasteboardName).changeCount();
+}
+
+void WebContext::getPasteboardUniqueName(String& pasteboardName)
+{
+ pasteboardName = PlatformPasteboard::uniqueName();
+}
+
+void WebContext::getPasteboardColor(const String& pasteboardName, WebCore::Color& color)
+{
+ color = PlatformPasteboard(pasteboardName).color();
+}
+
+void WebContext::setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes)
+{
+ PlatformPasteboard(pasteboardName).setTypes(pasteboardTypes);
+}
+
+void WebContext::setPasteboardPathnamesForType(const String& pasteboardName, const String& pasteboardType, const Vector<String>& pathnames)
+{
+ PlatformPasteboard(pasteboardName).setPathnamesForType(pathnames, pasteboardType);
+}
+
+void WebContext::setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String& string)
+{
+ PlatformPasteboard(pasteboardName).setStringForType(string, pasteboardType);
+}
+
+void WebContext::setPasteboardBufferForType(const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle& handle, uint64_t size)
+{
+ if (handle.isNull()) {
+ PlatformPasteboard(pasteboardName).setBufferForType(0, pasteboardType);
+ return;
+ }
+ RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::create(handle, SharedMemory::ReadOnly);
+ RefPtr<SharedBuffer> buffer = SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), size);
+ PlatformPasteboard(pasteboardName).setBufferForType(buffer, pasteboardType);
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (109021 => 109022)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp 2012-02-27 21:33:06 UTC (rev 109021)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp 2012-02-27 22:03:41 UTC (rev 109022)
@@ -137,62 +137,89 @@
void WebPlatformStrategies::getTypes(Vector<String>& types, const String& pasteboardName)
{
- PlatformPasteboard(pasteboardName).getTypes(types);
+ WebProcess::shared().connection()->sendSync(Messages::WebContext::GetPasteboardTypes(pasteboardName),
+ Messages::WebContext::GetPasteboardTypes::Reply(types), 0);
}
PassRefPtr<WebCore::SharedBuffer> WebPlatformStrategies::bufferForType(const String& pasteboardType, const String& pasteboardName)
{
- return PlatformPasteboard(pasteboardName).bufferForType(pasteboardType);
+ SharedMemory::Handle handle;
+ uint64_t size = 0;
+ WebProcess::shared().connection()->sendSync(Messages::WebContext::GetPasteboardBufferForType(pasteboardName, pasteboardType),
+ Messages::WebContext::GetPasteboardBufferForType::Reply(handle, size), 0);
+ if (handle.isNull())
+ return 0;
+ RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::create(handle, SharedMemory::ReadOnly);
+ return SharedBuffer::create(static_cast<unsigned char *>(sharedMemoryBuffer->data()), size);
}
void WebPlatformStrategies::getPathnamesForType(Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName)
{
- PlatformPasteboard(pasteboardName).getPathnamesForType(pathnames, pasteboardType);
+ WebProcess::shared().connection()->sendSync(Messages::WebContext::GetPasteboardPathnamesForType(pasteboardName, pasteboardType),
+ Messages::WebContext::GetPasteboardPathnamesForType::Reply(pathnames), 0);
}
String WebPlatformStrategies::stringForType(const String& pasteboardType, const String& pasteboardName)
{
- return PlatformPasteboard(pasteboardName).stringForType(pasteboardType);
+ String value;
+ WebProcess::shared().connection()->sendSync(Messages::WebContext::GetPasteboardStringForType(pasteboardName, pasteboardType),
+ Messages::WebContext::GetPasteboardStringForType::Reply(value), 0);
+ return value;
}
void WebPlatformStrategies::copy(const String& fromPasteboard, const String& toPasteboard)
{
- PlatformPasteboard(toPasteboard).copy(fromPasteboard);
+ WebProcess::shared().connection()->send(Messages::WebContext::PasteboardCopy(fromPasteboard, toPasteboard), 0);
}
int WebPlatformStrategies::changeCount(const WTF::String &pasteboardName)
{
- return PlatformPasteboard(pasteboardName).changeCount();
+ uint64_t changeCount;
+ WebProcess::shared().connection()->sendSync(Messages::WebContext::GetPasteboardChangeCount(pasteboardName),
+ Messages::WebContext::GetPasteboardChangeCount::Reply(changeCount), 0);
+ return changeCount;
}
String WebPlatformStrategies::uniqueName()
{
- return PlatformPasteboard::uniqueName();
+ String pasteboardName;
+ WebProcess::shared().connection()->sendSync(Messages::WebContext::GetPasteboardUniqueName(),
+ Messages::WebContext::GetPasteboardUniqueName::Reply(pasteboardName), 0);
+ return pasteboardName;
}
Color WebPlatformStrategies::color(const String& pasteboardName)
{
- return PlatformPasteboard(pasteboardName).color();
+ Color color;
+ WebProcess::shared().connection()->sendSync(Messages::WebContext::GetPasteboardColor(pasteboardName),
+ Messages::WebContext::GetPasteboardColor::Reply(color), 0);
+ return color;
}
void WebPlatformStrategies::setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
{
- PlatformPasteboard(pasteboardName).setTypes(pasteboardTypes);
+ WebProcess::shared().connection()->send(Messages::WebContext::SetPasteboardTypes(pasteboardName, pasteboardTypes), 0);
}
void WebPlatformStrategies::setBufferForType(PassRefPtr<SharedBuffer> buffer, const String& pasteboardType, const String& pasteboardName)
{
- PlatformPasteboard(pasteboardName).setBufferForType(buffer, pasteboardType);
+ SharedMemory::Handle handle;
+ if (buffer) {
+ RefPtr<SharedMemory> sharedMemoryBuffer = SharedMemory::create(buffer->size());
+ memcpy(sharedMemoryBuffer->data(), buffer->data(), buffer->size());
+ sharedMemoryBuffer->createHandle(handle, SharedMemory::ReadOnly);
+ }
+ WebProcess::shared().connection()->send(Messages::WebContext::SetPasteboardBufferForType(pasteboardName, pasteboardType, handle, buffer ? buffer->size() : 0), 0);
}
void WebPlatformStrategies::setPathnamesForType(const Vector<String>& pathnames, const String& pasteboardType, const String& pasteboardName)
{
- PlatformPasteboard(pasteboardName).setPathnamesForType(pathnames, pasteboardType);
+ WebProcess::shared().connection()->send(Messages::WebContext::SetPasteboardPathnamesForType(pasteboardName, pasteboardType, pathnames), 0);
}
void WebPlatformStrategies::setStringForType(const String& string, const String& pasteboardType, const String& pasteboardName)
{
- PlatformPasteboard(pasteboardName).setStringForType(string, pasteboardType);
+ WebProcess::shared().connection()->send(Messages::WebContext::SetPasteboardStringForType(pasteboardName, pasteboardType, string), 0);
}
#endif