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

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

Issue 164913004: Chromium plumbing for Screen Orientation API orientationchange events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated Created 6 years, 10 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 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 deleting_soon_ = true; 1479 deleting_soon_ = true;
1476 // It's important not to wait for the DeleteTask to delete the channel 1480 // It's important not to wait for the DeleteTask to delete the channel
1477 // proxy. Kill it off now. That way, in case the profile is going away, the 1481 // proxy. Kill it off now. That way, in case the profile is going away, the
1478 // rest of the objects attached to this RenderProcessHost start going 1482 // rest of the objects attached to this RenderProcessHost start going
1479 // away first, since deleting the channel proxy will post a 1483 // away first, since deleting the channel proxy will post a
1480 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. 1484 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread.
1481 channel_.reset(); 1485 channel_.reset();
1482 gpu_message_filter_ = NULL; 1486 gpu_message_filter_ = NULL;
1483 message_port_message_filter_ = NULL; 1487 message_port_message_filter_ = NULL;
1484 geolocation_dispatcher_host_ = NULL; 1488 geolocation_dispatcher_host_ = NULL;
1489 screen_orientation_dispatcher_host_ = NULL;
1485 1490
1486 // Remove ourself from the list of renderer processes so that we can't be 1491 // Remove ourself from the list of renderer processes so that we can't be
1487 // reused in between now and when the Delete task runs. 1492 // reused in between now and when the Delete task runs.
1488 UnregisterHost(GetID()); 1493 UnregisterHost(GetID());
1489 } 1494 }
1490 } 1495 }
1491 1496
1492 void RenderProcessHostImpl::AddPendingView() { 1497 void RenderProcessHostImpl::AddPendingView() {
1493 pending_views_++; 1498 pending_views_++;
1494 } 1499 }
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 FOR_EACH_OBSERVER(RenderProcessHostObserver, 1867 FOR_EACH_OBSERVER(RenderProcessHostObserver,
1863 observers_, 1868 observers_,
1864 RenderProcessExited(this, GetHandle(), status, exit_code)); 1869 RenderProcessExited(this, GetHandle(), status, exit_code));
1865 within_process_died_observer_ = false; 1870 within_process_died_observer_ = false;
1866 1871
1867 child_process_launcher_.reset(); 1872 child_process_launcher_.reset();
1868 channel_.reset(); 1873 channel_.reset();
1869 gpu_message_filter_ = NULL; 1874 gpu_message_filter_ = NULL;
1870 message_port_message_filter_ = NULL; 1875 message_port_message_filter_ = NULL;
1871 geolocation_dispatcher_host_ = NULL; 1876 geolocation_dispatcher_host_ = NULL;
1877 screen_orientation_dispatcher_host_ = NULL;
1872 1878
1873 IDMap<IPC::Listener>::iterator iter(&listeners_); 1879 IDMap<IPC::Listener>::iterator iter(&listeners_);
1874 while (!iter.IsAtEnd()) { 1880 while (!iter.IsAtEnd()) {
1875 iter.GetCurrentValue()->OnMessageReceived( 1881 iter.GetCurrentValue()->OnMessageReceived(
1876 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(), 1882 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(),
1877 static_cast<int>(status), 1883 static_cast<int>(status),
1878 exit_code)); 1884 exit_code));
1879 iter.Advance(); 1885 iter.Advance();
1880 } 1886 }
1881 1887
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1925 } 1931 }
1926 1932
1927 #if defined(ENABLE_WEBRTC) 1933 #if defined(ENABLE_WEBRTC)
1928 void RenderProcessHostImpl::WebRtcLogMessage(const std::string& message) { 1934 void RenderProcessHostImpl::WebRtcLogMessage(const std::string& message) {
1929 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1935 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1930 if (!webrtc_log_message_callback_.is_null()) 1936 if (!webrtc_log_message_callback_.is_null())
1931 webrtc_log_message_callback_.Run(message); 1937 webrtc_log_message_callback_.Run(message);
1932 } 1938 }
1933 #endif 1939 #endif
1934 1940
1941 scoped_refptr<ScreenOrientationDispatcherHost>
1942 RenderProcessHostImpl::screen_orientation_dispatcher_host() const {
1943 return make_scoped_refptr(screen_orientation_dispatcher_host_);
1944 }
1945
1935 void RenderProcessHostImpl::OnShutdownRequest() { 1946 void RenderProcessHostImpl::OnShutdownRequest() {
1936 // Don't shut down if there are active RenderViews, or if there are pending 1947 // Don't shut down if there are active RenderViews, or if there are pending
1937 // RenderViews being swapped back in. 1948 // RenderViews being swapped back in.
1938 // In single process mode, we never shutdown the renderer. 1949 // In single process mode, we never shutdown the renderer.
1939 int num_active_views = GetActiveViewCount(); 1950 int num_active_views = GetActiveViewCount();
1940 if (pending_views_ || num_active_views > 0 || run_renderer_in_process()) 1951 if (pending_views_ || num_active_views > 0 || run_renderer_in_process())
1941 return; 1952 return;
1942 1953
1943 // Notify any contents that might have swapped out renderers from this 1954 // Notify any contents that might have swapped out renderers from this
1944 // process. They should not attempt to swap them back in. 1955 // process. They should not attempt to swap them back in.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 return; 2083 return;
2073 Send(new MediaStreamMsg_EnableAecDump(file_for_transit)); 2084 Send(new MediaStreamMsg_EnableAecDump(file_for_transit));
2074 } 2085 }
2075 2086
2076 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() { 2087 void RenderProcessHostImpl::SendDisableAecDumpToRenderer() {
2077 Send(new MediaStreamMsg_DisableAecDump()); 2088 Send(new MediaStreamMsg_DisableAecDump());
2078 } 2089 }
2079 #endif 2090 #endif
2080 2091
2081 } // namespace content 2092 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698