Title: [112563] trunk/Source
Revision
112563
Author
[email protected]
Date
2012-03-29 12:48:21 -0700 (Thu, 29 Mar 2012)

Log Message

Source/Platform: [Chromium] Move createURLLoader() into Platform
https://bugs.webkit.org/show_bug.cgi?id=82587

Reviewed by James Robinson.

This patch introduces a base class for WebKitPlatformSupport that we
can use to incrementally more APIs from WebKit/chromium/public/platform
into Platform/chromium/public. Using this technique lets us avoid
making changes in the embedder during the transition.

This patch moves createURLLoader() because it's necessary for
ResourceHandle.  This is the third patch in this sequence:
https://github.com/abarth/webkit/compare/master...webcore-platform

* Platform.gypi:
* chromium/public/Platform.h: Added.
(WebKit):
(Platform):
(WebKit::Platform::createURLLoader):
(WebKit::Platform::~Platform):
* chromium/src/Platform.cpp: Added.
(WebKit):
(WebKit::Platform::initialize):
(WebKit::Platform::shutdown):
(WebKit::Platform::current):

Source/WebKit/chromium: Move createURLLoader() into Platform
https://bugs.webkit.org/show_bug.cgi?id=82587

Reviewed by James Robinson.

* public/platform/WebKitPlatformSupport.h:
(WebKit):
(WebKitPlatformSupport):
* src/WebKit.cpp:
(WebKit::initializeWithoutV8):
(WebKit::shutdown):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (112562 => 112563)


--- trunk/Source/Platform/ChangeLog	2012-03-29 19:37:43 UTC (rev 112562)
+++ trunk/Source/Platform/ChangeLog	2012-03-29 19:48:21 UTC (rev 112563)
@@ -1,3 +1,31 @@
+2012-03-29  Adam Barth  <[email protected]>
+
+        [Chromium] Move createURLLoader() into Platform
+        https://bugs.webkit.org/show_bug.cgi?id=82587
+
+        Reviewed by James Robinson.
+
+        This patch introduces a base class for WebKitPlatformSupport that we
+        can use to incrementally more APIs from WebKit/chromium/public/platform
+        into Platform/chromium/public. Using this technique lets us avoid
+        making changes in the embedder during the transition.
+
+        This patch moves createURLLoader() because it's necessary for
+        ResourceHandle.  This is the third patch in this sequence:
+        https://github.com/abarth/webkit/compare/master...webcore-platform
+
+        * Platform.gypi:
+        * chromium/public/Platform.h: Added.
+        (WebKit):
+        (Platform):
+        (WebKit::Platform::createURLLoader):
+        (WebKit::Platform::~Platform):
+        * chromium/src/Platform.cpp: Added.
+        (WebKit):
+        (WebKit::Platform::initialize):
+        (WebKit::Platform::shutdown):
+        (WebKit::Platform::current):
+
 2012-03-28  Adam Barth  <[email protected]>
 
         [Chromium] Move APIs related to ResourceHandle into Platform

Modified: trunk/Source/Platform/Platform.gypi (112562 => 112563)


