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

Side by Side Diff: content/browser/service_worker/service_worker_version.cc

Issue 537123002: Trigger ServiceWorker updates upon navigation more quickly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/service_worker_version.h" 5 #include "content/browser/service_worker/service_worker_version.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "content/browser/service_worker/embedded_worker_instance.h" 10 #include "content/browser/service_worker/embedded_worker_instance.h"
(...skipping 11 matching lines...) Expand all
22 typedef ServiceWorkerVersion::MessageCallback MessageCallback; 22 typedef ServiceWorkerVersion::MessageCallback MessageCallback;
23 23
24 namespace { 24 namespace {
25 25
26 // Default delay for scheduled stop. 26 // Default delay for scheduled stop.
27 // (Note that if all references to the version is dropped the worker 27 // (Note that if all references to the version is dropped the worker
28 // is also stopped without delay) 28 // is also stopped without delay)
29 const int64 kStopWorkerDelay = 30; // 30 secs. 29 const int64 kStopWorkerDelay = 30; // 30 secs.
30 30
31 // Default delay for scheduled update. 31 // Default delay for scheduled update.
32 const int kUpdateDelaySeconds = 10; 32 const int kUpdateDelaySeconds = 1;
33 33
34 void RunSoon(const base::Closure& callback) { 34 void RunSoon(const base::Closure& callback) {
35 if (!callback.is_null()) 35 if (!callback.is_null())
36 base::MessageLoop::current()->PostTask(FROM_HERE, callback); 36 base::MessageLoop::current()->PostTask(FROM_HERE, callback);
37 } 37 }
38 38
39 template <typename CallbackArray, typename Arg> 39 template <typename CallbackArray, typename Arg>
40 void RunCallbacks(ServiceWorkerVersion* version, 40 void RunCallbacks(ServiceWorkerVersion* version,
41 CallbackArray* callbacks_ptr, 41 CallbackArray* callbacks_ptr,
42 const Arg& arg) { 42 const Arg& arg) {
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 SetStatus(REDUNDANT); 697 SetStatus(REDUNDANT);
698 StopWorker(base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); 698 StopWorker(base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
699 if (!context_) 699 if (!context_)
700 return; 700 return;
701 std::vector<ServiceWorkerDatabase::ResourceRecord> resources; 701 std::vector<ServiceWorkerDatabase::ResourceRecord> resources;
702 script_cache_map_.GetResources(&resources); 702 script_cache_map_.GetResources(&resources);
703 context_->storage()->PurgeResources(resources); 703 context_->storage()->PurgeResources(resources);
704 } 704 }
705 705
706 } // namespace content 706 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698