Title: [218107] trunk/Source/WebKit2
Revision
218107
Author
[email protected]
Date
2017-06-12 10:19:22 -0700 (Mon, 12 Jun 2017)

Log Message

Add API::IconDatabaseClient
https://bugs.webkit.org/show_bug.cgi?id=173145

Reviewed by Alex Christensen.

It will be used by GTK+ port instead of the C API.

* UIProcess/API/APIIconDatabaseClient.h:
(API::IconDatabaseClient::~IconDatabaseClient):
(API::IconDatabaseClient::didChangeIconForPageURL):
(API::IconDatabaseClient::didRemoveAllIcons):
(API::IconDatabaseClient::iconDataReadyForPageURL):
* UIProcess/API/C/WKIconDatabase.cpp:
(WKIconDatabaseSetIconDatabaseClient):
* UIProcess/WebIconDatabase.cpp:
(WebKit::WebIconDatabase::WebIconDatabase):
(WebKit::WebIconDatabase::setClient):
(WebKit::WebIconDatabase::didChangeIconForPageURL):
(WebKit::WebIconDatabase::didRemoveAllIcons):
(WebKit::WebIconDatabase::notifyIconDataReadyForPageURL):
* UIProcess/WebIconDatabase.h:
* UIProcess/WebIconDatabaseClient.cpp:
(WebKit::WebIconDatabaseClient::WebIconDatabaseClient):
(WebKit::WebIconDatabaseClient::didChangeIconForPageURL):
(WebKit::WebIconDatabaseClient::didRemoveAllIcons):
(WebKit::WebIconDatabaseClient::iconDataReadyForPageURL):
* UIProcess/WebIconDatabaseClient.h:
* WebKit2.xcodeproj/project.pbxproj:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (218106 => 218107)


--- trunk/Source/WebKit2/ChangeLog	2017-06-12 17:10:54 UTC (rev 218106)
+++ trunk/Source/WebKit2/ChangeLog	2017-06-12 17:19:22 UTC (rev 218107)
@@ -1,5 +1,36 @@
 2017-06-12  Carlos Garcia Campos  <[email protected]>
 
+        Add API::IconDatabaseClient
+        https://bugs.webkit.org/show_bug.cgi?id=173145
+
+        Reviewed by Alex Christensen.
+
+        It will be used by GTK+ port instead of the C API.
+
+        * UIProcess/API/APIIconDatabaseClient.h:
+        (API::IconDatabaseClient::~IconDatabaseClient):
+        (API::IconDatabaseClient::didChangeIconForPageURL):
+        (API::IconDatabaseClient::didRemoveAllIcons):
+        (API::IconDatabaseClient::iconDataReadyForPageURL):
+        * UIProcess/API/C/WKIconDatabase.cpp:
+        (WKIconDatabaseSetIconDatabaseClient):
+        * UIProcess/WebIconDatabase.cpp:
+        (WebKit::WebIconDatabase::WebIconDatabase):
+        (WebKit::WebIconDatabase::setClient):
+        (WebKit::WebIconDatabase::didChangeIconForPageURL):
+        (WebKit::WebIconDatabase::didRemoveAllIcons):
+        (WebKit::WebIconDatabase::notifyIconDataReadyForPageURL):
+        * UIProcess/WebIconDatabase.h:
+        * UIProcess/WebIconDatabaseClient.cpp:
+        (WebKit::WebIconDatabaseClient::WebIconDatabaseClient):
+        (WebKit::WebIconDatabaseClient::didChangeIconForPageURL):
+        (WebKit::WebIconDatabaseClient::didRemoveAllIcons):
+        (WebKit::WebIconDatabaseClient::iconDataReadyForPageURL):
+        * UIProcess/WebIconDatabaseClient.h:
+        * WebKit2.xcodeproj/project.pbxproj:
+
+2017-06-12  Carlos Garcia Campos  <[email protected]>
+
         [GTK] Stop dismissing menus attached to the web view for every injected event
         https://bugs.webkit.org/show_bug.cgi?id=172708
 

Copied: trunk/Source/WebKit2/UIProcess/API/APIIconDatabaseClient.h (from rev 218106, trunk/Source/WebKit2/UIProcess/WebIconDatabaseClient.h) (0 => 218107)