--- trunk/Source/Platform/Platform.gypi	2012-03-29 19:37:43 UTC (rev 112562)
+++ trunk/Source/Platform/Platform.gypi	2012-03-29 19:48:21 UTC (rev 112563)
@@ -31,6 +31,7 @@
 {
     'variables': {
         'platform_files': [
+            'chromium/public/Platform.h',
             'chromium/public/WebCString.h',
             'chromium/public/WebCanvas.h',
             'chromium/public/WebColor.h',
@@ -65,6 +66,7 @@
             'chromium/public/WebURLLoaderClient.h',
             'chromium/public/WebURLRequest.h',
             'chromium/public/WebURLResponse.h',
+            'chromium/src/Platform.cpp',
             'chromium/src/WebCString.cpp',
             'chromium/src/WebFloatQuad.cpp',
             'chromium/src/WebString.cpp',

Added: trunk/Source/Platform/chromium/public/Platform.h (0 => 112563)


--- trunk/Source/Platform/chromium/public/Platform.h	                        (rev 0)
+++ trunk/Source/Platform/chromium/public/Platform.h	2012-03-29 19:48:21 UTC (rev 112563)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef Platform_h
+#define Platform_h
+
+#include "WebCommon.h"
+
+namespace WebKit {
+
+class WebURLLoader;
+
+class Platform {
+public:
+    WEBKIT_EXPORT static void initialize(Platform*);
+    WEBKIT_EXPORT static void shutdown();
+    WEBKIT_EXPORT static Platform* current();
+
+    // Network -------------------------------------------------------------
+
+    // Returns a new WebURLLoader instance.
+    virtual WebURLLoader* createURLLoader() { return 0; }
+
+protected:
+    ~Platform() { }
+};
+
+} // namespace WebKit
+
+#endif

Added: trunk/Source/Platform/chromium/src/Platform.cpp (0 => 112563)


--- trunk/Source/Platform/chromium/src/Platform.cpp	                        (rev 0)
+++ trunk/Source/Platform/chromium/src/Platform.cpp	2012-03-29 19:48:21 UTC (rev 112563)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include <public/Platform.h>
+
+namespace WebKit {
+
+static Platform* s_platform = 0;
+
+void Platform::initialize(Platform* platform)
+{
+    s_platform = platform;
+}
+
+void Platform::shutdown()
+{
+    s_platform = 0;
+}
+
+Platform* Platform::current()
+{
+    return s_platform;
+}
+
+} // namespace WebKit

Modified: trunk/Source/WebKit/chromium/ChangeLog (112562 => 112563)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-29 19:37:43 UTC (rev 112562)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-29 19:48:21 UTC (rev 112563)
@@ -1,3 +1,17 @@
+2012-03-29  Adam Barth  <[email protected]>
+
+        Move createURLLoader() into Platform
+        https://bugs.webkit.org/show_bug.cgi?id=82587
+
+        Reviewed by James Robinson.
+
+        * public/platform/WebKitPlatformSupport.h:
+        (WebKit):
+        (WebKitPlatformSupport):
+        * src/WebKit.cpp:
+        (WebKit::initializeWithoutV8):
+        (WebKit::shutdown):
+
 2012-03-29  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r112553.

Modified: trunk/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h (112562 => 112563)


--- trunk/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h	2012-03-29 19:37:43 UTC (rev 112562)
+++ trunk/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h	2012-03-29 19:48:21 UTC (rev 112563)
@@ -42,8 +42,8 @@
 #include "WebString.h"
 #include "WebURL.h"
 #include "WebVector.h"
-
 #include <time.h>
+#include "../../../../Platform/chromium/public/Platform.h"
 
 #ifdef WIN32
 typedef void *HANDLE;
@@ -75,10 +75,10 @@
 class WebStorageNamespace; // FIXME: Does this belong in platform?
 class WebThemeEngine;
 class WebThread;
-class WebURLLoader;
 class WebWorkerRunLoop;
 
-class WebKitPlatformSupport {
+// FIXME: Eventually all these API will need to move to WebKit::Platform.
+class WebKitPlatformSupport : public Platform {
 public:
     // Must return non-null.
     virtual WebClipboard* clipboard() { return 0; }
@@ -216,9 +216,6 @@
     // A suggestion to prefetch IP information for the given hostname.
     virtual void prefetchHostName(const WebString&) { }
 
-    // Returns a new WebURLLoader instance.
-    virtual WebURLLoader* createURLLoader() { return 0; }
-
     // Returns a new WebSocketStreamHandle instance.
     virtual WebSocketStreamHandle* createSocketStreamHandle() { return 0; }
 

Modified: trunk/Source/WebKit/chromium/src/WebKit.cpp (112562 => 112563)


--- trunk/Source/WebKit/chromium/src/WebKit.cpp	2012-03-29 19:37:43 UTC (rev 112562)
+++ trunk/Source/WebKit/chromium/src/WebKit.cpp	2012-03-29 19:48:21 UTC (rev 112563)
@@ -38,22 +38,22 @@
 #include "TextEncoding.h"
 #include "V8Binding.h"
 #include "WebKitMutationObserver.h"
-#include "platform/WebKitPlatformSupport.h"
 #include "WebMediaPlayerClientImpl.h"
 #include "WebSocket.h"
+#include "WorkerContextExecutionProxy.h"
+#include "platform/WebKitPlatformSupport.h"
 #include "platform/WebThread.h"
-#include "WorkerContextExecutionProxy.h"
 #include "v8.h"
+#include <public/Platform.h>
+#include <wtf/Assertions.h>
+#include <wtf/MainThread.h>
+#include <wtf/Threading.h>
+#include <wtf/text/AtomicString.h>
 
 #if OS(DARWIN)
 #include "WebSystemInterface.h"
 #endif
 
-#include <wtf/Assertions.h>
-#include <wtf/MainThread.h>
-#include <wtf/Threading.h>
-#include <wtf/text/AtomicString.h>
-
 namespace WebKit {
 
 #if ENABLE(MUTATION_OBSERVERS)
@@ -118,6 +118,7 @@
     ASSERT(webKitPlatformSupport);
     ASSERT(!s_webKitPlatformSupport);
     s_webKitPlatformSupport = webKitPlatformSupport;
+    Platform::initialize(s_webKitPlatformSupport);
 
     WTF::initializeThreading();
     WTF::initializeMainThread();
@@ -145,6 +146,7 @@
     }
 #endif
     s_webKitPlatformSupport = 0;
+    Platform::shutdown();
 }
 
 WebKitPlatformSupport* webKitPlatformSupport()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to