Implement encoding/decoding of ResourceRequest and
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Dec 2010 00:37:33 +0000 (00:37 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Dec 2010 00:37:33 +0000 (00:37 +0000)
ResourceResponse for Windows/CFNetwork.

Reviewed by Anders Carlsson.

* Shared/win/WebCoreArgumentCodersWin.cpp:
(CoreIPC::encodeResourceRequest):
(CoreIPC::decodeResourceRequest):
(CoreIPC::encodeResourceResponse):
(CoreIPC::decodeResourceResponse):
* win/WebKit2.vcproj:
* win/WebKit2Common.vsprops:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@74436 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit2/ChangeLog
WebKit2/Shared/win/WebCoreArgumentCodersWin.cpp
WebKit2/win/WebKit2.vcproj
WebKit2/win/WebKit2Common.vsprops

index a4e31eb7b9b3241ac511498bf4870450da3f6c3c..1a800ba43e9a533a97510f8f8571287848d38b49 100644 (file)
@@ -1,3 +1,18 @@
+2010-12-21  Sam Weinig  <weinig@apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        Implement encoding/decoding of ResourceRequest and 
+        ResourceResponse for Windows/CFNetwork.
+
+        * Shared/win/WebCoreArgumentCodersWin.cpp:
+        (CoreIPC::encodeResourceRequest):
+        (CoreIPC::decodeResourceRequest):
+        (CoreIPC::encodeResourceResponse):
+        (CoreIPC::decodeResourceResponse):
+        * win/WebKit2.vcproj:
+        * win/WebKit2Common.vsprops:
+
 2010-12-21  Darin Adler  <darin@apple.com>
 
         Reviewed by Sam Weinig.
index 81d400e978e12eb7f2eaf6ea1ab5e9c9df34f4ac..95d7de25fa10e1c4cef40cb5d6e9e4120d946609 100644 (file)
 
 #include "WebCoreArgumentCoders.h"
 
-#include "NotImplemented.h"
+#if USE(CFNETWORK)
+#include "ArgumentCodersCF.h"
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
+#endif
 
 namespace CoreIPC {
 
+// FIXME: These coders should really go in a WebCoreArgumentCodersCFNetwork file.
+
 void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest)
 {
-    notImplemented();
+#if USE(CFNETWORK)
+    RetainPtr<CFDictionaryRef> dictionary(AdoptCF, wkCFURLRequestCreateSerializableRepresentation(resourceRequest.cfURLRequest(), CoreIPC::tokenNullTypeRef()));
+    encode(encoder, dictionary.get());
+#endif
 }
 
 bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest)
 {
-    notImplemented();
+#if USE(CFNETWORK)
+    RetainPtr<CFDictionaryRef> dictionary;
+    if (!decode(decoder, dictionary))
+        return false;
+
+    CFURLRequestRef cfURLRequest = wkCFURLRequestCreateFromSerializableRepresentation(dictionary.get(), CoreIPC::tokenNullTypeRef());
+    if (!cfURLRequest)
+        return false;
+
+    resourceRequest = WebCore::ResourceRequest(cfURLRequest);
+    return true;
+#else
     return false;
+#endif
 }
 
 void encodeResourceResponse(ArgumentEncoder* encoder, const WebCore::ResourceResponse& resourceResponse)
 {
-    notImplemented();
+#if USE(CFNETWORK)
+    bool responseIsPresent = resourceResponse.cfURLResponse();
+    encoder->encode(responseIsPresent);
+
+    if (!responseIsPresent)
+        return;
+
+    RetainPtr<CFDictionaryRef> dictionary(AdoptCF, wkCFURLResponseCreateSerializableRepresentation(resourceResponse.cfURLResponse(), CoreIPC::tokenNullTypeRef()));
+    encode(encoder, dictionary.get());
+#endif
 }
 
 bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse& resourceResponse)
 {
-    notImplemented();
+#if USE(CFNETWORK)
+    bool responseIsPresent;
+    decoder->decode(responseIsPresent);
+
+    if (!responseIsPresent) {
+        resourceResponse = WebCore::ResourceResponse();
+        return true;
+    }
+
+    RetainPtr<CFDictionaryRef> dictionary;
+    if (!decode(decoder, dictionary))
+        return false;
+
+    CFURLResponseRef cfURLResponse = wkCFURLResponseCreateFromSerializableRepresentation(dictionary.get(), CoreIPC::tokenNullTypeRef());
+    if (!cfURLResponse)
+        return false;
+
+    resourceResponse = WebCore::ResourceResponse(cfURLResponse);
+    return true;
+#else
     return false;
+#endif
 }
 
 } // namespace CoreIPC
index 21d72a4370c01af28bdb507851ccd78ed141976d..a2a991a8d1bbfcc8cf92c7f2a814002b03bafcbb 100755 (executable)
                                        >
                                </File>
                        </Filter>
+                       <Filter
+                               Name="cf"
+                               >
+                               <File
+                                       RelativePath="..\Shared\cf\ArgumentCodersCF.cpp"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\Shared\cf\ArgumentCodersCF.h"
+                                       >
+                               </File>
+                       </Filter>
                        <Filter
                                Name="win"
                                >
index a8b8e1241942b13276aedd86475be97c1bb107c6..7993908f5f88b12338bc1f6edffc3d52dc6df3ba 100755 (executable)
@@ -6,7 +6,7 @@
        >
        <Tool
                Name="VCCLCompilerTool"
