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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 if (status() == RUNNING) { | 128 if (status() == RUNNING) { |
129 RunSoon(base::Bind(callback, SERVICE_WORKER_OK)); | 129 RunSoon(base::Bind(callback, SERVICE_WORKER_OK)); |
130 return; | 130 return; |
131 } | 131 } |
132 observer_.reset(new StartObserver(this, callback)); | 132 observer_.reset(new StartObserver(this, callback)); |
133 const bool started = embedded_worker_->Start( | 133 const bool started = embedded_worker_->Start( |
134 version_id_, | 134 version_id_, |
135 registration_->script_url()); | 135 registration_->script_url()); |
136 if (!started) { | 136 if (!started) { |
137 observer_.reset(); | 137 observer_.reset(); |
| 138 LOG(ERROR) << "Failed to start, for realz"; |
138 RunSoon(base::Bind(callback, SERVICE_WORKER_ERROR_START_WORKER_FAILED)); | 139 RunSoon(base::Bind(callback, SERVICE_WORKER_ERROR_START_WORKER_FAILED)); |
139 } | 140 } |
140 } | 141 } |
141 | 142 |
142 void ServiceWorkerVersion::StopWorker(const StatusCallback& callback) { | 143 void ServiceWorkerVersion::StopWorker(const StatusCallback& callback) { |
143 DCHECK(!is_shutdown_); | 144 DCHECK(!is_shutdown_); |
144 DCHECK(!observer_); | 145 DCHECK(!observer_); |
145 if (status() == STOPPED) { | 146 if (status() == STOPPED) { |
146 RunSoon(base::Bind(callback, SERVICE_WORKER_OK)); | 147 RunSoon(base::Bind(callback, SERVICE_WORKER_OK)); |
147 return; | 148 return; |
(...skipping 17 matching lines...) Expand all Loading... |
165 void ServiceWorkerVersion::AddProcessToWorker(int process_id) { | 166 void ServiceWorkerVersion::AddProcessToWorker(int process_id) { |
166 DCHECK(!is_shutdown_); | 167 DCHECK(!is_shutdown_); |
167 embedded_worker_->AddProcessReference(process_id); | 168 embedded_worker_->AddProcessReference(process_id); |
168 } | 169 } |
169 | 170 |
170 void ServiceWorkerVersion::RemoveProcessToWorker(int process_id) { | 171 void ServiceWorkerVersion::RemoveProcessToWorker(int process_id) { |
171 embedded_worker_->ReleaseProcessReference(process_id); | 172 embedded_worker_->ReleaseProcessReference(process_id); |
172 } | 173 } |
173 | 174 |
174 } // namespace content | 175 } // namespace content |
OLD | NEW |