Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 2715663002: ServiceWorker: Factor out FetchEvent related logics from RespondWithObserver. (Closed)
Patch Set: ServiceWorker: Factor out FetchEvent related logics from RespondWithObserver. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 157 }
158 158
159 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent( 159 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(
160 int fetchEventID, 160 int fetchEventID,
161 const WebServiceWorkerRequest& webRequest, 161 const WebServiceWorkerRequest& webRequest,
162 bool navigationPreloadSent) { 162 bool navigationPreloadSent) {
163 ScriptState::Scope scope( 163 ScriptState::Scope scope(
164 workerGlobalScope()->scriptController()->getScriptState()); 164 workerGlobalScope()->scriptController()->getScriptState());
165 WaitUntilObserver* waitUntilObserver = WaitUntilObserver::create( 165 WaitUntilObserver* waitUntilObserver = WaitUntilObserver::create(
166 workerGlobalScope(), WaitUntilObserver::Fetch, fetchEventID); 166 workerGlobalScope(), WaitUntilObserver::Fetch, fetchEventID);
167 RespondWithObserver* respondWithObserver = RespondWithObserver::create( 167 FetchRespondWithObserver* respondWithObserver =
168 workerGlobalScope(), fetchEventID, webRequest.url(), webRequest.mode(), 168 FetchRespondWithObserver::create(
169 webRequest.redirectMode(), webRequest.frameType(), 169 workerGlobalScope(), fetchEventID, webRequest.url(),
170 webRequest.requestContext(), waitUntilObserver); 170 webRequest.mode(), webRequest.redirectMode(), webRequest.frameType(),
171 webRequest.requestContext(), waitUntilObserver);
171 Request* request = Request::create( 172 Request* request = Request::create(
172 workerGlobalScope()->scriptController()->getScriptState(), webRequest); 173 workerGlobalScope()->scriptController()->getScriptState(), webRequest);
173 request->getHeaders()->setGuard(Headers::ImmutableGuard); 174 request->getHeaders()->setGuard(Headers::ImmutableGuard);
174 FetchEventInit eventInit; 175 FetchEventInit eventInit;
175 eventInit.setCancelable(true); 176 eventInit.setCancelable(true);
176 eventInit.setRequest(request); 177 eventInit.setRequest(request);
177 eventInit.setClientId( 178 eventInit.setClientId(
178 webRequest.isMainResourceLoad() ? WebString() : webRequest.clientId()); 179 webRequest.isMainResourceLoad() ? WebString() : webRequest.clientId());
179 eventInit.setIsReload(webRequest.isReload()); 180 eventInit.setIsReload(webRequest.isReload());
180 ScriptState* scriptState = 181 ScriptState* scriptState =
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 return *m_document; 484 return *m_document;
484 } 485 }
485 486
486 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() 487 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope()
487 const { 488 const {
488 DCHECK(m_workerGlobalScope); 489 DCHECK(m_workerGlobalScope);
489 return m_workerGlobalScope; 490 return m_workerGlobalScope;
490 } 491 }
491 492
492 } // namespace blink 493 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/serviceworkers/RespondWithObserver.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698