Commit 54ddea47 authored by adamk@chromium.org's avatar adamk@chromium.org

Implement new willStartMainResourceRequest method of blink::WebApplicationCacheHost

This separates the frame-walking code from the appcache-setup code, allowing
the next Blink patch in this sequence to handle frame-walking on the Blink side.

BUG=343272
TBR=kinuko@chromium.org

Review URL: https://codereview.chromium.org/161573002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251187 0039d316-1c4b-4281-b951-d872f2087c98
parent e264f250
...@@ -162,14 +162,7 @@ void WebApplicationCacheHostImpl::OnErrorEventRaised( ...@@ -162,14 +162,7 @@ void WebApplicationCacheHostImpl::OnErrorEventRaised(
void WebApplicationCacheHostImpl::willStartMainResourceRequest( void WebApplicationCacheHostImpl::willStartMainResourceRequest(
WebURLRequest& request, const WebFrame* frame) { WebURLRequest& request, const WebFrame* frame) {
request.setAppCacheHostID(host_id_); WebApplicationCacheHostImpl* spawning_host = NULL;
original_main_resource_url_ = ClearUrlRef(request.url());
std::string method = request.httpMethod().utf8();
is_get_method_ = (method == appcache::kHttpGETMethod);
DCHECK(method == StringToUpperASCII(method));
if (frame) { if (frame) {
const WebFrame* spawning_frame = frame->parent(); const WebFrame* spawning_frame = frame->parent();
if (!spawning_frame) if (!spawning_frame)
...@@ -177,11 +170,26 @@ void WebApplicationCacheHostImpl::willStartMainResourceRequest( ...@@ -177,11 +170,26 @@ void WebApplicationCacheHostImpl::willStartMainResourceRequest(
if (!spawning_frame) if (!spawning_frame)
spawning_frame = frame; spawning_frame = frame;
WebApplicationCacheHostImpl* spawning_host = FromFrame(spawning_frame); spawning_host = FromFrame(spawning_frame);
if (spawning_host && (spawning_host != this) &&
(spawning_host->status_ != appcache::UNCACHED)) {
backend_->SetSpawningHostId(host_id_, spawning_host->host_id());
} }
willStartMainResourceRequest(request, spawning_host);
}
void WebApplicationCacheHostImpl::willStartMainResourceRequest(
WebURLRequest& request, const WebApplicationCacheHost* spawning_host) {
request.setAppCacheHostID(host_id_);
original_main_resource_url_ = ClearUrlRef(request.url());
std::string method = request.httpMethod().utf8();
is_get_method_ = (method == appcache::kHttpGETMethod);
DCHECK(method == StringToUpperASCII(method));
const WebApplicationCacheHostImpl* spawning_host_impl =
static_cast<const WebApplicationCacheHostImpl*>(spawning_host);
if (spawning_host_impl && (spawning_host_impl != this) &&
(spawning_host_impl->status_ != appcache::UNCACHED)) {
backend_->SetSpawningHostId(host_id_, spawning_host_impl->host_id());
} }
} }
......
...@@ -48,6 +48,8 @@ class WebApplicationCacheHostImpl ...@@ -48,6 +48,8 @@ class WebApplicationCacheHostImpl
// blink::WebApplicationCacheHost: // blink::WebApplicationCacheHost:
virtual void willStartMainResourceRequest(blink::WebURLRequest&, virtual void willStartMainResourceRequest(blink::WebURLRequest&,
const blink::WebFrame*); const blink::WebFrame*);
virtual void willStartMainResourceRequest(
blink::WebURLRequest&, const blink::WebApplicationCacheHost*);
virtual void willStartSubResourceRequest(blink::WebURLRequest&); virtual void willStartSubResourceRequest(blink::WebURLRequest&);
virtual void selectCacheWithoutManifest(); virtual void selectCacheWithoutManifest();
virtual bool selectCacheWithManifest(const blink::WebURL& manifestURL); virtual bool selectCacheWithManifest(const blink::WebURL& manifestURL);
......
...@@ -19,6 +19,10 @@ void WorkerWebApplicationCacheHostImpl::willStartMainResourceRequest( ...@@ -19,6 +19,10 @@ void WorkerWebApplicationCacheHostImpl::willStartMainResourceRequest(
blink::WebURLRequest&, const blink::WebFrame*) { blink::WebURLRequest&, const blink::WebFrame*) {
} }
void WorkerWebApplicationCacheHostImpl::willStartMainResourceRequest(
blink::WebURLRequest&, const blink::WebApplicationCacheHost*) {
}
void WorkerWebApplicationCacheHostImpl::didReceiveResponseForMainResource( void WorkerWebApplicationCacheHostImpl::didReceiveResponseForMainResource(
const blink::WebURLResponse&) { const blink::WebURLResponse&) {
} }
......
...@@ -19,6 +19,8 @@ class WorkerWebApplicationCacheHostImpl : public WebApplicationCacheHostImpl { ...@@ -19,6 +19,8 @@ class WorkerWebApplicationCacheHostImpl : public WebApplicationCacheHostImpl {
// These overrides are stubbed out. // These overrides are stubbed out.
virtual void willStartMainResourceRequest( virtual void willStartMainResourceRequest(
blink::WebURLRequest&, const blink::WebFrame*); blink::WebURLRequest&, const blink::WebFrame*);
virtual void willStartMainResourceRequest(
blink::WebURLRequest&, const blink::WebApplicationCacheHost*);
virtual void didReceiveResponseForMainResource( virtual void didReceiveResponseForMainResource(
const blink::WebURLResponse&); const blink::WebURLResponse&);
virtual void didReceiveDataForMainResource(const char* data, int len); virtual void didReceiveDataForMainResource(const char* data, int len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment