Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 176963016: Chromium plumbing for Screen Orientation API orientationchange events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 deleting_soon_ = true; 1470 deleting_soon_ = true;
1467 // It's important not to wait for the DeleteTask to delete the channel 1471 // It's important not to wait for the DeleteTask to delete the channel
1468 // proxy. Kill it off now. That way, in case the profile is going away, the 1472 // proxy. Kill it off now. That way, in case the profile is going away, the
1469 // rest of the objects attached to this RenderProcessHost start going 1473 // rest of the objects attached to this RenderProcessHost start going
1470 // away first, since deleting the channel proxy will post a 1474 // away first, since deleting the channel proxy will post a
1471 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. 1475 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread.
1472 channel_.reset(); 1476 channel_.reset();
1473 gpu_message_filter_ = NULL; 1477 gpu_message_filter_ = NULL;
1474 message_port_message_filter_ = NULL; 1478 message_port_message_filter_ = NULL;
1475 geolocation_dispatcher_host_ = NULL; 1479 geolocation_dispatcher_host_ = NULL;
1480 screen_orientation_dispatcher_host_ = NULL;
1476 1481
1477 // Remove ourself from the list of renderer processes so that we can't be 1482 // Remove ourself from the list of renderer processes so that we can't be
1478 // reused in between now and when the Delete task runs. 1483 // reused in between now and when the Delete task runs.
1479 UnregisterHost(GetID()); 1484 UnregisterHost(GetID());
1480 } 1485 }
1481 } 1486 }
1482 1487
1483 void RenderProcessHostImpl::AddPendingView() { 1488 void RenderProcessHostImpl::AddPendingView() {
1484 pending_views_++; 1489 pending_views_++;
1485 } 1490 }
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 FOR_EACH_OBSERVER(RenderProcessHostObserver, 1858 FOR_EACH_OBSERVER(RenderProcessHostObserver,
1854 observers_, 1859 observers_,
1855 RenderProcessExited(this, GetHandle(), status, exit_code)); 1860 RenderProcessExited(this, GetHandle(), status, exit_code));
1856 within_process_died_observer_ = false; 1861 within_process_died_observer_ = false;
1857 1862
1858 child_process_launcher_.reset(); 1863 child_process_launcher_.reset();
1859 channel_.reset(); 1864 channel_.reset();
1860 gpu_message_filter_ = NULL; 1865 gpu_message_filter_ = NULL;
1861 message_port_message_filter_ = NULL; 1866 message_port_message_filter_ = NULL;
1862 geolocation_dispatcher_host_ = NULL; 1867 geolocation_dispatcher_host_ = NULL;
1868 screen_orientation_dispatcher_host_ = NULL;
1863 1869
1864 IDMap<IPC::Listener>::iterator iter(&listeners_); 1870 IDMap<IPC::Listener>::iterator iter(&listeners_);
1865 while (!iter.IsAtEnd()) { 1871 while (!iter.IsAtEnd()) {
1866 iter.GetCurrentValue()->OnMessageReceived( 1872 iter.GetCurrentValue()->OnMessageReceived(
1867 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(), 1873 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(),
1868 static_cast<int>(status), 1874 static_cast<int>(status),
1869 exit_code)); 1875 exit_code));
1870 iter.Advance(); 1876 iter.Advance();
1871 } 1877 }
1872 1878
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 } 1922 }
1917 1923
1918 #if defined(ENABLE_WEBRTC) 1924 #if defined(ENABLE_WEBRTC)
1919 void RenderProcessHostImpl::WebRtcLogMessage(const std::string& message) { 1925 void RenderProcessHostImpl::WebRtcLogMessage(const std::string& message) {
1920 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1926 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1921 if (!webrtc_log_message_callback_.is_null()) 1927 if (!webrtc_log_message_callback_.is_null())
1922 webrtc_log_message_callback_.Run(message); 1928 webrtc_log_message_callback_.Run(message);
1923 } 1929 }
1924 #endif 1930 #endif
1925 1931
1932 scoped_refptr<ScreenOrientationDispatcherHost>
1933 RenderProcessHostImpl::screen_orientation_dispatcher_host() const {
1934 return make_scoped_refptr(screen_orientation_dispatcher_host_);
1935 }
1936
1926 void RenderProcessHostImpl::OnShutdownRequest() { 1937 void RenderProcessHostImpl::OnShutdownRequest() {
1927 // Don't shut down if there are active RenderViews, or if there are pending 1938 // Don't shut down if there are active RenderViews, or if there are pending
1928 // RenderViews being swapped back in. 1939 // RenderViews being swapped back in.
1929 // In single process mode, we never shutdown the renderer. 1940 // In single process mode, we never shutdown the renderer.
1930 int num_active_views = GetActiveViewCount(); 1941 int num_active_views = GetActiveViewCount();
1931 if (pending_views_ || num_active_views > 0 || run_renderer_in_process()) 1942 if (pending_views_ || num_active_views > 0 || run_renderer_in_process())
1932 return; 1943 return;
1933 1944
1934 // Notify any contents that might have swapped out renderers from this 1945 // Notify any contents that might have swapped out renderers from this
1935 // process. They should not attempt to swap them back in. 1946 // process. They should not attempt to swap them back in.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2063 return; 2074 return;
2064 Send(new MediaStreamMsg_EnableAecDump(file_for_transit)); 2075 Send(new MediaStreamMsg_EnableAecDump(file_for_transit));
2065 } 2076 }
2066 2077
2067 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() { 2078 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() {
2068 Send(new MediaStreamMsg_DisableAecDump()); 2079 Send(new MediaStreamMsg_DisableAecDump());
2069 } 2080 }
2070 #endif 2081 #endif
2071 2082
2072 } // namespace content 2083 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698