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

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

Issue 2433203003: Mojoify PoweMonitorMessageBroadcaster IPC from browser to child process (Closed)
Patch Set: Mojoify PoweMonitorMessageBroadcaster IPC from browser to child process Created 4 years, 2 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 #include "content/public/common/content_features.h" 154 #include "content/public/common/content_features.h"
155 #include "content/public/common/content_switches.h" 155 #include "content/public/common/content_switches.h"
156 #include "content/public/common/mojo_channel_switches.h" 156 #include "content/public/common/mojo_channel_switches.h"
157 #include "content/public/common/process_type.h" 157 #include "content/public/common/process_type.h"
158 #include "content/public/common/resource_type.h" 158 #include "content/public/common/resource_type.h"
159 #include "content/public/common/result_codes.h" 159 #include "content/public/common/result_codes.h"
160 #include "content/public/common/sandboxed_process_launcher_delegate.h" 160 #include "content/public/common/sandboxed_process_launcher_delegate.h"
161 #include "content/public/common/service_names.h" 161 #include "content/public/common/service_names.h"
162 #include "content/public/common/url_constants.h" 162 #include "content/public/common/url_constants.h"
163 #include "device/battery/battery_monitor_impl.h" 163 #include "device/battery/battery_monitor_impl.h"
164 #include "device/power_monitor/public/interfaces/power_monitor.mojom.h"
164 #include "device/time_zone_monitor/time_zone_monitor.h" 165 #include "device/time_zone_monitor/time_zone_monitor.h"
165 #include "gpu/GLES2/gl2extchromium.h" 166 #include "gpu/GLES2/gl2extchromium.h"
166 #include "gpu/command_buffer/client/gpu_switches.h" 167 #include "gpu/command_buffer/client/gpu_switches.h"
167 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 168 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
168 #include "gpu/command_buffer/service/gpu_switches.h" 169 #include "gpu/command_buffer/service/gpu_switches.h"
169 #include "ipc/attachment_broker.h" 170 #include "ipc/attachment_broker.h"
170 #include "ipc/attachment_broker_privileged.h" 171 #include "ipc/attachment_broker_privileged.h"
171 #include "ipc/ipc.mojom.h" 172 #include "ipc/ipc.mojom.h"
172 #include "ipc/ipc_channel.h" 173 #include "ipc/ipc_channel.h"
173 #include "ipc/ipc_channel_mojo.h" 174 #include "ipc/ipc_channel_mojo.h"
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 is_process_backgrounded_(false), 678 is_process_backgrounded_(false),
678 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), 679 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()),
679 browser_context_(browser_context), 680 browser_context_(browser_context),
680 storage_partition_impl_(storage_partition_impl), 681 storage_partition_impl_(storage_partition_impl),
681 sudden_termination_allowed_(true), 682 sudden_termination_allowed_(true),
682 ignore_input_events_(false), 683 ignore_input_events_(false),
683 is_for_guests_only_(is_for_guests_only), 684 is_for_guests_only_(is_for_guests_only),
684 gpu_observer_registered_(false), 685 gpu_observer_registered_(false),
685 delayed_cleanup_needed_(false), 686 delayed_cleanup_needed_(false),
686 within_process_died_observer_(false), 687 within_process_died_observer_(false),
687 power_monitor_broadcaster_(this),
688 #if defined(ENABLE_WEBRTC) 688 #if defined(ENABLE_WEBRTC)
689 webrtc_eventlog_host_(id_), 689 webrtc_eventlog_host_(id_),
690 #endif 690 #endif
691 max_worker_count_(0), 691 max_worker_count_(0),
692 permission_service_context_(new PermissionServiceContext(this)), 692 permission_service_context_(new PermissionServiceContext(this)),
693 channel_connected_(false), 693 channel_connected_(false),
694 sent_render_process_ready_(false), 694 sent_render_process_ready_(false),
695 #if defined(OS_ANDROID) 695 #if defined(OS_ANDROID)
696 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL, 696 never_signaled_(base::WaitableEvent::ResetPolicy::MANUAL,
697 base::WaitableEvent::InitialState::NOT_SIGNALED), 697 base::WaitableEvent::InitialState::NOT_SIGNALED),
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 channel_->Pause(); 914 channel_->Pause();
915 915
916 fast_shutdown_started_ = false; 916 fast_shutdown_started_ = false;
917 } 917 }
918 918
919 if (!gpu_observer_registered_) { 919 if (!gpu_observer_registered_) {
920 gpu_observer_registered_ = true; 920 gpu_observer_registered_ = true;
921 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); 921 ui::GpuSwitchingManager::GetInstance()->AddObserver(this);
922 } 922 }
923 923
924 power_monitor_broadcaster_.Init(); 924 device::mojom::PowerMonitorClientPtr power_monitor_client;
925 GetRemoteInterfaces()->GetInterface(mojo::GetProxy(&power_monitor_client));
926 power_monitor_broadcaster_.Init(power_monitor_client);
925 927
926 is_initialized_ = true; 928 is_initialized_ = true;
927 init_time_ = base::TimeTicks::Now(); 929 init_time_ = base::TimeTicks::Now();
928 return true; 930 return true;
929 } 931 }
930 932
931 void RenderProcessHostImpl::InitializeChannelProxy() { 933 void RenderProcessHostImpl::InitializeChannelProxy() {
932 // Generate a token used to identify the new child process. 934 // Generate a token used to identify the new child process.
933 child_token_ = mojo::edk::GenerateRandomToken(); 935 child_token_ = mojo::edk::GenerateRandomToken();
934 936
(...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after
3000 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3002 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3001 3003
3002 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 3004 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
3003 // enough information here so that we can determine what the bad message was. 3005 // enough information here so that we can determine what the bad message was.
3004 base::debug::Alias(&error); 3006 base::debug::Alias(&error);
3005 bad_message::ReceivedBadMessage(render_process_id, 3007 bad_message::ReceivedBadMessage(render_process_id,
3006 bad_message::RPH_MOJO_PROCESS_ERROR); 3008 bad_message::RPH_MOJO_PROCESS_ERROR);
3007 } 3009 }
3008 3010
3009 } // namespace content 3011 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698