--- trunk/Source/WebKit2/UIProcess/API/APIIconDatabaseClient.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/APIIconDatabaseClient.h	2017-06-12 17:19:22 UTC (rev 218107)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#pragma once
+
+#include <wtf/Forward.h>
+
+namespace WebKit {
+class WebIconDatabase;
+}
+
+namespace API {
+
+class IconDatabaseClient {
+public:
+    virtual ~IconDatabaseClient() { }
+
+    virtual void didChangeIconForPageURL(WebKit::WebIconDatabase&, const WTF::String&) { };
+    virtual void didRemoveAllIcons(WebKit::WebIconDatabase&) { };
+    virtual void iconDataReadyForPageURL(WebKit::WebIconDatabase&, const WTF::String&) { };
+};
+
+} // namespace API

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp (218106 => 218107)


--- trunk/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp	2017-06-12 17:10:54 UTC (rev 218106)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp	2017-06-12 17:19:22 UTC (rev 218107)
@@ -29,6 +29,7 @@
 #include "APIData.h"
 #include "WKAPICast.h"
 #include "WebIconDatabase.h"
+#include "WebIconDatabaseClient.h"
 
 using namespace WebKit;
 
@@ -39,7 +40,7 @@
 
 void WKIconDatabaseSetIconDatabaseClient(WKIconDatabaseRef iconDatabaseRef, const WKIconDatabaseClientBase* wkClient)
 {
-    toImpl(iconDatabaseRef)->initializeIconDatabaseClient(wkClient);
+    toImpl(iconDatabaseRef)->setClient(std::make_unique<WebIconDatabaseClient>(wkClient));
 }
 
 void WKIconDatabaseRetainIconForURL(WKIconDatabaseRef iconDatabaseRef, WKURLRef pageURLRef)

Modified: trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp (218106 => 218107)


--- trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp	2017-06-12 17:10:54 UTC (rev 218106)
+++ trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp	2017-06-12 17:19:22 UTC (rev 218107)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "WebIconDatabase.h"
 
+#include "APIIconDatabaseClient.h"
 #include "Logging.h"
 #include "WebIconDatabaseMessages.h"
 #include "WebIconDatabaseProxyMessages.h"
@@ -53,6 +54,7 @@
     , m_urlImportCompleted(false)
     , m_databaseCleanupDisabled(false)
     , m_shouldDerefWhenAppropriate(false)
+    , m_client(std::make_unique<API::IconDatabaseClient>())
 {
     m_processPool->addMessageReceiver(Messages::WebIconDatabase::messageReceiverName(), *this);
 }
@@ -233,9 +235,12 @@
         m_iconDatabaseImpl->close();
 }
 
-void WebIconDatabase::initializeIconDatabaseClient(const WKIconDatabaseClientBase* client)
+void WebIconDatabase::setClient(std::unique_ptr<API::IconDatabaseClient> client)
 {
-    m_iconDatabaseClient.initialize(client);
+    if (!client)
+        m_client = std::make_unique<API::IconDatabaseClient>();
+    else
+        m_client = WTFMove(client);
 }
 
 // WebCore::IconDatabaseClient
@@ -252,12 +257,12 @@
 
 void WebIconDatabase::didChangeIconForPageURL(const String& pageURL)
 {
-    m_iconDatabaseClient.didChangeIconForPageURL(this, API::URL::create(pageURL).ptr());
+    m_client->didChangeIconForPageURL(*this, pageURL);
 }
 
 void WebIconDatabase::didRemoveAllIcons()
 {
-    m_iconDatabaseClient.didRemoveAllIcons(this);
+    m_client->didRemoveAllIcons(*this);
 }
 
 void WebIconDatabase::didFinishURLImport()
@@ -305,7 +310,7 @@
 
 void WebIconDatabase::notifyIconDataReadyForPageURL(const String& pageURL)
 {
-    m_iconDatabaseClient.iconDataReadyForPageURL(this, API::URL::create(pageURL).ptr());
+    m_client->iconDataReadyForPageURL(*this, pageURL);
     didChangeIconForPageURL(pageURL);
 }
 

Modified: trunk/Source/WebKit2/UIProcess/WebIconDatabase.h (218106 => 218107)


