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

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: change useCache to updateViaCache Created 3 years, 6 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
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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 visitor->Trace(clients_); 213 visitor->Trace(clients_);
214 visitor->Trace(registration_); 214 visitor->Trace(registration_);
215 WorkerGlobalScope::Trace(visitor); 215 WorkerGlobalScope::Trace(visitor);
216 } 216 }
217 217
218 void ServiceWorkerGlobalScope::importScripts(const Vector<String>& urls, 218 void ServiceWorkerGlobalScope::importScripts(const Vector<String>& urls,
219 ExceptionState& exception_state) { 219 ExceptionState& exception_state) {
220 // Bust the MemoryCache to ensure script requests reach the browser-side 220 // Bust the MemoryCache to ensure script requests reach the browser-side
221 // and get added to and retrieved from the ServiceWorker's script cache. 221 // and get added to and retrieved from the ServiceWorker's script cache.
222 // FIXME: Revisit in light of the solution to crbug/388375. 222 // FIXME: Revisit in light of the solution to crbug/388375.
223 // TODO(yuryu): Update the method to respect cache policy.
223 for (Vector<String>::const_iterator it = urls.begin(); it != urls.end(); ++it) 224 for (Vector<String>::const_iterator it = urls.begin(); it != urls.end(); ++it)
224 GetExecutionContext()->RemoveURLFromMemoryCache(CompleteURL(*it)); 225 GetExecutionContext()->RemoveURLFromMemoryCache(CompleteURL(*it));
225 WorkerGlobalScope::importScripts(urls, exception_state); 226 WorkerGlobalScope::importScripts(urls, exception_state);
226 } 227 }
227 228
228 CachedMetadataHandler* 229 CachedMetadataHandler*
229 ServiceWorkerGlobalScope::CreateWorkerScriptCachedMetadataHandler( 230 ServiceWorkerGlobalScope::CreateWorkerScriptCachedMetadataHandler(
230 const KURL& script_url, 231 const KURL& script_url,
231 const Vector<char>* meta_data) { 232 const Vector<char>* meta_data) {
232 return ServiceWorkerScriptCachedMetadataHandler::Create(this, script_url, 233 return ServiceWorkerScriptCachedMetadataHandler::Create(this, script_url,
233 meta_data); 234 meta_data);
234 } 235 }
235 236
236 void ServiceWorkerGlobalScope::ExceptionThrown(ErrorEvent* event) { 237 void ServiceWorkerGlobalScope::ExceptionThrown(ErrorEvent* event) {
237 WorkerGlobalScope::ExceptionThrown(event); 238 WorkerGlobalScope::ExceptionThrown(event);
238 if (WorkerThreadDebugger* debugger = 239 if (WorkerThreadDebugger* debugger =
239 WorkerThreadDebugger::From(GetThread()->GetIsolate())) 240 WorkerThreadDebugger::From(GetThread()->GetIsolate()))
240 debugger->ExceptionThrown(GetThread(), event); 241 debugger->ExceptionThrown(GetThread(), event);
241 } 242 }
242 243
243 } // namespace blink 244 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698