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

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

Issue 717353004: ServiceWorker: Add support for .skipWaiting and controllerchange event(2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: do not replace other registerations Created 6 years, 1 month 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 // 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_provider_host.h" 5 #include "content/browser/service_worker/service_worker_provider_host.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "content/browser/message_port_message_filter.h" 8 #include "content/browser/message_port_message_filter.h"
9 #include "content/browser/service_worker/service_worker_context_core.h" 9 #include "content/browser/service_worker/service_worker_context_core.h"
10 #include "content/browser/service_worker/service_worker_context_request_handler. h" 10 #include "content/browser/service_worker/service_worker_context_request_handler. h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 DecreaseProcessReference(*it); 48 DecreaseProcessReference(*it);
49 } 49 }
50 } 50 }
51 51
52 void ServiceWorkerProviderHost::OnRegistrationFailed( 52 void ServiceWorkerProviderHost::OnRegistrationFailed(
53 ServiceWorkerRegistration* registration) { 53 ServiceWorkerRegistration* registration) {
54 DCHECK_EQ(associated_registration_.get(), registration); 54 DCHECK_EQ(associated_registration_.get(), registration);
55 DisassociateRegistration(); 55 DisassociateRegistration();
56 } 56 }
57 57
58 void ServiceWorkerProviderHost::OnSkippedWaiting(
59 ServiceWorkerRegistration* registration) {
60 CHECK_EQ(associated_registration_.get(), registration);
falken 2014/11/19 04:19:56 seems DCHECK_EQ is OK here
xiang 2014/11/24 07:04:00 Done.
61 scoped_refptr<ServiceWorkerVersion> waiting_version =
62 registration->waiting_version();
63 CHECK_EQ(waiting_version->status(), ServiceWorkerVersion::INSTALLED);
64 waiting_version->RegisterStatusChangeCallback(
65 base::Bind(&ServiceWorkerProviderHost::SetControllerVersionAttribute,
66 AsWeakPtr(), waiting_version));
falken 2014/11/19 04:19:56 It's subtle that OnSkippedWaiting is called just b
xiang 2014/11/24 07:04:00 Yes, you are right, we can move it after ACTIVATIN
67 }
68
58 void ServiceWorkerProviderHost::SetDocumentUrl(const GURL& url) { 69 void ServiceWorkerProviderHost::SetDocumentUrl(const GURL& url) {
59 DCHECK(!url.has_ref()); 70 DCHECK(!url.has_ref());
60 document_url_ = url; 71 document_url_ = url;
61 } 72 }
62 73
63 void ServiceWorkerProviderHost::SetTopmostFrameUrl(const GURL& url) { 74 void ServiceWorkerProviderHost::SetTopmostFrameUrl(const GURL& url) {
64 topmost_frame_url_ = url; 75 topmost_frame_url_ = url;
65 } 76 }
66 77
67 void ServiceWorkerProviderHost::SetControllerVersionAttribute( 78 void ServiceWorkerProviderHost::SetControllerVersionAttribute(
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 context_->process_manager()->RemoveProcessReferenceFromPattern( 255 context_->process_manager()->RemoveProcessReferenceFromPattern(
245 pattern, process_id_); 256 pattern, process_id_);
246 } 257 }
247 } 258 }
248 259
249 bool ServiceWorkerProviderHost::IsContextAlive() { 260 bool ServiceWorkerProviderHost::IsContextAlive() {
250 return context_ != NULL; 261 return context_ != NULL;
251 } 262 }
252 263
253 } // namespace content 264 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698