--- trunk/Source/WebKit2/UIProcess/WebIconDatabase.h	2017-06-12 17:10:54 UTC (rev 218106)
+++ trunk/Source/WebKit2/UIProcess/WebIconDatabase.h	2017-06-12 17:19:22 UTC (rev 218107)
@@ -35,6 +35,7 @@
 
 namespace API {
 class Data;
+class IconDatabaseClient;
 }
 
 namespace WebCore {
@@ -80,7 +81,7 @@
     void checkIntegrityBeforeOpening();
     void close();
 
-    void initializeIconDatabaseClient(const WKIconDatabaseClientBase*);
+    void setClient(std::unique_ptr<API::IconDatabaseClient>);
 
     void setPrivateBrowsingEnabled(bool);
 
@@ -114,7 +115,7 @@
     bool m_shouldDerefWhenAppropriate;
     HashMap<uint64_t, String> m_pendingLoadDecisionURLMap;
 
-    WebIconDatabaseClient m_iconDatabaseClient;
+    std::unique_ptr<API::IconDatabaseClient> m_client;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/WebIconDatabaseClient.cpp (218106 => 218107)


--- trunk/Source/WebKit2/UIProcess/WebIconDatabaseClient.cpp	2017-06-12 17:10:54 UTC (rev 218106)
+++ trunk/Source/WebKit2/UIProcess/WebIconDatabaseClient.cpp	2017-06-12 17:19:22 UTC (rev 218107)
@@ -32,28 +32,33 @@
 
 namespace WebKit {
 
-void WebIconDatabaseClient::didChangeIconForPageURL(WebIconDatabase* iconDatabase, API::URL* url)
+WebIconDatabaseClient::WebIconDatabaseClient(const WKIconDatabaseClientBase* wkClient)
 {
+    initialize(wkClient);
+}
+
+void WebIconDatabaseClient::didChangeIconForPageURL(WebIconDatabase& iconDatabase, const String& pageURL)
+{
     if (!m_client.didChangeIconForPageURL)
         return;
-    
-    m_client.didChangeIconForPageURL(toAPI(iconDatabase), toAPI(url), m_client.base.clientInfo);
+
+    m_client.didChangeIconForPageURL(toAPI(&iconDatabase), toAPI(API::URL::create(pageURL).ptr()), m_client.base.clientInfo);
 }
 
-void WebIconDatabaseClient::didRemoveAllIcons(WebIconDatabase* iconDatabase)
+void WebIconDatabaseClient::didRemoveAllIcons(WebIconDatabase& iconDatabase)
 {
     if (!m_client.didRemoveAllIcons)
         return;
-    
-    m_client.didRemoveAllIcons(toAPI(iconDatabase),  m_client.base.clientInfo);
+
+    m_client.didRemoveAllIcons(toAPI(&iconDatabase),  m_client.base.clientInfo);
 }
 
-void WebIconDatabaseClient::iconDataReadyForPageURL(WebIconDatabase* iconDatabase, API::URL* url)
+void WebIconDatabaseClient::iconDataReadyForPageURL(WebIconDatabase& iconDatabase, const String& pageURL)
 {
     if (!m_client.iconDataReadyForPageURL)
         return;
 
-    m_client.iconDataReadyForPageURL(toAPI(iconDatabase), toAPI(url), m_client.base.clientInfo);
+    m_client.iconDataReadyForPageURL(toAPI(&iconDatabase), toAPI(API::URL::create(pageURL).ptr()), m_client.base.clientInfo);
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/WebIconDatabaseClient.h (218106 => 218107)


--- trunk/Source/WebKit2/UIProcess/WebIconDatabaseClient.h	2017-06-12 17:10:54 UTC (rev 218106)
+++ trunk/Source/WebKit2/UIProcess/WebIconDatabaseClient.h	2017-06-12 17:19:22 UTC (rev 218107)
@@ -27,6 +27,7 @@
 #define WebIconDatabaseClient_h
 
 #include "APIClient.h"
+#include "APIIconDatabaseClient.h"
 #include "WKIconDatabase.h"
 
 namespace API {
@@ -40,11 +41,13 @@
 
 class WebIconDatabase;
 
-class WebIconDatabaseClient : public API::Client<WKIconDatabaseClientBase> {
+class WebIconDatabaseClient : public API::IconDatabaseClient, API::Client<WKIconDatabaseClientBase> {
 public:
-    void didChangeIconForPageURL(WebIconDatabase*, API::URL*);
-    void didRemoveAllIcons(WebIconDatabase*);
-    void iconDataReadyForPageURL(WebIconDatabase*, API::URL*);
+    explicit WebIconDatabaseClient(const WKIconDatabaseClientBase*);
+
+    void didChangeIconForPageURL(WebIconDatabase&, const String&) override;
+    void didRemoveAllIcons(WebIconDatabase&) override;
+    void iconDataReadyForPageURL(WebIconDatabase&, const String&) override;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (218106 => 218107)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2017-06-12 17:10:54 UTC (rev 218106)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2017-06-12 17:19:22 UTC (rev 218107)
@@ -1216,6 +1216,7 @@
 		7A821F4E1E2F67A800604577 /* LegacyCustomProtocolManagerClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7A821F4D1E2F679E00604577 /* LegacyCustomProtocolManagerClient.mm */; };
 		7A821F501E2F7A7500604577 /* APICustomProtocolManagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A821F4F1E2F7A5C00604577 /* APICustomProtocolManagerClient.h */; };
 		7AAD175F1EA6AF99003B0894 /* WebResourceLoadStatisticsStoreCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7AAD175E1EA6AF37003B0894 /* WebResourceLoadStatisticsStoreCocoa.mm */; };
+		7AB6EA451EEAAE3800037B2B /* APIIconDatabaseClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AB6EA441EEAAE2300037B2B /* APIIconDatabaseClient.h */; };
 		7AF236201E79A3E400438A05 /* WebErrors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AF2361E1E79A3B400438A05 /* WebErrors.cpp */; };
 		7AF236211E79A40800438A05 /* WebErrors.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF2361F1E79A3D800438A05 /* WebErrors.h */; };
 		7AF236231E79A44400438A05 /* WebErrorsCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7AF236221E79A43100438A05 /* WebErrorsCocoa.mm */; };
