| 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/embedded_worker_instance.h" | 5 #include "content/browser/service_worker/embedded_worker_instance.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 DCHECK(status_ == STARTING); | 284 DCHECK(status_ == STARTING); |
| 285 status_ = RUNNING; | 285 status_ = RUNNING; |
| 286 FOR_EACH_OBSERVER(Listener, listener_list_, OnStarted()); | 286 FOR_EACH_OBSERVER(Listener, listener_list_, OnStarted()); |
| 287 } | 287 } |
| 288 | 288 |
| 289 void EmbeddedWorkerInstance::OnStopped() { | 289 void EmbeddedWorkerInstance::OnStopped() { |
| 290 if (worker_devtools_agent_route_id_ != MSG_ROUTING_NONE) | 290 if (worker_devtools_agent_route_id_ != MSG_ROUTING_NONE) |
| 291 NotifyWorkerDestroyed(process_id_, worker_devtools_agent_route_id_); | 291 NotifyWorkerDestroyed(process_id_, worker_devtools_agent_route_id_); |
| 292 if (context_) | 292 if (context_) |
| 293 context_->process_manager()->ReleaseWorkerProcess(embedded_worker_id_); | 293 context_->process_manager()->ReleaseWorkerProcess(embedded_worker_id_); |
| 294 Status old_status = status_; |
| 294 status_ = STOPPED; | 295 status_ = STOPPED; |
| 295 process_id_ = -1; | 296 process_id_ = -1; |
| 296 thread_id_ = -1; | 297 thread_id_ = -1; |
| 297 worker_devtools_agent_route_id_ = MSG_ROUTING_NONE; | 298 worker_devtools_agent_route_id_ = MSG_ROUTING_NONE; |
| 298 start_callback_.Reset(); | 299 start_callback_.Reset(); |
| 299 FOR_EACH_OBSERVER(Listener, listener_list_, OnStopped()); | 300 FOR_EACH_OBSERVER(Listener, listener_list_, OnStopped(old_status)); |
| 300 } | 301 } |
| 301 | 302 |
| 302 void EmbeddedWorkerInstance::OnPausedAfterDownload() { | 303 void EmbeddedWorkerInstance::OnPausedAfterDownload() { |
| 303 // Stop can be requested before getting this far. | 304 // Stop can be requested before getting this far. |
| 304 if (status_ == STOPPING) | 305 if (status_ == STOPPING) |
| 305 return; | 306 return; |
| 306 DCHECK(status_ == STARTING); | 307 DCHECK(status_ == STARTING); |
| 307 FOR_EACH_OBSERVER(Listener, listener_list_, OnPausedAfterDownload()); | 308 FOR_EACH_OBSERVER(Listener, listener_list_, OnPausedAfterDownload()); |
| 308 } | 309 } |
| 309 | 310 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 343 |
| 343 void EmbeddedWorkerInstance::AddListener(Listener* listener) { | 344 void EmbeddedWorkerInstance::AddListener(Listener* listener) { |
| 344 listener_list_.AddObserver(listener); | 345 listener_list_.AddObserver(listener); |
| 345 } | 346 } |
| 346 | 347 |
| 347 void EmbeddedWorkerInstance::RemoveListener(Listener* listener) { | 348 void EmbeddedWorkerInstance::RemoveListener(Listener* listener) { |
| 348 listener_list_.RemoveObserver(listener); | 349 listener_list_.RemoveObserver(listener); |
| 349 } | 350 } |
| 350 | 351 |
| 351 } // namespace content | 352 } // namespace content |
| OLD | NEW |