-               AdditionalIncludeDirectories="&quot;$(ProjectDir)\..\Platform&quot;;&quot;$(ProjectDir)\..\Platform\CoreIPC&quot;;&quot;$(ProjectDir)\..\PluginProcess&quot;;&quot;$(ProjectDir)\..\Shared&quot;;&quot;$(ProjectDir)\..\Shared\win&quot;;&quot;$(ProjectDir)\..\Shared\API\c&quot;;&quot;$(ProjectDir)\..\Shared\API\c\cf&quot;;&quot;$(ProjectDir)\..\Shared\API\c\win&quot;;&quot;$(ProjectDir)\..\Shared\CoreIPCSupport&quot;;&quot;$(ProjectDir)\..\Shared\Plugins&quot;;&quot;$(ProjectDir)\..\Shared\Plugins\Netscape&quot;;&quot;$(ProjectDir)\..\UIProcess&quot;;&quot;$(ProjectDir)\..\UIProcess\API\C&quot;;&quot;$(ProjectDir)\..\UIProcess\API\C\win&quot;;&quot;$(ProjectDir)\..\UIProcess\API\cpp&quot;;&quot;$(ProjectDir)\..\UIProcess\API\win&quot;;&quot;$(ProjectDir)\..\UIProcess\Authentication&quot;;&quot;$(ProjectDir)\..\UIProcess\Downloads&quot;;&quot;$(ProjectDir)\..\UIProcess\Launcher&quot;;&quot;$(ProjectDir)\..\UIProcess\Plugins&quot;;&quot;$(ProjectDir)\..\UIProcess\win&quot;;&quot;$(ProjectDir)\..\WebProcess&quot;;&quot;$(ProjectDir)\..\WebProcess\WebCoreSupport&quot;;&quot;$(ProjectDir)\..\WebProcess\WebCoreSupport\win&quot;;&quot;$(ProjectDir)\..\WebProcess\WebPage&quot;;&quot;$(ProjectDir)\..\WebProcess\WebPage\win&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\API\c&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\DOM&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\win&quot;;&quot;$(ProjectDir)\..\WebProcess\Plugins&quot;;&quot;$(ProjectDir)\..\WebProcess\Plugins\Netscape&quot;;&quot;$(ProjectDir)\..\WebProcess\win&quot;;&quot;$(ProjectDir)\..\WebProcess\Authentication&quot;;&quot;$(ProjectDir)\..\WebProcess\Downloads&quot;;&quot;$(ProjectDir)\..\WebProcess\Downloads\cf&quot;;&quot;$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\Include&quot;;&quot;$(WebKitLibrariesDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\Include\pthreads&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\private\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders&quot;"
+               AdditionalIncludeDirectories="&quot;$(ProjectDir)\..\Platform&quot;;&quot;$(ProjectDir)\..\Platform\CoreIPC&quot;;&quot;$(ProjectDir)\..\PluginProcess&quot;;&quot;$(ProjectDir)\..\Shared&quot;;&quot;$(ProjectDir)\..\Shared\win&quot;;&quot;$(ProjectDir)\..\Shared\cf&quot;;&quot;$(ProjectDir)\..\Shared\API\c&quot;;&quot;$(ProjectDir)\..\Shared\API\c\cf&quot;;&quot;$(ProjectDir)\..\Shared\API\c\win&quot;;&quot;$(ProjectDir)\..\Shared\CoreIPCSupport&quot;;&quot;$(ProjectDir)\..\Shared\Plugins&quot;;&quot;$(ProjectDir)\..\Shared\Plugins\Netscape&quot;;&quot;$(ProjectDir)\..\UIProcess&quot;;&quot;$(ProjectDir)\..\UIProcess\API\C&quot;;&quot;$(ProjectDir)\..\UIProcess\API\C\win&quot;;&quot;$(ProjectDir)\..\UIProcess\API\cpp&quot;;&quot;$(ProjectDir)\..\UIProcess\API\win&quot;;&quot;$(ProjectDir)\..\UIProcess\Authentication&quot;;&quot;$(ProjectDir)\..\UIProcess\Downloads&quot;;&quot;$(ProjectDir)\..\UIProcess\Launcher&quot;;&quot;$(ProjectDir)\..\UIProcess\Plugins&quot;;&quot;$(ProjectDir)\..\UIProcess\win&quot;;&quot;$(ProjectDir)\..\WebProcess&quot;;&quot;$(ProjectDir)\..\WebProcess\WebCoreSupport&quot;;&quot;$(ProjectDir)\..\WebProcess\WebCoreSupport\win&quot;;&quot;$(ProjectDir)\..\WebProcess\WebPage&quot;;&quot;$(ProjectDir)\..\WebProcess\WebPage\win&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\API\c&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\DOM&quot;;&quot;$(ProjectDir)\..\WebProcess\InjectedBundle\win&quot;;&quot;$(ProjectDir)\..\WebProcess\Plugins&quot;;&quot;$(ProjectDir)\..\WebProcess\Plugins\Netscape&quot;;&quot;$(ProjectDir)\..\WebProcess\win&quot;;&quot;$(ProjectDir)\..\WebProcess\Authentication&quot;;&quot;$(ProjectDir)\..\WebProcess\Downloads&quot;;&quot;$(ProjectDir)\..\WebProcess\Downloads\cf&quot;;&quot;$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources&quot;;&quot;$(WebKitOutputDir)\Include&quot;;&quot;$(WebKitOutputDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\Include&quot;;&quot;$(WebKitLibrariesDir)\Include\private&quot;;&quot;$(WebKitLibrariesDir)\Include\pthreads&quot;;&quot;$(WebKitOutputDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\Include\private\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders&quot;"
                PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;BUILDING_WEBKIT"
                UsePrecompiledHeader="2"
                PrecompiledHeaderThrough="WebKit2Prefix.h"