@@ -3502,6 +3503,7 @@
 		7A9CD8C11C77984900D9F6C7 /* WebResourceLoadStatisticsStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebResourceLoadStatisticsStore.h; sourceTree = "<group>"; };
 		7A9CD8C21C779AD600D9F6C7 /* WebResourceLoadStatisticsStore.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebResourceLoadStatisticsStore.messages.in; sourceTree = "<group>"; };
 		7AAD175E1EA6AF37003B0894 /* WebResourceLoadStatisticsStoreCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebResourceLoadStatisticsStoreCocoa.mm; sourceTree = "<group>"; };
+		7AB6EA441EEAAE2300037B2B /* APIIconDatabaseClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIIconDatabaseClient.h; sourceTree = "<group>"; };
 		7AF2361E1E79A3B400438A05 /* WebErrors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebErrors.cpp; sourceTree = "<group>"; };
 		7AF2361F1E79A3D800438A05 /* WebErrors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebErrors.h; sourceTree = "<group>"; };
 		7AF236221E79A43100438A05 /* WebErrorsCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebErrorsCocoa.mm; sourceTree = "<group>"; };
@@ -6869,6 +6871,7 @@
 				076E884D1A13CADF005E90FC /* APIContextMenuClient.h */,
 				7A821F4F1E2F7A5C00604577 /* APICustomProtocolManagerClient.h */,
 				83891B621A68B3420030F386 /* APIDiagnosticLoggingClient.h */,
+				7AB6EA441EEAAE2300037B2B /* APIIconDatabaseClient.h */,
 				1F7D36C018DA513F00D9D659 /* APIDownloadClient.h */,
 				317FE7C11C487A6600A0CA89 /* APIExperimentalFeature.cpp */,
 				317FE7C21C487A6600A0CA89 /* APIExperimentalFeature.h */,
@@ -8863,6 +8866,7 @@
 				1AB474DE184D44590051B622 /* WKBundlePageUIClient.h in Headers */,
 				BCF049E711FE20F600F86A58 /* WKBundlePrivate.h in Headers */,
 				BC60C5791240A546008C5E29 /* WKBundleRangeHandle.h in Headers */,
+				7AB6EA451EEAAE3800037B2B /* APIIconDatabaseClient.h in Headers */,
 				BC5D24C716CD73C5007D5461 /* WKBundleRangeHandlePrivate.h in Headers */,
 				BC14DF9F120B635F00826C0C /* WKBundleScriptWorld.h in Headers */,
 				BC4075F6124FF0270068F20A /* WKCertificateInfo.h in Headers */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to