Add a DownloadsProxyMap class in preparation for moving the downloads map away from...
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2012 18:47:59 +0000 (18:47 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Dec 2012 18:47:59 +0000 (18:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=104980

Reviewed by Andreas Kling.

Currently the DownloadProxyMap doesn't really do anything; this initial change is to make sure that
adding the new files won't break any builds.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* UIProcess/Downloads/DownloadProxyMap.cpp: Added.
(WebKit):
(WebKit::DownloadProxyMap::shared):
(WebKit::DownloadProxyMap::DownloadProxyMap):
(WebKit::DownloadProxyMap::~DownloadProxyMap):
(WebKit::DownloadProxyMap::createDownloadProxy):
* UIProcess/Downloads/DownloadProxyMap.h: Added.
(WebKit):
(DownloadProxyMap):
* UIProcess/WebContext.cpp:
(WebKit::WebContext::createDownloadProxy):
* WebKit2.xcodeproj/project.pbxproj:
* win/WebKit2.vcproj:

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

Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog
Source/WebKit2/GNUmakefile.list.am
Source/WebKit2/Target.pri
Source/WebKit2/UIProcess/Downloads/DownloadProxyMap.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/Downloads/DownloadProxyMap.h [new file with mode: 0644]
Source/WebKit2/UIProcess/WebContext.cpp
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/win/WebKit2.vcproj

index 243d90c..6b8ad82 100644 (file)
@@ -352,6 +352,7 @@ set(WebKit2_SOURCES
     UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp
 
     UIProcess/Downloads/DownloadProxy.cpp
+    UIProcess/Downloads/DownloadProxyMap.cpp
 
     UIProcess/InspectorServer/WebInspectorServer.cpp
     UIProcess/InspectorServer/WebSocketServer.cpp
index d1d8bb1..9b054d5 100644 (file)
@@ -1,5 +1,32 @@
 2012-12-14  Anders Carlsson  <andersca@apple.com>
 
+        Add a DownloadsProxyMap class in preparation for moving the downloads map away from WebContext
+        https://bugs.webkit.org/show_bug.cgi?id=104980
+
+        Reviewed by Andreas Kling.
+
+        Currently the DownloadProxyMap doesn't really do anything; this initial change is to make sure that
+        adding the new files won't break any builds.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * UIProcess/Downloads/DownloadProxyMap.cpp: Added.
+        (WebKit):
+        (WebKit::DownloadProxyMap::shared):
+        (WebKit::DownloadProxyMap::DownloadProxyMap):
+        (WebKit::DownloadProxyMap::~DownloadProxyMap):
+        (WebKit::DownloadProxyMap::createDownloadProxy):
+        * UIProcess/Downloads/DownloadProxyMap.h: Added.
+        (WebKit):
+        (DownloadProxyMap):
+        * UIProcess/WebContext.cpp:
+        (WebKit::WebContext::createDownloadProxy):
+        * WebKit2.xcodeproj/project.pbxproj:
+        * win/WebKit2.vcproj:
+
+2012-12-14  Anders Carlsson  <andersca@apple.com>
+
         Fix assertion failure when the network process is enabled
         https://bugs.webkit.org/show_bug.cgi?id=105040
         <rdar://problem/12883632>
index 6b6939b..4e3e6b9 100644 (file)
@@ -775,6 +775,8 @@ webkit2_sources += \
        Source/WebKit2/UIProcess/BackingStore.h \
        Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp \
        Source/WebKit2/UIProcess/Downloads/DownloadProxy.h \
+       Source/WebKit2/UIProcess/Downloads/DownloadProxyMap.cpp \
+       Source/WebKit2/UIProcess/Downloads/DownloadProxyMap.h \
        Source/WebKit2/UIProcess/DrawingAreaProxy.cpp \
        Source/WebKit2/UIProcess/DrawingAreaProxy.h \
        Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp \
index 5833896..464e9ea 100644 (file)
@@ -575,6 +575,7 @@ SOURCES += \
     UIProcess/CoordinatedGraphics/LayerTreeRenderer.cpp \
     UIProcess/DefaultUndoController.cpp \
     UIProcess/Downloads/DownloadProxy.cpp \
+    UIProcess/Downloads/DownloadProxyMap.cpp \
     UIProcess/DrawingAreaProxy.cpp \
     UIProcess/DrawingAreaProxyImpl.cpp \
     UIProcess/FindIndicator.cpp \
diff --git a/Source/WebKit2/UIProcess/Downloads/DownloadProxyMap.cpp b/Source/WebKit2/UIProcess/Downloads/DownloadProxyMap.cpp
new file mode 100644 (file)
index 0000000..880765d
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2012 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "DownloadProxyMap.h"
+
+#include "DownloadProxy.h"
+#include <wtf/StdLibExtras.h>
+
+namespace WebKit {
+
+DownloadProxyMap& DownloadProxyMap::shared()
+{
+    DEFINE_STATIC_LOCAL(DownloadProxyMap, downloadProxyMap, ());
+
+    return downloadProxyMap;
+}
+
+DownloadProxyMap::DownloadProxyMap()
+{
+}
+
+DownloadProxyMap::~DownloadProxyMap()
+{
+}
+
+PassRefPtr<DownloadProxy> DownloadProxyMap::createDownloadProxy(WebContext* webContext)
+{
+    RefPtr<DownloadProxy> downloadProxy = DownloadProxy::create(webContext);
+
+    return downloadProxy.release();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/Downloads/DownloadProxyMap.h b/Source/WebKit2/UIProcess/Downloads/DownloadProxyMap.h
new file mode 100644 (file)
index 0000000..8783c8a
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2012 Apple 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:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 DownloadProxyMap_h
+#define DownloadProxyMap_h
+
+#include <wtf/Noncopyable.h>
+#include <wtf/PassRefPtr.h>
+
+namespace WebKit {
+
+class DownloadProxy;
+class WebContext;
+
+class DownloadProxyMap {
+    WTF_MAKE_NONCOPYABLE(DownloadProxyMap);
+
+public:
+    static DownloadProxyMap& shared();
+
+    PassRefPtr<DownloadProxy> createDownloadProxy(WebContext*);
+
+private:
+    DownloadProxyMap();
+    ~DownloadProxyMap();
+};
+
+} // namespace WebKit
+
+#endif // DownloadProxyMap_h
index c249ad6..39fdaf2 100644 (file)
@@ -27,6 +27,7 @@
 #include "WebContext.h"
 
 #include "DownloadProxy.h"
+#include "DownloadProxyMap.h"
 #include "DownloadProxyMessages.h"
 #include "ImmutableArray.h"
 #include "Logging.h"
@@ -835,7 +836,7 @@ void WebContext::addVisitedLinkHash(LinkHash linkHash)
 
 DownloadProxy* WebContext::createDownloadProxy()
 {
-    RefPtr<DownloadProxy> downloadProxy = DownloadProxy::create(this);
+    RefPtr<DownloadProxy> downloadProxy = DownloadProxyMap::shared().createDownloadProxy(this);
     m_downloads.set(downloadProxy->downloadID(), downloadProxy);
     addMessageReceiver(Messages::DownloadProxy::messageReceiverName(), downloadProxy->downloadID(), this);
     return downloadProxy.get();
index c4e0a78..228471e 100644 (file)
                1AC86FF4130B46D3002C1257 /* WKPluginSiteDataManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC86FF2130B46D3002C1257 /* WKPluginSiteDataManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1AC8702D130B49A2002C1257 /* WebPluginSiteDataManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC8702B130B49A2002C1257 /* WebPluginSiteDataManager.h */; };
                1AC8702E130B49A2002C1257 /* WebPluginSiteDataManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC8702C130B49A2002C1257 /* WebPluginSiteDataManager.cpp */; };
+               1AD25E95167AB08100EA9BCD /* DownloadProxyMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AD25E93167AB08100EA9BCD /* DownloadProxyMap.cpp */; };
+               1AD25E96167AB08100EA9BCD /* DownloadProxyMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD25E94167AB08100EA9BCD /* DownloadProxyMap.h */; };
                1AE117F611DBB30900981615 /* ProcessLauncher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE117F511DBB30900981615 /* ProcessLauncher.cpp */; };
                1AE4976811FF658E0048B464 /* NPJSObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AE4976611FF658E0048B464 /* NPJSObject.h */; };
                1AE4976911FF658E0048B464 /* NPJSObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE4976711FF658E0048B464 /* NPJSObject.cpp */; };
                1AC86FF2130B46D3002C1257 /* WKPluginSiteDataManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPluginSiteDataManager.h; sourceTree = "<group>"; };
                1AC8702B130B49A2002C1257 /* WebPluginSiteDataManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginSiteDataManager.h; sourceTree = "<group>"; };
                1AC8702C130B49A2002C1257 /* WebPluginSiteDataManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPluginSiteDataManager.cpp; sourceTree = "<group>"; };
+               1AD25E93167AB08100EA9BCD /* DownloadProxyMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DownloadProxyMap.cpp; sourceTree = "<group>"; };
+               1AD25E94167AB08100EA9BCD /* DownloadProxyMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DownloadProxyMap.h; sourceTree = "<group>"; };
                1AE117F511DBB30900981615 /* ProcessLauncher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProcessLauncher.cpp; sourceTree = "<group>"; };
                1AE4976611FF658E0048B464 /* NPJSObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NPJSObject.h; sourceTree = "<group>"; };
                1AE4976711FF658E0048B464 /* NPJSObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NPJSObject.cpp; sourceTree = "<group>"; };
                                1AB7D4C91288AAA700CFD08C /* DownloadProxy.cpp */,
                                1AB7D4C81288AAA700CFD08C /* DownloadProxy.h */,
                                1AB7D5E91288B8C000CFD08C /* DownloadProxy.messages.in */,
