| 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/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "content/browser/bad_message.h" |
| 14 #include "content/browser/child_process_security_policy_impl.h" | 15 #include "content/browser/child_process_security_policy_impl.h" |
| 15 #include "content/browser/message_port_message_filter.h" | 16 #include "content/browser/message_port_message_filter.h" |
| 16 #include "content/browser/message_port_service.h" | 17 #include "content/browser/message_port_service.h" |
| 17 #include "content/browser/service_worker/embedded_worker_instance.h" | 18 #include "content/browser/service_worker/embedded_worker_instance.h" |
| 18 #include "content/browser/service_worker/embedded_worker_registry.h" | 19 #include "content/browser/service_worker/embedded_worker_registry.h" |
| 19 #include "content/browser/service_worker/service_worker_context_core.h" | 20 #include "content/browser/service_worker/service_worker_context_core.h" |
| 20 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 21 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 21 #include "content/browser/service_worker/service_worker_registration.h" | 22 #include "content/browser/service_worker/service_worker_registration.h" |
| 22 #include "content/browser/service_worker/service_worker_utils.h" | 23 #include "content/browser/service_worker/service_worker_utils.h" |
| 23 #include "content/browser/storage_partition_impl.h" | 24 #include "content/browser/storage_partition_impl.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 242 |
| 242 GetContentClient()->browser()->OpenURL( | 243 GetContentClient()->browser()->OpenURL( |
| 243 browser_context, params, | 244 browser_context, params, |
| 244 base::Bind(&DidOpenURL, callback)); | 245 base::Bind(&DidOpenURL, callback)); |
| 245 } | 246 } |
| 246 | 247 |
| 247 void KillEmbeddedWorkerProcess(int process_id, ResultCode code) { | 248 void KillEmbeddedWorkerProcess(int process_id, ResultCode code) { |
| 248 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 249 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 249 RenderProcessHost* render_process_host = | 250 RenderProcessHost* render_process_host = |
| 250 RenderProcessHost::FromID(process_id); | 251 RenderProcessHost::FromID(process_id); |
| 251 if (render_process_host->GetHandle() != base::kNullProcessHandle) | 252 if (render_process_host->GetHandle() != base::kNullProcessHandle) { |
| 252 render_process_host->ReceivedBadMessage(); | 253 bad_message::ReceivedBadMessage(render_process_host, |
| 254 bad_message::SERVICE_WORKER_BAD_URL); |
| 255 } |
| 253 } | 256 } |
| 254 | 257 |
| 255 void ClearTick(base::TimeTicks* time) { | 258 void ClearTick(base::TimeTicks* time) { |
| 256 *time = base::TimeTicks(); | 259 *time = base::TimeTicks(); |
| 257 } | 260 } |
| 258 | 261 |
| 259 void RestartTick(base::TimeTicks* time) { | 262 void RestartTick(base::TimeTicks* time) { |
| 260 *time = base::TimeTicks().Now(); | 263 *time = base::TimeTicks().Now(); |
| 261 } | 264 } |
| 262 | 265 |
| (...skipping 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1652 int request_id) { | 1655 int request_id) { |
| 1653 callbacks->Remove(request_id); | 1656 callbacks->Remove(request_id); |
| 1654 if (is_doomed_) { | 1657 if (is_doomed_) { |
| 1655 // The stop should be already scheduled, but try to stop immediately, in | 1658 // The stop should be already scheduled, but try to stop immediately, in |
| 1656 // order to release worker resources soon. | 1659 // order to release worker resources soon. |
| 1657 StopWorkerIfIdle(); | 1660 StopWorkerIfIdle(); |
| 1658 } | 1661 } |
| 1659 } | 1662 } |
| 1660 | 1663 |
| 1661 } // namespace content | 1664 } // namespace content |
| OLD | NEW |