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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 #include "content/browser/renderer_host/pepper/pepper_renderer_connection.h" | 87 #include "content/browser/renderer_host/pepper/pepper_renderer_connection.h" |
88 #include "content/browser/renderer_host/render_message_filter.h" | 88 #include "content/browser/renderer_host/render_message_filter.h" |
89 #include "content/browser/renderer_host/render_view_host_delegate.h" | 89 #include "content/browser/renderer_host/render_view_host_delegate.h" |
90 #include "content/browser/renderer_host/render_view_host_impl.h" | 90 #include "content/browser/renderer_host/render_view_host_impl.h" |
91 #include "content/browser/renderer_host/render_widget_helper.h" | 91 #include "content/browser/renderer_host/render_widget_helper.h" |
92 #include "content/browser/renderer_host/render_widget_host_impl.h" | 92 #include "content/browser/renderer_host/render_widget_host_impl.h" |
93 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" | 93 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" |
94 #include "content/browser/renderer_host/text_input_client_message_filter.h" | 94 #include "content/browser/renderer_host/text_input_client_message_filter.h" |
95 #include "content/browser/renderer_host/websocket_dispatcher_host.h" | 95 #include "content/browser/renderer_host/websocket_dispatcher_host.h" |
96 #include "content/browser/resolve_proxy_msg_helper.h" | 96 #include "content/browser/resolve_proxy_msg_helper.h" |
97 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host.
h" | |
98 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 97 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
99 #include "content/browser/service_worker/service_worker_dispatcher_host.h" | 98 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
100 #include "content/browser/speech/input_tag_speech_dispatcher_host.h" | 99 #include "content/browser/speech/input_tag_speech_dispatcher_host.h" |
101 #include "content/browser/speech/speech_recognition_dispatcher_host.h" | 100 #include "content/browser/speech/speech_recognition_dispatcher_host.h" |
102 #include "content/browser/storage_partition_impl.h" | 101 #include "content/browser/storage_partition_impl.h" |
103 #include "content/browser/streams/stream_context.h" | 102 #include "content/browser/streams/stream_context.h" |
104 #include "content/browser/tracing/trace_message_filter.h" | 103 #include "content/browser/tracing/trace_message_filter.h" |
105 #include "content/browser/vibration/vibration_message_filter.h" | 104 #include "content/browser/vibration/vibration_message_filter.h" |
106 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 105 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
107 #include "content/browser/worker_host/worker_message_filter.h" | 106 #include "content/browser/worker_host/worker_message_filter.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 storage_partition_impl_(storage_partition_impl), | 389 storage_partition_impl_(storage_partition_impl), |
391 sudden_termination_allowed_(true), | 390 sudden_termination_allowed_(true), |
392 ignore_input_events_(false), | 391 ignore_input_events_(false), |
393 supports_browser_plugin_(supports_browser_plugin), | 392 supports_browser_plugin_(supports_browser_plugin), |
394 is_guest_(is_guest), | 393 is_guest_(is_guest), |
395 gpu_observer_registered_(false), | 394 gpu_observer_registered_(false), |
396 delayed_cleanup_needed_(false), | 395 delayed_cleanup_needed_(false), |
397 within_process_died_observer_(false), | 396 within_process_died_observer_(false), |
398 power_monitor_broadcaster_(this), | 397 power_monitor_broadcaster_(this), |
399 geolocation_dispatcher_host_(NULL), | 398 geolocation_dispatcher_host_(NULL), |
400 weak_factory_(this), | 399 weak_factory_(this) { |
401 screen_orientation_dispatcher_host_(NULL) { | |
402 widget_helper_ = new RenderWidgetHelper(); | 400 widget_helper_ = new RenderWidgetHelper(); |
403 | 401 |
404 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); | 402 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); |
405 | 403 |
406 CHECK(!g_exited_main_message_loop); | 404 CHECK(!g_exited_main_message_loop); |
407 RegisterHost(GetID(), this); | 405 RegisterHost(GetID(), this); |
408 g_all_hosts.Get().set_check_on_null_data(true); | 406 g_all_hosts.Get().set_check_on_null_data(true); |
409 // Initialize |child_process_activity_time_| to a reasonable value. | 407 // Initialize |child_process_activity_time_| to a reasonable value. |
410 mark_child_process_activity_time(); | 408 mark_child_process_activity_time(); |
411 | 409 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 AddFilter(new DeviceMotionMessageFilter()); | 780 AddFilter(new DeviceMotionMessageFilter()); |
783 AddFilter(new DeviceOrientationMessageFilter()); | 781 AddFilter(new DeviceOrientationMessageFilter()); |
784 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); | 782 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); |
785 AddFilter(new HistogramMessageFilter()); | 783 AddFilter(new HistogramMessageFilter()); |
786 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) | 784 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) |
787 if (CommandLine::ForCurrentProcess()->HasSwitch( | 785 if (CommandLine::ForCurrentProcess()->HasSwitch( |
788 switches::kEnableMemoryBenchmarking)) | 786 switches::kEnableMemoryBenchmarking)) |
789 AddFilter(new MemoryBenchmarkMessageFilter()); | 787 AddFilter(new MemoryBenchmarkMessageFilter()); |
790 #endif | 788 #endif |
791 AddFilter(new VibrationMessageFilter()); | 789 AddFilter(new VibrationMessageFilter()); |
792 screen_orientation_dispatcher_host_ = new ScreenOrientationDispatcherHost(); | |
793 AddFilter(screen_orientation_dispatcher_host_); | |
794 } | 790 } |
795 | 791 |
796 int RenderProcessHostImpl::GetNextRoutingID() { | 792 int RenderProcessHostImpl::GetNextRoutingID() { |
797 return widget_helper_->GetNextRoutingID(); | 793 return widget_helper_->GetNextRoutingID(); |
798 } | 794 } |
799 | 795 |
800 | 796 |
801 void RenderProcessHostImpl::ResumeDeferredNavigation( | 797 void RenderProcessHostImpl::ResumeDeferredNavigation( |
802 const GlobalRequestID& request_id) { | 798 const GlobalRequestID& request_id) { |
803 widget_helper_->ResumeDeferredNavigation(request_id); | 799 widget_helper_->ResumeDeferredNavigation(request_id); |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 deleting_soon_ = true; | 1468 deleting_soon_ = true; |
1473 // It's important not to wait for the DeleteTask to delete the channel | 1469 // It's important not to wait for the DeleteTask to delete the channel |
1474 // proxy. Kill it off now. That way, in case the profile is going away, the | 1470 // proxy. Kill it off now. That way, in case the profile is going away, the |
1475 // rest of the objects attached to this RenderProcessHost start going | 1471 // rest of the objects attached to this RenderProcessHost start going |
1476 // away first, since deleting the channel proxy will post a | 1472 // away first, since deleting the channel proxy will post a |
1477 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. | 1473 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. |
1478 channel_.reset(); | 1474 channel_.reset(); |
1479 gpu_message_filter_ = NULL; | 1475 gpu_message_filter_ = NULL; |
1480 message_port_message_filter_ = NULL; | 1476 message_port_message_filter_ = NULL; |
1481 geolocation_dispatcher_host_ = NULL; | 1477 geolocation_dispatcher_host_ = NULL; |
1482 screen_orientation_dispatcher_host_ = NULL; | |
1483 | 1478 |
1484 // Remove ourself from the list of renderer processes so that we can't be | 1479 // Remove ourself from the list of renderer processes so that we can't be |
1485 // reused in between now and when the Delete task runs. | 1480 // reused in between now and when the Delete task runs. |
1486 UnregisterHost(GetID()); | 1481 UnregisterHost(GetID()); |
1487 } | 1482 } |
1488 } | 1483 } |
1489 | 1484 |
1490 void RenderProcessHostImpl::AddPendingView() { | 1485 void RenderProcessHostImpl::AddPendingView() { |
1491 pending_views_++; | 1486 pending_views_++; |
1492 } | 1487 } |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1860 FOR_EACH_OBSERVER(RenderProcessHostObserver, | 1855 FOR_EACH_OBSERVER(RenderProcessHostObserver, |
1861 observers_, | 1856 observers_, |
1862 RenderProcessExited(this, GetHandle(), status, exit_code)); | 1857 RenderProcessExited(this, GetHandle(), status, exit_code)); |
1863 within_process_died_observer_ = false; | 1858 within_process_died_observer_ = false; |
1864 | 1859 |
1865 child_process_launcher_.reset(); | 1860 child_process_launcher_.reset(); |
1866 channel_.reset(); | 1861 channel_.reset(); |
1867 gpu_message_filter_ = NULL; | 1862 gpu_message_filter_ = NULL; |
1868 message_port_message_filter_ = NULL; | 1863 message_port_message_filter_ = NULL; |
1869 geolocation_dispatcher_host_ = NULL; | 1864 geolocation_dispatcher_host_ = NULL; |
1870 screen_orientation_dispatcher_host_ = NULL; | |
1871 | 1865 |
1872 IDMap<IPC::Listener>::iterator iter(&listeners_); | 1866 IDMap<IPC::Listener>::iterator iter(&listeners_); |
1873 while (!iter.IsAtEnd()) { | 1867 while (!iter.IsAtEnd()) { |
1874 iter.GetCurrentValue()->OnMessageReceived( | 1868 iter.GetCurrentValue()->OnMessageReceived( |
1875 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(), | 1869 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(), |
1876 static_cast<int>(status), | 1870 static_cast<int>(status), |
1877 exit_code)); | 1871 exit_code)); |
1878 iter.Advance(); | 1872 iter.Advance(); |
1879 } | 1873 } |
1880 | 1874 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1924 } | 1918 } |
1925 | 1919 |
1926 #if defined(ENABLE_WEBRTC) | 1920 #if defined(ENABLE_WEBRTC) |
1927 void RenderProcessHostImpl::WebRtcLogMessage(const std::string& message) { | 1921 void RenderProcessHostImpl::WebRtcLogMessage(const std::string& message) { |
1928 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1922 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1929 if (!webrtc_log_message_callback_.is_null()) | 1923 if (!webrtc_log_message_callback_.is_null()) |
1930 webrtc_log_message_callback_.Run(message); | 1924 webrtc_log_message_callback_.Run(message); |
1931 } | 1925 } |
1932 #endif | 1926 #endif |
1933 | 1927 |
1934 scoped_refptr<ScreenOrientationDispatcherHost> | |
1935 RenderProcessHostImpl::screen_orientation_dispatcher_host() const { | |
1936 return make_scoped_refptr(screen_orientation_dispatcher_host_); | |
1937 } | |
1938 | |
1939 void RenderProcessHostImpl::OnShutdownRequest() { | 1928 void RenderProcessHostImpl::OnShutdownRequest() { |
1940 // Don't shut down if there are active RenderViews, or if there are pending | 1929 // Don't shut down if there are active RenderViews, or if there are pending |
1941 // RenderViews being swapped back in. | 1930 // RenderViews being swapped back in. |
1942 // In single process mode, we never shutdown the renderer. | 1931 // In single process mode, we never shutdown the renderer. |
1943 int num_active_views = GetActiveViewCount(); | 1932 int num_active_views = GetActiveViewCount(); |
1944 if (pending_views_ || num_active_views > 0 || run_renderer_in_process()) | 1933 if (pending_views_ || num_active_views > 0 || run_renderer_in_process()) |
1945 return; | 1934 return; |
1946 | 1935 |
1947 // Notify any contents that might have swapped out renderers from this | 1936 // Notify any contents that might have swapped out renderers from this |
1948 // process. They should not attempt to swap them back in. | 1937 // process. They should not attempt to swap them back in. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2076 return; | 2065 return; |
2077 Send(new MediaStreamMsg_EnableAecDump(file_for_transit)); | 2066 Send(new MediaStreamMsg_EnableAecDump(file_for_transit)); |
2078 } | 2067 } |
2079 | 2068 |
2080 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() { | 2069 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() { |
2081 Send(new MediaStreamMsg_DisableAecDump()); | 2070 Send(new MediaStreamMsg_DisableAecDump()); |
2082 } | 2071 } |
2083 #endif | 2072 #endif |
2084 | 2073 |
2085 } // namespace content | 2074 } // namespace content |
OLD | NEW |