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