+                               1AD25E93167AB08100EA9BCD /* DownloadProxyMap.cpp */,
+                               1AD25E94167AB08100EA9BCD /* DownloadProxyMap.h */,
                        );
                        path = Downloads;
                        sourceTree = "<group>";
                                E1513C67166EABB200149FCB /* ChildProcessProxy.h in Headers */,
                                31A67E0D165B2A99006CBA66 /* PlugInAutoStartProvider.h in Headers */,
                                31D5929F166E060000E6BF02 /* WebPlugInClient.h in Headers */,
+                               1AD25E96167AB08100EA9BCD /* DownloadProxyMap.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                E1513C66166EABB200149FCB /* ChildProcessProxy.cpp in Sources */,
                                31A67E0C165B2A99006CBA66 /* PlugInAutoStartProvider.cpp in Sources */,
                                31D5929E166E060000E6BF02 /* WebPlugInClient.cpp in Sources */,
+                               1AD25E95167AB08100EA9BCD /* DownloadProxyMap.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 63e5b99..7e4f290 100755 (executable)
                                        >
                                </File>
                                <File
+                                       RelativePath="..\UIProcess\Downloads\DownloadProxyMap.cpp"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\UIProcess\Downloads\DownloadProxyMap.h"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\UIProcess\Downloads\DownloadProxy.messages.in"
                                        >
                                </File>