| 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/child_process_security_policy_impl.h" | 14 #include "content/browser/child_process_security_policy_impl.h" |
| 15 #include "content/browser/message_port_message_filter.h" | 15 #include "content/browser/message_port_message_filter.h" |
| 16 #include "content/browser/message_port_service.h" | 16 #include "content/browser/message_port_service.h" |
| 17 #include "content/browser/service_worker/embedded_worker_instance.h" | 17 #include "content/browser/service_worker/embedded_worker_instance.h" |
| 18 #include "content/browser/service_worker/embedded_worker_registry.h" | 18 #include "content/browser/service_worker/embedded_worker_registry.h" |
| 19 #include "content/browser/service_worker/service_worker_context_core.h" | 19 #include "content/browser/service_worker/service_worker_context_core.h" |
| 20 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 20 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 21 #include "content/browser/service_worker/service_worker_registration.h" | 21 #include "content/browser/service_worker/service_worker_registration.h" |
| 22 #include "content/browser/service_worker/service_worker_utils.h" | 22 #include "content/browser/service_worker/service_worker_utils.h" |
| 23 #include "content/browser/storage_partition_impl.h" | 23 #include "content/browser/storage_partition_impl.h" |
| 24 #include "content/common/service_worker/service_worker_messages.h" | 24 #include "content/common/service_worker/service_worker_messages.h" |
| 25 #include "content/public/browser/bad_message.h" |
| 25 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
| 26 #include "content/public/browser/content_browser_client.h" | 27 #include "content/public/browser/content_browser_client.h" |
| 27 #include "content/public/browser/page_navigator.h" | 28 #include "content/public/browser/page_navigator.h" |
| 28 #include "content/public/browser/render_frame_host.h" | 29 #include "content/public/browser/render_frame_host.h" |
| 29 #include "content/public/browser/render_process_host.h" | 30 #include "content/public/browser/render_process_host.h" |
| 30 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
| 31 #include "content/public/browser/web_contents_observer.h" | 32 #include "content/public/browser/web_contents_observer.h" |
| 32 #include "content/public/common/child_process_host.h" | 33 #include "content/public/common/child_process_host.h" |
| 33 #include "content/public/common/content_client.h" | 34 #include "content/public/common/content_client.h" |
| 34 #include "content/public/common/content_switches.h" | 35 #include "content/public/common/content_switches.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 GetContentClient()->browser()->OpenURL( | 236 GetContentClient()->browser()->OpenURL( |
| 236 browser_context, params, | 237 browser_context, params, |
| 237 base::Bind(&DidOpenURL, callback)); | 238 base::Bind(&DidOpenURL, callback)); |
| 238 } | 239 } |
| 239 | 240 |
| 240 void KillEmbeddedWorkerProcess(int process_id, ResultCode code) { | 241 void KillEmbeddedWorkerProcess(int process_id, ResultCode code) { |
| 241 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 242 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 242 RenderProcessHost* render_process_host = | 243 RenderProcessHost* render_process_host = |
| 243 RenderProcessHost::FromID(process_id); | 244 RenderProcessHost::FromID(process_id); |
| 244 if (render_process_host->GetHandle() != base::kNullProcessHandle) | 245 if (render_process_host->GetHandle() != base::kNullProcessHandle) |
| 245 render_process_host->ReceivedBadMessage(); | 246 render_process_host->ReceivedBadMessage(BadMessage::SERVICE_WORKER_BAD_URL); |
| 246 } | 247 } |
| 247 | 248 |
| 248 void ClearTick(base::TimeTicks* time) { | 249 void ClearTick(base::TimeTicks* time) { |
| 249 *time = base::TimeTicks(); | 250 *time = base::TimeTicks(); |
| 250 } | 251 } |
| 251 | 252 |
| 252 void RestartTick(base::TimeTicks* time) { | 253 void RestartTick(base::TimeTicks* time) { |
| 253 *time = base::TimeTicks().Now(); | 254 *time = base::TimeTicks().Now(); |
| 254 } | 255 } |
| 255 | 256 |
| (...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 int request_id) { | 1612 int request_id) { |
| 1612 callbacks->Remove(request_id); | 1613 callbacks->Remove(request_id); |
| 1613 if (is_doomed_) { | 1614 if (is_doomed_) { |
| 1614 // The stop should be already scheduled, but try to stop immediately, in | 1615 // The stop should be already scheduled, but try to stop immediately, in |
| 1615 // order to release worker resources soon. | 1616 // order to release worker resources soon. |
| 1616 StopWorkerIfIdle(); | 1617 StopWorkerIfIdle(); |
| 1617 } | 1618 } |
| 1618 } | 1619 } |
| 1619 | 1620 |
| 1620 } // namespace content | 1621 } // namespace content |
| OLD | NEW |