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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <map> | 10 #include <map> |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
489 TRACE_EVENT_INSTANT2("ServiceWorker", | 489 TRACE_EVENT_INSTANT2("ServiceWorker", |
490 "ServiceWorkerVersion::StopWorker (instant)", | 490 "ServiceWorkerVersion::StopWorker (instant)", |
491 TRACE_EVENT_SCOPE_THREAD, "Script", script_url_.spec(), | 491 TRACE_EVENT_SCOPE_THREAD, "Script", script_url_.spec(), |
492 "Status", VersionStatusToString(status_)); | 492 "Status", VersionStatusToString(status_)); |
493 | 493 |
494 if (running_status() == EmbeddedWorkerStatus::STOPPED) { | 494 if (running_status() == EmbeddedWorkerStatus::STOPPED) { |
495 RunSoon(base::Bind(callback, SERVICE_WORKER_OK)); | 495 RunSoon(base::Bind(callback, SERVICE_WORKER_OK)); |
496 return; | 496 return; |
497 } | 497 } |
498 | 498 |
499 if (stop_callbacks_.empty()) { | 499 if (running_status() == EmbeddedWorkerStatus::STARTING || |
500 running_status() == EmbeddedWorkerStatus::RUNNING) { | |
falken
2016/12/20 09:12:07
How about turning lines 494 and 499-500 into a swi
shimazu
2017/01/05 06:02:41
Done.
| |
500 ServiceWorkerStatusCode status = embedded_worker_->Stop(); | 501 ServiceWorkerStatusCode status = embedded_worker_->Stop(); |
501 if (status != SERVICE_WORKER_OK) { | 502 if (status != SERVICE_WORKER_OK) { |
502 RunSoon(base::Bind(callback, status)); | 503 RunSoon(base::Bind(callback, status)); |
503 return; | 504 return; |
504 } | 505 } |
505 } | 506 } |
506 stop_callbacks_.push_back(callback); | 507 stop_callbacks_.push_back(callback); |
507 } | 508 } |
508 | 509 |
509 void ServiceWorkerVersion::ScheduleUpdate() { | 510 void ServiceWorkerVersion::ScheduleUpdate() { |
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1864 | 1865 |
1865 void ServiceWorkerVersion::CleanUpExternalRequest( | 1866 void ServiceWorkerVersion::CleanUpExternalRequest( |
1866 const std::string& request_uuid, | 1867 const std::string& request_uuid, |
1867 ServiceWorkerStatusCode status) { | 1868 ServiceWorkerStatusCode status) { |
1868 if (status == SERVICE_WORKER_OK) | 1869 if (status == SERVICE_WORKER_OK) |
1869 return; | 1870 return; |
1870 external_request_uuid_to_request_id_.erase(request_uuid); | 1871 external_request_uuid_to_request_id_.erase(request_uuid); |
1871 } | 1872 } |
1872 | 1873 |
1873 } // namespace content | 1874 } // namespace content |
OLD | NEW |