| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
| 6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
| 7 | 7 |
| 8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "base/strings/string_util.h" | 29 #include "base/strings/string_util.h" |
| 30 #include "base/supports_user_data.h" | 30 #include "base/supports_user_data.h" |
| 31 #include "base/sys_info.h" | 31 #include "base/sys_info.h" |
| 32 #include "base/threading/thread.h" | 32 #include "base/threading/thread.h" |
| 33 #include "base/threading/thread_restrictions.h" | 33 #include "base/threading/thread_restrictions.h" |
| 34 #include "base/trace_event/trace_event.h" | 34 #include "base/trace_event/trace_event.h" |
| 35 #include "base/tracked_objects.h" | 35 #include "base/tracked_objects.h" |
| 36 #include "cc/base/switches.h" | 36 #include "cc/base/switches.h" |
| 37 #include "content/browser/appcache/appcache_dispatcher_host.h" | 37 #include "content/browser/appcache/appcache_dispatcher_host.h" |
| 38 #include "content/browser/appcache/chrome_appcache_service.h" | 38 #include "content/browser/appcache/chrome_appcache_service.h" |
| 39 #include "content/browser/bad_message.h" |
| 39 #include "content/browser/bluetooth/bluetooth_dispatcher_host.h" | 40 #include "content/browser/bluetooth/bluetooth_dispatcher_host.h" |
| 40 #include "content/browser/browser_child_process_host_impl.h" | 41 #include "content/browser/browser_child_process_host_impl.h" |
| 41 #include "content/browser/browser_main.h" | 42 #include "content/browser/browser_main.h" |
| 42 #include "content/browser/browser_main_loop.h" | 43 #include "content/browser/browser_main_loop.h" |
| 43 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" | 44 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" |
| 44 #include "content/browser/child_process_security_policy_impl.h" | 45 #include "content/browser/child_process_security_policy_impl.h" |
| 45 #include "content/browser/device_sensors/device_light_message_filter.h" | 46 #include "content/browser/device_sensors/device_light_message_filter.h" |
| 46 #include "content/browser/device_sensors/device_motion_message_filter.h" | 47 #include "content/browser/device_sensors/device_motion_message_filter.h" |
| 47 #include "content/browser/device_sensors/device_orientation_message_filter.h" | 48 #include "content/browser/device_sensors/device_orientation_message_filter.h" |
| 48 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 49 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 | 1047 |
| 1047 void RenderProcessHostImpl::AddObserver(RenderProcessHostObserver* observer) { | 1048 void RenderProcessHostImpl::AddObserver(RenderProcessHostObserver* observer) { |
| 1048 observers_.AddObserver(observer); | 1049 observers_.AddObserver(observer); |
| 1049 } | 1050 } |
| 1050 | 1051 |
| 1051 void RenderProcessHostImpl::RemoveObserver( | 1052 void RenderProcessHostImpl::RemoveObserver( |
| 1052 RenderProcessHostObserver* observer) { | 1053 RenderProcessHostObserver* observer) { |
| 1053 observers_.RemoveObserver(observer); | 1054 observers_.RemoveObserver(observer); |
| 1054 } | 1055 } |
| 1055 | 1056 |
| 1056 void RenderProcessHostImpl::ReceivedBadMessage() { | 1057 void RenderProcessHostImpl::ShutdownForBadMessage() { |
| 1057 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 1058 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 1058 if (command_line->HasSwitch(switches::kDisableKillAfterBadIPC)) | 1059 if (command_line->HasSwitch(switches::kDisableKillAfterBadIPC)) |
| 1059 return; | 1060 return; |
| 1060 | 1061 |
| 1061 if (run_renderer_in_process()) { | 1062 if (run_renderer_in_process()) { |
| 1062 // In single process mode it is better if we don't suicide but just | 1063 // In single process mode it is better if we don't suicide but just |
| 1063 // crash. | 1064 // crash. |
| 1064 CHECK(false); | 1065 CHECK(false); |
| 1065 } | 1066 } |
| 1066 // We kill the renderer but don't include a NOTREACHED, because we want the | 1067 // We kill the renderer but don't include a NOTREACHED, because we want the |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 void RenderProcessHostImpl::OnChannelError() { | 1564 void RenderProcessHostImpl::OnChannelError() { |
| 1564 ProcessDied(true /* already_dead */, nullptr); | 1565 ProcessDied(true /* already_dead */, nullptr); |
| 1565 } | 1566 } |
| 1566 | 1567 |
| 1567 void RenderProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) { | 1568 void RenderProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) { |
| 1568 // Message de-serialization failed. We consider this a capital crime. Kill the | 1569 // Message de-serialization failed. We consider this a capital crime. Kill the |
| 1569 // renderer if we have one. | 1570 // renderer if we have one. |
| 1570 LOG(ERROR) << "bad message " << message.type() << " terminating renderer."; | 1571 LOG(ERROR) << "bad message " << message.type() << " terminating renderer."; |
| 1571 BrowserChildProcessHostImpl::HistogramBadMessageTerminated( | 1572 BrowserChildProcessHostImpl::HistogramBadMessageTerminated( |
| 1572 PROCESS_TYPE_RENDERER); | 1573 PROCESS_TYPE_RENDERER); |
| 1573 ReceivedBadMessage(); | 1574 bad_message::ReceivedBadMessage(this, |
| 1575 bad_message::RPH_DESERIALIZATION_FAILED); |
| 1574 } | 1576 } |
| 1575 | 1577 |
| 1576 BrowserContext* RenderProcessHostImpl::GetBrowserContext() const { | 1578 BrowserContext* RenderProcessHostImpl::GetBrowserContext() const { |
| 1577 return browser_context_; | 1579 return browser_context_; |
| 1578 } | 1580 } |
| 1579 | 1581 |
| 1580 bool RenderProcessHostImpl::InSameStoragePartition( | 1582 bool RenderProcessHostImpl::InSameStoragePartition( |
| 1581 StoragePartition* partition) const { | 1583 StoragePartition* partition) const { |
| 1582 return storage_partition_impl_ == partition; | 1584 return storage_partition_impl_ == partition; |
| 1583 } | 1585 } |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2455 if (worker_ref_count_ == 0) | 2457 if (worker_ref_count_ == 0) |
| 2456 Cleanup(); | 2458 Cleanup(); |
| 2457 } | 2459 } |
| 2458 | 2460 |
| 2459 void RenderProcessHostImpl::GetAudioOutputControllers( | 2461 void RenderProcessHostImpl::GetAudioOutputControllers( |
| 2460 const GetAudioOutputControllersCallback& callback) const { | 2462 const GetAudioOutputControllersCallback& callback) const { |
| 2461 audio_renderer_host()->GetOutputControllers(callback); | 2463 audio_renderer_host()->GetOutputControllers(callback); |
| 2462 } | 2464 } |
| 2463 | 2465 |
| 2464 } // namespace content | 2466 } // namespace content |
| OLD | NEW |