| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "content/browser/service_worker/embedded_worker_instance.h" | 10 #include "content/browser/service_worker/embedded_worker_instance.h" |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 if (!HasControllee()) | 336 if (!HasControllee()) |
| 337 ScheduleStopWorker(); | 337 ScheduleStopWorker(); |
| 338 // TODO(kinuko): Fire NoControllees notification when the # of controllees | 338 // TODO(kinuko): Fire NoControllees notification when the # of controllees |
| 339 // reaches 0, so that a new pending version can be activated (which will | 339 // reaches 0, so that a new pending version can be activated (which will |
| 340 // deactivate this version). | 340 // deactivate this version). |
| 341 // TODO(michaeln): On no controllees call storage DeleteVersionResources | 341 // TODO(michaeln): On no controllees call storage DeleteVersionResources |
| 342 // if this version has been deactivated. Probably storage can listen for | 342 // if this version has been deactivated. Probably storage can listen for |
| 343 // NoControllees for versions that have been deleted. | 343 // NoControllees for versions that have been deleted. |
| 344 } | 344 } |
| 345 | 345 |
| 346 void ServiceWorkerVersion::AddPendingControllee( | 346 void ServiceWorkerVersion::AddWaitingControllee( |
| 347 ServiceWorkerProviderHost* provider_host) { | 347 ServiceWorkerProviderHost* provider_host) { |
| 348 AddProcessToWorker(provider_host->process_id()); | 348 AddProcessToWorker(provider_host->process_id()); |
| 349 } | 349 } |
| 350 | 350 |
| 351 void ServiceWorkerVersion::RemovePendingControllee( | 351 void ServiceWorkerVersion::RemoveWaitingControllee( |
| 352 ServiceWorkerProviderHost* provider_host) { | 352 ServiceWorkerProviderHost* provider_host) { |
| 353 RemoveProcessFromWorker(provider_host->process_id()); | 353 RemoveProcessFromWorker(provider_host->process_id()); |
| 354 } | 354 } |
| 355 | 355 |
| 356 void ServiceWorkerVersion::AddListener(Listener* listener) { | 356 void ServiceWorkerVersion::AddListener(Listener* listener) { |
| 357 listeners_.AddObserver(listener); | 357 listeners_.AddObserver(listener); |
| 358 } | 358 } |
| 359 | 359 |
| 360 void ServiceWorkerVersion::RemoveListener(Listener* listener) { | 360 void ServiceWorkerVersion::RemoveListener(Listener* listener) { |
| 361 listeners_.RemoveObserver(listener); | 361 listeners_.RemoveObserver(listener); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 return; | 581 return; |
| 582 } | 582 } |
| 583 stop_worker_timer_.Start( | 583 stop_worker_timer_.Start( |
| 584 FROM_HERE, base::TimeDelta::FromSeconds(kStopWorkerDelay), | 584 FROM_HERE, base::TimeDelta::FromSeconds(kStopWorkerDelay), |
| 585 base::Bind(&ServiceWorkerVersion::StopWorker, | 585 base::Bind(&ServiceWorkerVersion::StopWorker, |
| 586 weak_factory_.GetWeakPtr(), | 586 weak_factory_.GetWeakPtr(), |
| 587 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback))); | 587 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback))); |
| 588 } | 588 } |
| 589 | 589 |
| 590 } // namespace content | 590 } // namespace content |
| OLD | NEW |