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

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

Issue 305723003: Shut down the ServiceWorker system as the browser's shutting down. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove a redundant clear() Created 6 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 | Annotate | Revision Log
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_register_job.h" 5 #include "content/browser/service_worker/service_worker_register_job.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "content/browser/service_worker/service_worker_context_core.h" 10 #include "content/browser/service_worker/service_worker_context_core.h"
(...skipping 20 matching lines...) Expand all
31 const GURL& script_url) 31 const GURL& script_url)
32 : context_(context), 32 : context_(context),
33 pattern_(pattern), 33 pattern_(pattern),
34 script_url_(script_url), 34 script_url_(script_url),
35 phase_(INITIAL), 35 phase_(INITIAL),
36 is_promise_resolved_(false), 36 is_promise_resolved_(false),
37 promise_resolved_status_(SERVICE_WORKER_OK), 37 promise_resolved_status_(SERVICE_WORKER_OK),
38 weak_factory_(this) {} 38 weak_factory_(this) {}
39 39
40 ServiceWorkerRegisterJob::~ServiceWorkerRegisterJob() { 40 ServiceWorkerRegisterJob::~ServiceWorkerRegisterJob() {
41 DCHECK(phase_ == INITIAL || phase_ == COMPLETE); 41 DCHECK(!context_ || phase_ == INITIAL || phase_ == COMPLETE)
42 << "Jobs should only be interrupted during shutdown.";
42 } 43 }
43 44
44 void ServiceWorkerRegisterJob::AddCallback(const RegistrationCallback& callback, 45 void ServiceWorkerRegisterJob::AddCallback(const RegistrationCallback& callback,
45 int process_id) { 46 int process_id) {
46 if (!is_promise_resolved_) { 47 if (!is_promise_resolved_) {
47 callbacks_.push_back(callback); 48 callbacks_.push_back(callback);
48 if (process_id != -1 && (phase_ < UPDATE || !pending_version())) 49 if (process_id != -1 && (phase_ < UPDATE || !pending_version()))
49 pending_process_ids_.push_back(process_id); 50 pending_process_ids_.push_back(process_id);
50 return; 51 return;
51 } 52 }
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 !it->IsAtEnd(); 407 !it->IsAtEnd();
407 it->Advance()) { 408 it->Advance()) {
408 ServiceWorkerProviderHost* provider_host = it->GetProviderHost(); 409 ServiceWorkerProviderHost* provider_host = it->GetProviderHost();
409 if (ServiceWorkerUtils::ScopeMatches(pattern_, 410 if (ServiceWorkerUtils::ScopeMatches(pattern_,
410 provider_host->document_url())) 411 provider_host->document_url()))
411 provider_host->SetPendingVersion(version); 412 provider_host->SetPendingVersion(version);
412 } 413 }
413 } 414 }
414 415
415 } // namespace content 416 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_process_manager.cc ('k') | content/public/browser/service_worker_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698