diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/WebIconDatabase.h')
-rw-r--r-- | Source/WebKit2/UIProcess/WebIconDatabase.h | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/Source/WebKit2/UIProcess/WebIconDatabase.h b/Source/WebKit2/UIProcess/WebIconDatabase.h index 816b20d4b..8b70fe824 100644 --- a/Source/WebKit2/UIProcess/WebIconDatabase.h +++ b/Source/WebKit2/UIProcess/WebIconDatabase.h @@ -27,21 +27,14 @@ #define WebIconDatabase_h #include "APIObject.h" - #include "Connection.h" #include "WebIconDatabaseClient.h" #include <WebCore/IconDatabaseClient.h> -#include <WebCore/ImageSource.h> #include <WebCore/IntSize.h> -#include <wtf/Forward.h> -#include <wtf/PassRefPtr.h> -#include <wtf/RefPtr.h> -#include <wtf/Vector.h> -#include <wtf/text/StringHash.h> - -namespace IPC { -class ArgumentDecoder; -class DataReference; +#include <WebCore/NativeImage.h> + +namespace API { +class Data; } namespace WebCore { @@ -51,15 +44,15 @@ class Image; namespace WebKit { -class WebContext; +class WebProcessPool; -class WebIconDatabase : public API::ObjectImpl<API::Object::Type::IconDatabase>, public WebCore::IconDatabaseClient, private IPC::MessageReceiver { +class WebIconDatabase : public API::ObjectImpl<API::Object::Type::IconDatabase>, private WebCore::IconDatabaseClient, private IPC::MessageReceiver { public: - static PassRefPtr<WebIconDatabase> create(WebContext*); + static PassRefPtr<WebIconDatabase> create(WebProcessPool*); virtual ~WebIconDatabase(); void invalidate(); - void clearContext() { m_webContext = 0; } + void clearProcessPool() { m_processPool = nullptr; } void setDatabasePath(const String&); void enableDatabaseCleanup(); @@ -67,17 +60,19 @@ public: void releaseIconForPageURL(const String&); void setIconURLForPageURL(const String&, const String&); void setIconDataForIconURL(const IPC::DataReference&, const String&); - + void synchronousIconDataForPageURL(const String&, IPC::DataReference&); void synchronousIconURLForPageURL(const String&, String&); void synchronousIconDataKnownForIconURL(const String&, bool&) const; 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)); + PassRefPtr<API::Data> iconDataForPageURL(const String& pageURL); + bool isOpen(); bool isUrlImportCompleted(); @@ -88,28 +83,35 @@ public: void initializeIconDatabaseClient(const WKIconDatabaseClientBase*); void setPrivateBrowsingEnabled(bool); - + + // Called when the WebProcessPool is through with this WebIconDatabase but the + // WebCore::IconDatabase possibly isn't done shutting down. + // In that case this WebIconDatabase will deref() itself when the time is right. + void derefWhenAppropriate(); + private: - WebIconDatabase(WebContext*); + explicit WebIconDatabase(WebProcessPool&); // WebCore::IconDatabaseClient - virtual void didImportIconURLForPageURL(const String&); - virtual void didImportIconDataForPageURL(const String&); - virtual void didChangeIconForPageURL(const String&); - virtual void didRemoveAllIcons(); - virtual void didFinishURLImport(); + void didImportIconURLForPageURL(const String&) override; + void didImportIconDataForPageURL(const String&) override; + void didChangeIconForPageURL(const String&) override; + void didRemoveAllIcons() override; + void didFinishURLImport() override; + void didClose() override; // IPC::MessageReceiver - virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override; - virtual void didReceiveSyncMessage(IPC::Connection*, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&) override; + void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; + void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override; void notifyIconDataReadyForPageURL(const String&); - WebContext* m_webContext; - - OwnPtr<WebCore::IconDatabase> m_iconDatabaseImpl; + WebProcessPool* m_processPool; + + std::unique_ptr<WebCore::IconDatabase> m_iconDatabaseImpl; bool m_urlImportCompleted; bool m_databaseCleanupDisabled; + bool m_shouldDerefWhenAppropriate; HashMap<uint64_t, String> m_pendingLoadDecisionURLMap; WebIconDatabaseClient m_iconDatabaseClient; |