OLD | NEW |
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/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "content/browser/service_worker/embedded_worker_instance.h" | 8 #include "content/browser/service_worker/embedded_worker_instance.h" |
9 #include "content/browser/service_worker/embedded_worker_registry.h" | 9 #include "content/browser/service_worker/embedded_worker_registry.h" |
10 #include "content/browser/service_worker/service_worker_context_core.h" | 10 #include "content/browser/service_worker/service_worker_context_core.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 if (registration) { | 175 if (registration) { |
176 registration_id_ = registration->id(); | 176 registration_id_ = registration->id(); |
177 script_url_ = registration->script_url(); | 177 script_url_ = registration->script_url(); |
178 } | 178 } |
179 context_->AddLiveVersion(this); | 179 context_->AddLiveVersion(this); |
180 embedded_worker_ = context_->embedded_worker_registry()->CreateWorker(); | 180 embedded_worker_ = context_->embedded_worker_registry()->CreateWorker(); |
181 embedded_worker_->AddObserver(this); | 181 embedded_worker_->AddObserver(this); |
182 } | 182 } |
183 | 183 |
184 ServiceWorkerVersion::~ServiceWorkerVersion() { | 184 ServiceWorkerVersion::~ServiceWorkerVersion() { |
185 status_change_callbacks_.clear(); | |
186 if (embedded_worker_) { | 185 if (embedded_worker_) { |
187 embedded_worker_->RemoveObserver(this); | 186 embedded_worker_->RemoveObserver(this); |
188 embedded_worker_.reset(); | 187 embedded_worker_.reset(); |
189 } | 188 } |
190 if (context_) | 189 if (context_) |
191 context_->RemoveLiveVersion(version_id_); | 190 context_->RemoveLiveVersion(version_id_); |
192 } | 191 } |
193 | 192 |
194 void ServiceWorkerVersion::SetStatus(Status status) { | 193 void ServiceWorkerVersion::SetStatus(Status status) { |
195 status_ = status; | 194 status_ = status; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 scoped_refptr<ServiceWorkerVersion> protect(this); | 391 scoped_refptr<ServiceWorkerVersion> protect(this); |
393 callback->Run(SERVICE_WORKER_OK, message); | 392 callback->Run(SERVICE_WORKER_OK, message); |
394 message_callbacks_.Remove(request_id); | 393 message_callbacks_.Remove(request_id); |
395 return; | 394 return; |
396 } | 395 } |
397 NOTREACHED() << "Got unexpected message: " << request_id | 396 NOTREACHED() << "Got unexpected message: " << request_id |
398 << " " << message.type(); | 397 << " " << message.type(); |
399 } | 398 } |
400 | 399 |
401 } // namespace content | 400 } // namespace content |
OLD | NEW |