diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp index 474f06dac..494ca6bd7 100644 --- a/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,22 +34,33 @@ namespace WebKit { +const char* WebApplicationCacheManagerProxy::supplementName() +{ + return "WebApplicationCacheManagerProxy"; +} + PassRefPtr<WebApplicationCacheManagerProxy> WebApplicationCacheManagerProxy::create(WebContext* context) { return adoptRef(new WebApplicationCacheManagerProxy(context)); } WebApplicationCacheManagerProxy::WebApplicationCacheManagerProxy(WebContext* context) - : m_webContext(context) + : WebContextSupplement(context) { - m_webContext->addMessageReceiver(Messages::WebApplicationCacheManagerProxy::messageReceiverName(), this); + context->addMessageReceiver(Messages::WebApplicationCacheManagerProxy::messageReceiverName(), this); } WebApplicationCacheManagerProxy::~WebApplicationCacheManagerProxy() { } -void WebApplicationCacheManagerProxy::invalidate() + +void WebApplicationCacheManagerProxy::contextDestroyed() +{ + invalidateCallbackMap(m_arrayCallbacks); +} + +void WebApplicationCacheManagerProxy::processDidClose(WebProcessProxy*) { invalidateCallbackMap(m_arrayCallbacks); } @@ -59,20 +70,28 @@ bool WebApplicationCacheManagerProxy::shouldTerminate(WebProcessProxy*) const return m_arrayCallbacks.isEmpty(); } -void WebApplicationCacheManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::MessageDecoder& decoder) +void WebApplicationCacheManagerProxy::refWebContextSupplement() +{ + APIObject::ref(); +} + +void WebApplicationCacheManagerProxy::derefWebContextSupplement() { - didReceiveWebApplicationCacheManagerProxyMessage(connection, messageID, decoder); + APIObject::deref(); } void WebApplicationCacheManagerProxy::getApplicationCacheOrigins(PassRefPtr<ArrayCallback> prpCallback) { + if (!context()) + return; + RefPtr<ArrayCallback> callback = prpCallback; uint64_t callbackID = callback->callbackID(); m_arrayCallbacks.set(callbackID, callback.release()); // FIXME (Multi-WebProcess): <rdar://problem/12239765> Make manipulating cache information work with per-tab WebProcess. - m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebApplicationCacheManager::GetApplicationCacheOrigins(callbackID)); + context()->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebApplicationCacheManager::GetApplicationCacheOrigins(callbackID)); } void WebApplicationCacheManagerProxy::didGetApplicationCacheOrigins(const Vector<SecurityOriginData>& originDatas, uint64_t callbackID) @@ -83,19 +102,25 @@ void WebApplicationCacheManagerProxy::didGetApplicationCacheOrigins(const Vector void WebApplicationCacheManagerProxy::deleteEntriesForOrigin(WebSecurityOrigin* origin) { + if (!context()) + return; + SecurityOriginData securityOriginData; securityOriginData.protocol = origin->protocol(); securityOriginData.host = origin->host(); securityOriginData.port = origin->port(); // FIXME (Multi-WebProcess): <rdar://problem/12239765> Make manipulating cache information work with per-tab WebProcess. - m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebApplicationCacheManager::DeleteEntriesForOrigin(securityOriginData)); + context()->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebApplicationCacheManager::DeleteEntriesForOrigin(securityOriginData)); } void WebApplicationCacheManagerProxy::deleteAllEntries() { + if (!context()) + return; + // FIXME (Multi-WebProcess): <rdar://problem/12239765> Make manipulating cache information work with per-tab WebProcess. - m_webContext->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebApplicationCacheManager::DeleteAllEntries()); + context()->sendToAllProcessesRelaunchingThemIfNecessary(Messages::WebApplicationCacheManager::DeleteAllEntries()); } } // namespace WebKit |