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

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

Powered by Google App Engine
This is Rietveld 408576698