| 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 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1714 ServiceWorkerStatusCode ServiceWorkerVersion::PingWorker() { | 1714 ServiceWorkerStatusCode ServiceWorkerVersion::PingWorker() { |
| 1715 DCHECK(running_status() == EmbeddedWorkerStatus::STARTING || | 1715 DCHECK(running_status() == EmbeddedWorkerStatus::STARTING || |
| 1716 running_status() == EmbeddedWorkerStatus::RUNNING); | 1716 running_status() == EmbeddedWorkerStatus::RUNNING); |
| 1717 return embedded_worker_->SendMessage(ServiceWorkerMsg_Ping()); | 1717 return embedded_worker_->SendMessage(ServiceWorkerMsg_Ping()); |
| 1718 } | 1718 } |
| 1719 | 1719 |
| 1720 void ServiceWorkerVersion::OnPingTimeout() { | 1720 void ServiceWorkerVersion::OnPingTimeout() { |
| 1721 DCHECK(running_status() == EmbeddedWorkerStatus::STARTING || | 1721 DCHECK(running_status() == EmbeddedWorkerStatus::STARTING || |
| 1722 running_status() == EmbeddedWorkerStatus::RUNNING); | 1722 running_status() == EmbeddedWorkerStatus::RUNNING); |
| 1723 // TODO(falken): Change the error code to SERVICE_WORKER_ERROR_TIMEOUT. | 1723 // TODO(falken): Change the error code to SERVICE_WORKER_ERROR_TIMEOUT. |
| 1724 embedded_worker_->AddMessageToConsole(blink::WebConsoleMessage::LevelDebug, | 1724 embedded_worker_->AddMessageToConsole(blink::WebConsoleMessage::LevelVerbose, |
| 1725 kNotRespondingErrorMesage); | 1725 kNotRespondingErrorMesage); |
| 1726 StopWorkerIfIdle(); | 1726 StopWorkerIfIdle(); |
| 1727 } | 1727 } |
| 1728 | 1728 |
| 1729 void ServiceWorkerVersion::StopWorkerIfIdle() { | 1729 void ServiceWorkerVersion::StopWorkerIfIdle() { |
| 1730 if (HasWork() && !ping_controller_->IsTimedOut()) | 1730 if (HasWork() && !ping_controller_->IsTimedOut()) |
| 1731 return; | 1731 return; |
| 1732 if (running_status() == EmbeddedWorkerStatus::STOPPED || | 1732 if (running_status() == EmbeddedWorkerStatus::STOPPED || |
| 1733 running_status() == EmbeddedWorkerStatus::STOPPING || | 1733 running_status() == EmbeddedWorkerStatus::STOPPING || |
| 1734 !stop_callbacks_.empty()) { | 1734 !stop_callbacks_.empty()) { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1953 | 1953 |
| 1954 void ServiceWorkerVersion::CleanUpExternalRequest( | 1954 void ServiceWorkerVersion::CleanUpExternalRequest( |
| 1955 const std::string& request_uuid, | 1955 const std::string& request_uuid, |
| 1956 ServiceWorkerStatusCode status) { | 1956 ServiceWorkerStatusCode status) { |
| 1957 if (status == SERVICE_WORKER_OK) | 1957 if (status == SERVICE_WORKER_OK) |
| 1958 return; | 1958 return; |
| 1959 external_request_uuid_to_request_id_.erase(request_uuid); | 1959 external_request_uuid_to_request_id_.erase(request_uuid); |
| 1960 } | 1960 } |
| 1961 | 1961 |
| 1962 } // namespace content | 1962 } // namespace content |
| OLD | NEW |