Title: [169233] trunk/Source/WebKit2
- Revision
- 169233
- Author
- [email protected]
- Date
- 2014-05-22 17:40:23 -0700 (Thu, 22 May 2014)
Log Message
[iOS] Send shareable resources to QuickLook if enabled
https://bugs.webkit.org/show_bug.cgi?id=133189
<rdar://problem/17003995>
Reviewed by Brady Eidson.
Like we do for didReceiveData(), we need to pass an incoming ShareableResource to QuickLook if a QuickLook
handle exists.
* Shared/ShareableResource.cpp:
(WebKit::ShareableResource::Handle::tryWrapInCFData): Return the shared resource in a CFDataRef.
(WebKit::ShareableResource::Handle::tryWrapInSharedBuffer): Implemented in terms of tryWrapInCFData().
* Shared/ShareableResource.h:
* WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::didReceiveResource): If a QuickLook handle exists, send the shareable resource to
it via a CFDataRef.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (169232 => 169233)
--- trunk/Source/WebKit2/ChangeLog 2014-05-23 00:39:36 UTC (rev 169232)
+++ trunk/Source/WebKit2/ChangeLog 2014-05-23 00:40:23 UTC (rev 169233)
@@ -1,3 +1,22 @@
+2014-05-22 Andy Estes <[email protected]>
+
+ [iOS] Send shareable resources to QuickLook if enabled
+ https://bugs.webkit.org/show_bug.cgi?id=133189
+ <rdar://problem/17003995>
+
+ Reviewed by Brady Eidson.
+
+ Like we do for didReceiveData(), we need to pass an incoming ShareableResource to QuickLook if a QuickLook
+ handle exists.
+
+ * Shared/ShareableResource.cpp:
+ (WebKit::ShareableResource::Handle::tryWrapInCFData): Return the shared resource in a CFDataRef.
+ (WebKit::ShareableResource::Handle::tryWrapInSharedBuffer): Implemented in terms of tryWrapInCFData().
+ * Shared/ShareableResource.h:
+ * WebProcess/Network/WebResourceLoader.cpp:
+ (WebKit::WebResourceLoader::didReceiveResource): If a QuickLook handle exists, send the shareable resource to
+ it via a CFDataRef.
+
2014-05-22 Martin Hock <[email protected]>
[iOS] Enable -apple-system- styled elements to respond to system font size changes.
Modified: trunk/Source/WebKit2/Shared/ShareableResource.cpp (169232 => 169233)
--- trunk/Source/WebKit2/Shared/ShareableResource.cpp 2014-05-23 00:39:36 UTC (rev 169232)
+++ trunk/Source/WebKit2/Shared/ShareableResource.cpp 2014-05-23 00:40:23 UTC (rev 169233)
@@ -80,7 +80,7 @@
return CFAllocatorCreate(kCFAllocatorDefault, &context);
}
-PassRefPtr<SharedBuffer> ShareableResource::Handle::tryWrapInSharedBuffer() const
+RetainPtr<CFDataRef> ShareableResource::Handle::tryWrapInCFData() const
{
RefPtr<ShareableResource> resource = ShareableResource::create(*this);
if (!resource) {
@@ -89,9 +89,12 @@
}
RetainPtr<CFAllocatorRef> deallocator = adoptCF(createShareableResourceDeallocator(resource.get()));
- RetainPtr<CFDataRef> data = "" reinterpret_cast<const UInt8*>(resource->data()), static_cast<CFIndex>(resource->size()), deallocator.get()));
+ return std::move(adoptCF(CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, reinterpret_cast<const UInt8*>(resource->data()), static_cast<CFIndex>(resource->size()), deallocator.get())));
+}
- return SharedBuffer::wrapCFData(data.get());
+PassRefPtr<SharedBuffer> ShareableResource::Handle::tryWrapInSharedBuffer() const
+{
+ return SharedBuffer::wrapCFData(tryWrapInCFData().get());
}
PassRefPtr<ShareableResource> ShareableResource::create(PassRefPtr<SharedMemory> sharedMemory, unsigned offset, unsigned size)
Modified: trunk/Source/WebKit2/Shared/ShareableResource.h (169232 => 169233)
--- trunk/Source/WebKit2/Shared/ShareableResource.h 2014-05-23 00:39:36 UTC (rev 169232)
+++ trunk/Source/WebKit2/Shared/ShareableResource.h 2014-05-23 00:40:23 UTC (rev 169233)
@@ -33,7 +33,9 @@
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
+#include <wtf/RetainPtr.h>
+
namespace WebCore {
class SharedBuffer;
}
@@ -54,6 +56,9 @@
void encode(IPC::ArgumentEncoder&) const;
static bool decode(IPC::ArgumentDecoder&, Handle&);
+#if USE(CF)
+ RetainPtr<CFDataRef> tryWrapInCFData() const;
+#endif
PassRefPtr<WebCore::SharedBuffer> tryWrapInSharedBuffer() const;
private:
Modified: trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp (169232 => 169233)
--- trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp 2014-05-23 00:39:36 UTC (rev 169232)
+++ trunk/Source/WebKit2/WebProcess/Network/WebResourceLoader.cpp 2014-05-23 00:40:23 UTC (rev 169233)
@@ -178,6 +178,19 @@
{
LOG(Network, "(WebProcess) WebResourceLoader::didReceiveResource for '%s'", m_coreLoader->url().string().utf8().data());
+#if USE(QUICK_LOOK)
+ if (m_quickLookHandle) {
+ RetainPtr<CFDataRef> cfBuffer = handle.tryWrapInCFData();
+ if (cfBuffer) {
+ if (m_quickLookHandle->didReceiveData(cfBuffer.get())) {
+ m_quickLookHandle->didFinishLoading();
+ return;
+ }
+ } else
+ m_quickLookHandle->didFail();
+ }
+#endif
+
RefPtr<SharedBuffer> buffer = handle.tryWrapInSharedBuffer();
if (!buffer) {
LOG_ERROR("Unable to create buffer from ShareableResource sent from the network process.");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes