- Revision
- 129742
- Author
- [email protected]
- Date
- 2012-09-27 02:24:59 -0700 (Thu, 27 Sep 2012)
Log Message
[WK2] IconDatabase: Add a way to notify when icon data is available
https://bugs.webkit.org/show_bug.cgi?id=63945
Reviewed by Anders Carlsson.
Provide new API to notify the API layer when icon data is
available, and use it from the implementation layer when needed,
that is, either when the data has been loaded from the network or
imported from disk.
Added new callback to WKIconDatabaseClient API.
* UIProcess/API/C/WKIconDatabase.h: Added new callback.
* UIProcess/WebIconDatabaseClient.cpp:
(WebKit::WebIconDatabaseClient::iconDataReadyForPageURL):
Implementation of the new callback at this level in the UI
process, by using its implementation in the API layer if present.
* UIProcess/WebIconDatabaseClient.h:
(WebIconDatabaseClient): Added new callback.
Implemented WebFrameLoaderClient::dispatchDidReceiveIcon, so we
get notified in the UI process when loading a new icon.
* UIProcess/WebIconDatabase.messages.in: Added new message to
notify the UI process: DidReceiveIconForPageURL.
* UIProcess/WebIconDatabase.cpp:
(WebKit::WebIconDatabase::notifyIconDataReadyForPageURL): New
private helper function to notify the API layer both that new icon
data is ready and that the icon has changed.
(WebKit::WebIconDatabase::didReceiveIconForPageURL):
Implementation of the new message added, by calling
notifyIconDataReadyForPageURL() to notify the API layer.
(WebKit::WebIconDatabase::didImportIconDataForPageURL): Call
notifyIconDataReadyForPageURL() from here as well.
* UIProcess/WebIconDatabase.h: Added new prototypes.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidReceiveIcon): Send a
message to the UI process telling a new icon has been received.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (129741 => 129742)
--- trunk/Source/WebKit2/ChangeLog 2012-09-27 08:57:30 UTC (rev 129741)
+++ trunk/Source/WebKit2/ChangeLog 2012-09-27 09:24:59 UTC (rev 129742)
@@ -1,3 +1,44 @@
+2012-09-27 Mario Sanchez Prada <[email protected]>
+
+ [WK2] IconDatabase: Add a way to notify when icon data is available
+ https://bugs.webkit.org/show_bug.cgi?id=63945
+
+ Reviewed by Anders Carlsson.
+
+ Provide new API to notify the API layer when icon data is
+ available, and use it from the implementation layer when needed,
+ that is, either when the data has been loaded from the network or
+ imported from disk.
+
+ Added new callback to WKIconDatabaseClient API.
+
+ * UIProcess/API/C/WKIconDatabase.h: Added new callback.
+ * UIProcess/WebIconDatabaseClient.cpp:
+ (WebKit::WebIconDatabaseClient::iconDataReadyForPageURL):
+ Implementation of the new callback at this level in the UI
+ process, by using its implementation in the API layer if present.
+ * UIProcess/WebIconDatabaseClient.h:
+ (WebIconDatabaseClient): Added new callback.
+
+ Implemented WebFrameLoaderClient::dispatchDidReceiveIcon, so we
+ get notified in the UI process when loading a new icon.
+
+ * UIProcess/WebIconDatabase.messages.in: Added new message to
+ notify the UI process: DidReceiveIconForPageURL.
+ * UIProcess/WebIconDatabase.cpp:
+ (WebKit::WebIconDatabase::notifyIconDataReadyForPageURL): New
+ private helper function to notify the API layer both that new icon
+ data is ready and that the icon has changed.
+ (WebKit::WebIconDatabase::didReceiveIconForPageURL):
+ Implementation of the new message added, by calling
+ notifyIconDataReadyForPageURL() to notify the API layer.
+ (WebKit::WebIconDatabase::didImportIconDataForPageURL): Call
+ notifyIconDataReadyForPageURL() from here as well.
+ * UIProcess/WebIconDatabase.h: Added new prototypes.
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dispatchDidReceiveIcon): Send a
+ message to the UI process telling a new icon has been received.
+
2012-09-26 Sam Weinig <[email protected]>
Fix XPCServices symlink to not be to an absolute path
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h (129741 => 129742)
--- trunk/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h 2012-09-27 08:57:30 UTC (rev 129741)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKIconDatabase.h 2012-09-27 09:24:59 UTC (rev 129742)
@@ -35,12 +35,14 @@
// IconDatabase Client.
typedef void (*WKIconDatabaseDidChangeIconForPageURLCallback)(WKIconDatabaseRef iconDatabase, WKURLRef pageURL, const void* clientInfo);
typedef void (*WKIconDatabaseDidRemoveAllIconsCallback)(WKIconDatabaseRef iconDatabase, const void* clientInfo);
+typedef void (*WKIconDatabaseIconDataReadyForPageURLCallback)(WKIconDatabaseRef iconDatabase, WKURLRef pageURL, const void* clientInfo);
struct WKIconDatabaseClient {
int version;
const void * clientInfo;
WKIconDatabaseDidChangeIconForPageURLCallback didChangeIconForPageURL;
WKIconDatabaseDidRemoveAllIconsCallback didRemoveAllIcons;
+ WKIconDatabaseIconDataReadyForPageURLCallback iconDataReadyForPageURL;
};
typedef struct WKIconDatabaseClient WKIconDatabaseClient;
Modified: trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp (129741 => 129742)
--- trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp 2012-09-27 08:57:30 UTC (rev 129741)
+++ trunk/Source/WebKit2/UIProcess/WebIconDatabase.cpp 2012-09-27 09:24:59 UTC (rev 129742)
@@ -180,6 +180,11 @@
m_webContext->sendToAllProcesses(Messages::WebIconDatabaseProxy::ReceivedIconLoadDecision((int)decision, callbackID));
}
+void WebIconDatabase::didReceiveIconForPageURL(const String& pageURL)
+{
+ notifyIconDataReadyForPageURL(pageURL);
+}
+
Image* WebIconDatabase::imageForPageURL(const String& pageURL, const WebCore::IntSize& iconSize)
{
if (!m_webContext || !m_iconDatabaseImpl || !m_iconDatabaseImpl->isOpen() || pageURL.isEmpty())
@@ -237,7 +242,7 @@
void WebIconDatabase::didImportIconDataForPageURL(const String& pageURL)
{
- didChangeIconForPageURL(pageURL);
+ notifyIconDataReadyForPageURL(pageURL);
}
void WebIconDatabase::didChangeIconForPageURL(const String& pageURL)
@@ -288,4 +293,10 @@
didReceiveSyncWebIconDatabaseMessage(connection, messageID, decoder, reply);
}
+void WebIconDatabase::notifyIconDataReadyForPageURL(const String& pageURL)
+{
+ m_iconDatabaseClient.iconDataReadyForPageURL(this, WebURL::create(pageURL).get());
+ didChangeIconForPageURL(pageURL);
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebIconDatabase.h (129741 => 129742)
--- trunk/Source/WebKit2/UIProcess/WebIconDatabase.h 2012-09-27 08:57:30 UTC (rev 129741)
+++ trunk/Source/WebKit2/UIProcess/WebIconDatabase.h 2012-09-27 09:24:59 UTC (rev 129742)
@@ -77,6 +77,7 @@
void synchronousLoadDecisionForIconURL(const String&, int&) const;
void getLoadDecisionForIconURL(const String&, uint64_t callbackID);
+ void didReceiveIconForPageURL(const String&);
WebCore::Image* imageForPageURL(const String&, const WebCore::IntSize& iconSize = WebCore::IntSize(32, 32));
WebCore::NativeImagePtr nativeImageForPageURL(const String&, const WebCore::IntSize& iconSize = WebCore::IntSize(32, 32));
@@ -106,6 +107,7 @@
void didReceiveWebIconDatabaseMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
void didReceiveSyncWebIconDatabaseMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*, OwnPtr<CoreIPC::ArgumentEncoder>&);
+ void notifyIconDataReadyForPageURL(const String&);
WebContext* m_webContext;
Modified: trunk/Source/WebKit2/UIProcess/WebIconDatabase.messages.in (129741 => 129742)
--- trunk/Source/WebKit2/UIProcess/WebIconDatabase.messages.in 2012-09-27 08:57:30 UTC (rev 129741)
+++ trunk/Source/WebKit2/UIProcess/WebIconDatabase.messages.in 2012-09-27 09:24:59 UTC (rev 129742)
@@ -32,4 +32,5 @@
SynchronousLoadDecisionForIconURL(WTF::String iconURL) -> (int loadDecision)
GetLoadDecisionForIconURL(WTF::String iconURL, uint64_t callbackID)
+ DidReceiveIconForPageURL(WTF::String pageURL)
}
Modified: trunk/Source/WebKit2/UIProcess/WebIconDatabaseClient.cpp (129741 => 129742)
--- trunk/Source/WebKit2/UIProcess/WebIconDatabaseClient.cpp 2012-09-27 08:57:30 UTC (rev 129741)
+++ trunk/Source/WebKit2/UIProcess/WebIconDatabaseClient.cpp 2012-09-27 09:24:59 UTC (rev 129742)
@@ -47,4 +47,12 @@
m_client.didRemoveAllIcons(toAPI(iconDatabase), m_client.clientInfo);
}
+void WebIconDatabaseClient::iconDataReadyForPageURL(WebIconDatabase* iconDatabase, WebURL* url)
+{
+ if (!m_client.iconDataReadyForPageURL)
+ return;
+
+ m_client.iconDataReadyForPageURL(toAPI(iconDatabase), toAPI(url), m_client.clientInfo);
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebIconDatabaseClient.h (129741 => 129742)
--- trunk/Source/WebKit2/UIProcess/WebIconDatabaseClient.h 2012-09-27 08:57:30 UTC (rev 129741)
+++ trunk/Source/WebKit2/UIProcess/WebIconDatabaseClient.h 2012-09-27 09:24:59 UTC (rev 129742)
@@ -39,6 +39,7 @@
public:
void didChangeIconForPageURL(WebIconDatabase*, WebURL*);
void didRemoveAllIcons(WebIconDatabase*);
+ void iconDataReadyForPageURL(WebIconDatabase*, WebURL*);
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (129741 => 129742)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2012-09-27 08:57:30 UTC (rev 129741)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2012-09-27 09:24:59 UTC (rev 129742)
@@ -44,6 +44,7 @@
#include "WebFrame.h"
#include "WebFrameNetworkingContext.h"
#include "WebFullScreenManager.h"
+#include "WebIconDatabaseMessages.h"
#include "WebNavigationDataStore.h"
#include "WebPage.h"
#include "WebPageProxyMessages.h"
@@ -393,7 +394,7 @@
void WebFrameLoaderClient::dispatchDidReceiveIcon()
{
- notImplemented();
+ WebProcess::shared().connection()->send(Messages::WebIconDatabase::DidReceiveIconForPageURL(m_frame->url()), 0);
}
void WebFrameLoaderClient::dispatchDidStartProvisionalLoad()