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