diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-21 22:11:42 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-21 22:11:42 +0000 |
commit | e16b8af74c13f79282c608042d92fc1000fb5e62 (patch) | |
tree | 98d6594941193b24caaf66bd956fc1ea9eef0b58 /content | |
parent | 778574e9b16cb9438b5edb364e45bd88b02b2483 (diff) | |
download | chromium_src-e16b8af74c13f79282c608042d92fc1000fb5e62.zip chromium_src-e16b8af74c13f79282c608042d92fc1000fb5e62.tar.gz chromium_src-e16b8af74c13f79282c608042d92fc1000fb5e62.tar.bz2 |
Plumbing to support loading from the "most appropriate" appcache.
BUG=68479
Review URL: http://codereview.chromium.org/6667057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78934 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/appcache/appcache_dispatcher_host.cc | 9 | ||||
-rw-r--r-- | content/browser/appcache/appcache_dispatcher_host.h | 1 | ||||
-rw-r--r-- | content/common/appcache/appcache_backend_proxy.cc | 6 | ||||
-rw-r--r-- | content/common/appcache/appcache_backend_proxy.h | 1 | ||||
-rw-r--r-- | content/common/appcache_messages.h | 8 | ||||
-rw-r--r-- | content/worker/worker_webapplicationcachehost_impl.cc | 21 | ||||
-rw-r--r-- | content/worker/worker_webapplicationcachehost_impl.h | 15 |
7 files changed, 54 insertions, 7 deletions
diff --git a/content/browser/appcache/appcache_dispatcher_host.cc b/content/browser/appcache/appcache_dispatcher_host.cc index e3f4430..7fefe39 100644 --- a/content/browser/appcache/appcache_dispatcher_host.cc +++ b/content/browser/appcache/appcache_dispatcher_host.cc @@ -63,6 +63,7 @@ bool AppCacheDispatcherHost::OnMessageReceived(const IPC::Message& message, IPC_BEGIN_MESSAGE_MAP_EX(AppCacheDispatcherHost, message, *message_was_ok) IPC_MESSAGE_HANDLER(AppCacheHostMsg_RegisterHost, OnRegisterHost) IPC_MESSAGE_HANDLER(AppCacheHostMsg_UnregisterHost, OnUnregisterHost) + IPC_MESSAGE_HANDLER(AppCacheHostMsg_SetSpawningHostId, OnSetSpawningHostId) IPC_MESSAGE_HANDLER(AppCacheHostMsg_GetResourceList, OnGetResourceList) IPC_MESSAGE_HANDLER(AppCacheHostMsg_SelectCache, OnSelectCache) IPC_MESSAGE_HANDLER(AppCacheHostMsg_SelectCacheForWorker, @@ -101,6 +102,14 @@ void AppCacheDispatcherHost::OnUnregisterHost(int host_id) { } } +void AppCacheDispatcherHost::OnSetSpawningHostId( + int host_id, int spawning_host_id) { + if (appcache_service_.get()) { + if (!backend_impl_.SetSpawningHostId(host_id, spawning_host_id)) + BadMessageReceived(); + } +} + void AppCacheDispatcherHost::OnSelectCache( int host_id, const GURL& document_url, int64 cache_document_was_loaded_from, diff --git a/content/browser/appcache/appcache_dispatcher_host.h b/content/browser/appcache/appcache_dispatcher_host.h index e6b9f34..010dad5 100644 --- a/content/browser/appcache/appcache_dispatcher_host.h +++ b/content/browser/appcache/appcache_dispatcher_host.h @@ -51,6 +51,7 @@ class AppCacheDispatcherHost : public BrowserMessageFilter { // IPC message handlers void OnRegisterHost(int host_id); void OnUnregisterHost(int host_id); + void OnSetSpawningHostId(int host_id, int spawning_host_id); void OnSelectCache(int host_id, const GURL& document_url, int64 cache_document_was_loaded_from, const GURL& opt_manifest_url); diff --git a/content/common/appcache/appcache_backend_proxy.cc b/content/common/appcache/appcache_backend_proxy.cc index be54b76..688b221 100644 --- a/content/common/appcache/appcache_backend_proxy.cc +++ b/content/common/appcache/appcache_backend_proxy.cc @@ -14,6 +14,12 @@ void AppCacheBackendProxy::UnregisterHost(int host_id) { sender_->Send(new AppCacheHostMsg_UnregisterHost(host_id)); } +void AppCacheBackendProxy::SetSpawningHostId(int host_id, + int spawning_host_id) { + sender_->Send(new AppCacheHostMsg_SetSpawningHostId( + host_id, spawning_host_id)); +} + void AppCacheBackendProxy::SelectCache( int host_id, const GURL& document_url, diff --git a/content/common/appcache/appcache_backend_proxy.h b/content/common/appcache/appcache_backend_proxy.h index b05115e..af09abf 100644 --- a/content/common/appcache/appcache_backend_proxy.h +++ b/content/common/appcache/appcache_backend_proxy.h @@ -20,6 +20,7 @@ class AppCacheBackendProxy : public appcache::AppCacheBackend { // AppCacheBackend methods virtual void RegisterHost(int host_id); virtual void UnregisterHost(int host_id); + virtual void SetSpawningHostId(int host_id, int spawning_host_id); virtual void SelectCache(int host_id, const GURL& document_url, const int64 cache_document_was_loaded_from, diff --git a/content/common/appcache_messages.h b/content/common/appcache_messages.h index d14ffa8..d755e99 100644 --- a/content/common/appcache_messages.h +++ b/content/common/appcache_messages.h @@ -43,6 +43,14 @@ IPC_MESSAGE_CONTROL1(AppCacheHostMsg_RegisterHost, IPC_MESSAGE_CONTROL1(AppCacheHostMsg_UnregisterHost, int /* host_id */) +// Informs the browser of which host caused another to be created. +// This can influence which appcache should be utilized for the main +// resource load into the newly created host, so it should be sent +// prior to the main resource request being initiated. +IPC_MESSAGE_CONTROL2(AppCacheHostMsg_SetSpawningHostId, + int /* host_id */, + int /* spawning_host_id */) + // Initiates the cache selection algorithm for the given host. // This is sent prior to any subresource loads. An AppCacheMsg_CacheSelected // message will be sent in response. diff --git a/content/worker/worker_webapplicationcachehost_impl.cc b/content/worker/worker_webapplicationcachehost_impl.cc index 45c75ed..734302c 100644 --- a/content/worker/worker_webapplicationcachehost_impl.cc +++ b/content/worker/worker_webapplicationcachehost_impl.cc @@ -21,7 +21,26 @@ WorkerWebApplicationCacheHostImpl::WorkerWebApplicationCacheHostImpl( init_info.parent_appcache_host_id); } +void WorkerWebApplicationCacheHostImpl::willStartMainResourceRequest( + WebKit::WebURLRequest&, const WebKit::WebFrame*) { +} + +void WorkerWebApplicationCacheHostImpl::didReceiveResponseForMainResource( + const WebKit::WebURLResponse&) { +} + +void WorkerWebApplicationCacheHostImpl::didReceiveDataForMainResource( + const char*, int) { +} + +void WorkerWebApplicationCacheHostImpl::didFinishLoadingMainResource( + bool) { +} + +void WorkerWebApplicationCacheHostImpl::selectCacheWithoutManifest() { +} + bool WorkerWebApplicationCacheHostImpl::selectCacheWithManifest( - const WebKit::WebURL& manifestURL) { + const WebKit::WebURL&) { return true; } diff --git a/content/worker/worker_webapplicationcachehost_impl.h b/content/worker/worker_webapplicationcachehost_impl.h index db6dc8a..e356583 100644 --- a/content/worker/worker_webapplicationcachehost_impl.h +++ b/content/worker/worker_webapplicationcachehost_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -36,15 +36,18 @@ class WorkerWebApplicationCacheHostImpl // Main resource loading is different for workers. The resource is // loaded by the creator of the worker rather than the worker itself. - virtual void willStartMainResourceRequest(WebKit::WebURLRequest&) {} + // These overrides are stubbed out. + virtual void willStartMainResourceRequest( + WebKit::WebURLRequest&, const WebKit::WebFrame*); virtual void didReceiveResponseForMainResource( - const WebKit::WebURLResponse&) {} - virtual void didReceiveDataForMainResource(const char* data, int len) {} - virtual void didFinishLoadingMainResource(bool success) {} + const WebKit::WebURLResponse&); + virtual void didReceiveDataForMainResource(const char* data, int len); + virtual void didFinishLoadingMainResource(bool success); // Cache selection is also different for workers. We know at construction // time what cache to select and do so then. - virtual void selectCacheWithoutManifest() {} + // These overrides are stubbed out. + virtual void selectCacheWithoutManifest(); virtual bool selectCacheWithManifest(const WebKit::WebURL& manifestURL); }; |