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

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

Issue 327573002: Properly route screen orientation IPC messages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screen_lock_view
Patch Set: ScreenOrientationDispatcherHost owned by WebContentsImpl Created 6 years, 6 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 #include "content/browser/renderer_host/pepper/pepper_renderer_connection.h" 90 #include "content/browser/renderer_host/pepper/pepper_renderer_connection.h"
91 #include "content/browser/renderer_host/render_message_filter.h" 91 #include "content/browser/renderer_host/render_message_filter.h"
92 #include "content/browser/renderer_host/render_view_host_delegate.h" 92 #include "content/browser/renderer_host/render_view_host_delegate.h"
93 #include "content/browser/renderer_host/render_view_host_impl.h" 93 #include "content/browser/renderer_host/render_view_host_impl.h"
94 #include "content/browser/renderer_host/render_widget_helper.h" 94 #include "content/browser/renderer_host/render_widget_helper.h"
95 #include "content/browser/renderer_host/render_widget_host_impl.h" 95 #include "content/browser/renderer_host/render_widget_host_impl.h"
96 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" 96 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h"
97 #include "content/browser/renderer_host/text_input_client_message_filter.h" 97 #include "content/browser/renderer_host/text_input_client_message_filter.h"
98 #include "content/browser/renderer_host/websocket_dispatcher_host.h" 98 #include "content/browser/renderer_host/websocket_dispatcher_host.h"
99 #include "content/browser/resolve_proxy_msg_helper.h" 99 #include "content/browser/resolve_proxy_msg_helper.h"
100 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host. h"
101 #include "content/browser/service_worker/service_worker_context_wrapper.h" 100 #include "content/browser/service_worker/service_worker_context_wrapper.h"
102 #include "content/browser/service_worker/service_worker_dispatcher_host.h" 101 #include "content/browser/service_worker/service_worker_dispatcher_host.h"
103 #include "content/browser/shared_worker/shared_worker_message_filter.h" 102 #include "content/browser/shared_worker/shared_worker_message_filter.h"
104 #include "content/browser/speech/speech_recognition_dispatcher_host.h" 103 #include "content/browser/speech/speech_recognition_dispatcher_host.h"
105 #include "content/browser/storage_partition_impl.h" 104 #include "content/browser/storage_partition_impl.h"
106 #include "content/browser/streams/stream_context.h" 105 #include "content/browser/streams/stream_context.h"
107 #include "content/browser/tracing/trace_message_filter.h" 106 #include "content/browser/tracing/trace_message_filter.h"
108 #include "content/browser/vibration/vibration_message_filter.h" 107 #include "content/browser/vibration/vibration_message_filter.h"
109 #include "content/browser/webui/web_ui_controller_factory_registry.h" 108 #include "content/browser/webui/web_ui_controller_factory_registry.h"
110 #include "content/browser/worker_host/worker_message_filter.h" 109 #include "content/browser/worker_host/worker_message_filter.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), 453 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()),
455 browser_context_(browser_context), 454 browser_context_(browser_context),
456 storage_partition_impl_(storage_partition_impl), 455 storage_partition_impl_(storage_partition_impl),
457 sudden_termination_allowed_(true), 456 sudden_termination_allowed_(true),
458 ignore_input_events_(false), 457 ignore_input_events_(false),
459 is_isolated_guest_(is_isolated_guest), 458 is_isolated_guest_(is_isolated_guest),
460 gpu_observer_registered_(false), 459 gpu_observer_registered_(false),
461 delayed_cleanup_needed_(false), 460 delayed_cleanup_needed_(false),
462 within_process_died_observer_(false), 461 within_process_died_observer_(false),
463 power_monitor_broadcaster_(this), 462 power_monitor_broadcaster_(this),
464 screen_orientation_dispatcher_host_(NULL),
465 worker_ref_count_(0), 463 worker_ref_count_(0),
466 weak_factory_(this) { 464 weak_factory_(this) {
467 widget_helper_ = new RenderWidgetHelper(); 465 widget_helper_ = new RenderWidgetHelper();
468 466
469 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); 467 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID());
470 468
471 CHECK(!g_exited_main_message_loop); 469 CHECK(!g_exited_main_message_loop);
472 RegisterHost(GetID(), this); 470 RegisterHost(GetID(), this);
473 g_all_hosts.Get().set_check_on_null_data(true); 471 g_all_hosts.Get().set_check_on_null_data(true);
474 // Initialize |child_process_activity_time_| to a reasonable value. 472 // Initialize |child_process_activity_time_| to a reasonable value.
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 AddFilter(new DeviceMotionMessageFilter()); 875 AddFilter(new DeviceMotionMessageFilter());
878 AddFilter(new DeviceOrientationMessageFilter()); 876 AddFilter(new DeviceOrientationMessageFilter());
879 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER)); 877 AddFilter(new ProfilerMessageFilter(PROCESS_TYPE_RENDERER));
880 AddFilter(new HistogramMessageFilter()); 878 AddFilter(new HistogramMessageFilter());
881 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID)) 879 #if defined(USE_TCMALLOC) && (defined(OS_LINUX) || defined(OS_ANDROID))
882 if (CommandLine::ForCurrentProcess()->HasSwitch( 880 if (CommandLine::ForCurrentProcess()->HasSwitch(
883 switches::kEnableMemoryBenchmarking)) 881 switches::kEnableMemoryBenchmarking))
884 AddFilter(new MemoryBenchmarkMessageFilter()); 882 AddFilter(new MemoryBenchmarkMessageFilter());
885 #endif 883 #endif
886 AddFilter(new VibrationMessageFilter()); 884 AddFilter(new VibrationMessageFilter());
887 screen_orientation_dispatcher_host_ = new ScreenOrientationDispatcherHost();
888 AddFilter(screen_orientation_dispatcher_host_);
889 AddFilter(new PushMessagingMessageFilter()); 885 AddFilter(new PushMessagingMessageFilter());
890 AddFilter(new BatteryStatusMessageFilter()); 886 AddFilter(new BatteryStatusMessageFilter());
891 } 887 }
892 888
893 int RenderProcessHostImpl::GetNextRoutingID() { 889 int RenderProcessHostImpl::GetNextRoutingID() {
894 return widget_helper_->GetNextRoutingID(); 890 return widget_helper_->GetNextRoutingID();
895 } 891 }
896 892
897 893
898 void RenderProcessHostImpl::ResumeDeferredNavigation( 894 void RenderProcessHostImpl::ResumeDeferredNavigation(
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 1494 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
1499 deleting_soon_ = true; 1495 deleting_soon_ = true;
1500 // It's important not to wait for the DeleteTask to delete the channel 1496 // It's important not to wait for the DeleteTask to delete the channel
1501 // proxy. Kill it off now. That way, in case the profile is going away, the 1497 // proxy. Kill it off now. That way, in case the profile is going away, the
1502 // rest of the objects attached to this RenderProcessHost start going 1498 // rest of the objects attached to this RenderProcessHost start going
1503 // away first, since deleting the channel proxy will post a 1499 // away first, since deleting the channel proxy will post a
1504 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. 1500 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread.
1505 channel_.reset(); 1501 channel_.reset();
1506 gpu_message_filter_ = NULL; 1502 gpu_message_filter_ = NULL;
1507 message_port_message_filter_ = NULL; 1503 message_port_message_filter_ = NULL;
1508 screen_orientation_dispatcher_host_ = NULL;
1509 RemoveUserData(kSessionStorageHolderKey); 1504 RemoveUserData(kSessionStorageHolderKey);
1510 1505
1511 // Remove ourself from the list of renderer processes so that we can't be 1506 // Remove ourself from the list of renderer processes so that we can't be
1512 // reused in between now and when the Delete task runs. 1507 // reused in between now and when the Delete task runs.
1513 UnregisterHost(GetID()); 1508 UnregisterHost(GetID());
1514 } 1509 }
1515 } 1510 }
1516 1511
1517 void RenderProcessHostImpl::AddPendingView() { 1512 void RenderProcessHostImpl::AddPendingView() {
1518 pending_views_++; 1513 pending_views_++;
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 Details<RendererClosedDetails>(&details)); 1907 Details<RendererClosedDetails>(&details));
1913 FOR_EACH_OBSERVER(RenderProcessHostObserver, 1908 FOR_EACH_OBSERVER(RenderProcessHostObserver,
1914 observers_, 1909 observers_,
1915 RenderProcessExited(this, GetHandle(), status, exit_code)); 1910 RenderProcessExited(this, GetHandle(), status, exit_code));
1916 within_process_died_observer_ = false; 1911 within_process_died_observer_ = false;
1917 1912
1918 child_process_launcher_.reset(); 1913 child_process_launcher_.reset();
1919 channel_.reset(); 1914 channel_.reset();
1920 gpu_message_filter_ = NULL; 1915 gpu_message_filter_ = NULL;
1921 message_port_message_filter_ = NULL; 1916 message_port_message_filter_ = NULL;
1922 screen_orientation_dispatcher_host_ = NULL;
1923 RemoveUserData(kSessionStorageHolderKey); 1917 RemoveUserData(kSessionStorageHolderKey);
1924 1918
1925 IDMap<IPC::Listener>::iterator iter(&listeners_); 1919 IDMap<IPC::Listener>::iterator iter(&listeners_);
1926 while (!iter.IsAtEnd()) { 1920 while (!iter.IsAtEnd()) {
1927 iter.GetCurrentValue()->OnMessageReceived( 1921 iter.GetCurrentValue()->OnMessageReceived(
1928 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(), 1922 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(),
1929 static_cast<int>(status), 1923 static_cast<int>(status),
1930 exit_code)); 1924 exit_code));
1931 iter.Advance(); 1925 iter.Advance();
1932 } 1926 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1977 } 1971 }
1978 1972
1979 #if defined(ENABLE_WEBRTC) 1973 #if defined(ENABLE_WEBRTC)
1980 void RenderProcessHostImpl::WebRtcLogMessage(const std::string& message) { 1974 void RenderProcessHostImpl::WebRtcLogMessage(const std::string& message) {
1981 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1975 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1982 if (!webrtc_log_message_callback_.is_null()) 1976 if (!webrtc_log_message_callback_.is_null())
1983 webrtc_log_message_callback_.Run(message); 1977 webrtc_log_message_callback_.Run(message);
1984 } 1978 }
1985 #endif 1979 #endif
1986 1980
1987 scoped_refptr<ScreenOrientationDispatcherHost>
1988 RenderProcessHostImpl::screen_orientation_dispatcher_host() const {
1989 return make_scoped_refptr(screen_orientation_dispatcher_host_);
1990 }
1991
1992 void RenderProcessHostImpl::ReleaseOnCloseACK( 1981 void RenderProcessHostImpl::ReleaseOnCloseACK(
1993 RenderProcessHost* host, 1982 RenderProcessHost* host,
1994 const SessionStorageNamespaceMap& sessions, 1983 const SessionStorageNamespaceMap& sessions,
1995 int view_route_id) { 1984 int view_route_id) {
1996 DCHECK(host); 1985 DCHECK(host);
1997 if (sessions.empty()) 1986 if (sessions.empty())
1998 return; 1987 return;
1999 SessionStorageHolder* holder = static_cast<SessionStorageHolder*> 1988 SessionStorageHolder* holder = static_cast<SessionStorageHolder*>
2000 (host->GetUserData(kSessionStorageHolderKey)); 1989 (host->GetUserData(kSessionStorageHolderKey));
2001 if (!holder) { 1990 if (!holder) {
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2301 void RenderProcessHostImpl::GpuMemoryBufferAllocated( 2290 void RenderProcessHostImpl::GpuMemoryBufferAllocated(
2302 IPC::Message* reply, 2291 IPC::Message* reply,
2303 const gfx::GpuMemoryBufferHandle& handle) { 2292 const gfx::GpuMemoryBufferHandle& handle) {
2304 DCHECK_CURRENTLY_ON(BrowserThread::UI); 2293 DCHECK_CURRENTLY_ON(BrowserThread::UI);
2305 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply, 2294 ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply,
2306 handle); 2295 handle);
2307 Send(reply); 2296 Send(reply);
2308 } 2297 }
2309 2298
2310 } // namespace content 2299 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698