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

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

Issue 369063004: ServiceWorker: SWRegisterJob should manage status of SWVersion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 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_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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 scoped_refptr<ServiceWorkerVersion> previous_version = installing_version_; 89 scoped_refptr<ServiceWorkerVersion> previous_version = installing_version_;
90 installing_version_ = version; 90 installing_version_ = version;
91 if (version) 91 if (version)
92 version->AddPotentialControllee(this); 92 version->AddPotentialControllee(this);
93 if (previous_version) 93 if (previous_version)
94 previous_version->RemovePotentialControllee(this); 94 previous_version->RemovePotentialControllee(this);
95 95
96 if (!dispatcher_host_) 96 if (!dispatcher_host_)
97 return; // Could be NULL in some tests. 97 return; // Could be NULL in some tests.
98 98
99 // TODO(michaeln): Update once the renderer side understands the .installing 99 // TODO(michaeln,nhiroki): Send SetInstallingServiceWorker msg once the
100 // attribute value. 100 // renderer side understands the .installing attribute value.
101 dispatcher_host_->Send(new ServiceWorkerMsg_SetWaitingServiceWorker(
102 kDocumentMainThreadId, provider_id(), CreateHandleAndPass(version)));
103 } 101 }
104 102
105 void ServiceWorkerProviderHost::UnsetVersion(ServiceWorkerVersion* version) { 103 void ServiceWorkerProviderHost::UnsetVersion(ServiceWorkerVersion* version) {
106 if (!version) 104 if (!version)
107 return; 105 return;
108 if (installing_version_ == version) 106 if (installing_version_ == version)
109 SetInstallingVersion(NULL); 107 SetInstallingVersion(NULL);
110 else if (waiting_version_ == version) 108 else if (waiting_version_ == version)
111 SetWaitingVersion(NULL); 109 SetWaitingVersion(NULL);
112 else if (active_version_ == version) 110 else if (active_version_ == version)
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 dispatcher_host_->RegisterServiceWorkerHandle(handle.Pass()); 203 dispatcher_host_->RegisterServiceWorkerHandle(handle.Pass());
206 } 204 }
207 return info; 205 return info;
208 } 206 }
209 207
210 bool ServiceWorkerProviderHost::IsContextAlive() { 208 bool ServiceWorkerProviderHost::IsContextAlive() {
211 return context_ != NULL; 209 return context_ != NULL;
212 } 210 }
213 211
214 } // namespace content 212 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698