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,6 +162,21 @@ void WebApplicationCacheHostImpl::OnErrorEventRaised(
void WebApplicationCacheHostImpl::willStartMainResourceRequest(
WebURLRequest& request, const WebFrame* frame) {
WebApplicationCacheHostImpl* spawning_host = NULL;
if (frame) {
const WebFrame* spawning_frame = frame->parent();
if (!spawning_frame)
spawning_frame = frame->opener();
if (!spawning_frame)
spawning_frame = frame;
spawning_host = FromFrame(spawning_frame);
}
willStartMainResourceRequest(request, spawning_host);
}
void WebApplicationCacheHostImpl::willStartMainResourceRequest(
WebURLRequest& request, const WebApplicationCacheHost* spawning_host) {
request.setAppCacheHostID(host_id_);
original_main_resource_url_ = ClearUrlRef(request.url());
......@@ -170,18 +185,11 @@ void WebApplicationCacheHostImpl::willStartMainResourceRequest(
is_get_method_ = (method == appcache::kHttpGETMethod);
DCHECK(method == StringToUpperASCII(method));
if (frame) {
const WebFrame* spawning_frame = frame->parent();
if (!spawning_frame)
spawning_frame = frame->opener();
if (!spawning_frame)
spawning_frame = frame;
WebApplicationCacheHostImpl* spawning_host = FromFrame(spawning_frame);
if (spawning_host && (spawning_host != this) &&
(spawning_host->status_ != appcache::UNCACHED)) {
backend_->SetSpawningHostId(host_id_, spawning_host->host_id());
}
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
// blink::WebApplicationCacheHost:
virtual void willStartMainResourceRequest(blink::WebURLRequest&,
const blink::WebFrame*);
virtual void willStartMainResourceRequest(
blink::WebURLRequest&, const blink::WebApplicationCacheHost*);
virtual void willStartSubResourceRequest(blink::WebURLRequest&);
virtual void selectCacheWithoutManifest();
virtual bool selectCacheWithManifest(const blink::WebURL& manifestURL);
......
......@@ -19,6 +19,10 @@ void WorkerWebApplicationCacheHostImpl::willStartMainResourceRequest(
blink::WebURLRequest&, const blink::WebFrame*) {
}
void WorkerWebApplicationCacheHostImpl::willStartMainResourceRequest(
blink::WebURLRequest&, const blink::WebApplicationCacheHost*) {
}
void WorkerWebApplicationCacheHostImpl::didReceiveResponseForMainResource(
const blink::WebURLResponse&) {
}
......
......@@ -19,6 +19,8 @@ class WorkerWebApplicationCacheHostImpl : public WebApplicationCacheHostImpl {
// These overrides are stubbed out.
virtual void willStartMainResourceRequest(
blink::WebURLRequest&, const blink::WebFrame*);
virtual void willStartMainResourceRequest(
blink::WebURLRequest&, const blink::WebApplicationCacheHost*);
virtual void didReceiveResponseForMainResource(
const blink::WebURLResponse&);
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