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

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: code rebase Created 4 years, 1 month 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 #include "content/browser/media/media_internals.h" 83 #include "content/browser/media/media_internals.h"
84 #include "content/browser/media/midi_host.h" 84 #include "content/browser/media/midi_host.h"
85 #include "content/browser/memory/memory_coordinator.h" 85 #include "content/browser/memory/memory_coordinator.h"
86 #include "content/browser/memory/memory_message_filter.h" 86 #include "content/browser/memory/memory_message_filter.h"
87 #include "content/browser/message_port_message_filter.h" 87 #include "content/browser/message_port_message_filter.h"
88 #include "content/browser/mime_registry_impl.h" 88 #include "content/browser/mime_registry_impl.h"
89 #include "content/browser/notifications/notification_message_filter.h" 89 #include "content/browser/notifications/notification_message_filter.h"
90 #include "content/browser/notifications/platform_notification_context_impl.h" 90 #include "content/browser/notifications/platform_notification_context_impl.h"
91 #include "content/browser/permissions/permission_service_context.h" 91 #include "content/browser/permissions/permission_service_context.h"
92 #include "content/browser/permissions/permission_service_impl.h" 92 #include "content/browser/permissions/permission_service_impl.h"
93 #include "content/browser/power_monitor_message_broadcaster.h"
93 #include "content/browser/profiler_message_filter.h" 94 #include "content/browser/profiler_message_filter.h"
94 #include "content/browser/push_messaging/push_messaging_message_filter.h" 95 #include "content/browser/push_messaging/push_messaging_message_filter.h"
95 #include "content/browser/quota_dispatcher_host.h" 96 #include "content/browser/quota_dispatcher_host.h"
96 #include "content/browser/renderer_host/clipboard_message_filter.h" 97 #include "content/browser/renderer_host/clipboard_message_filter.h"
97 #include "content/browser/renderer_host/database_message_filter.h" 98 #include "content/browser/renderer_host/database_message_filter.h"
98 #include "content/browser/renderer_host/file_utilities_message_filter.h" 99 #include "content/browser/renderer_host/file_utilities_message_filter.h"
99 #include "content/browser/renderer_host/gamepad_browser_message_filter.h" 100 #include "content/browser/renderer_host/gamepad_browser_message_filter.h"
100 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" 101 #include "content/browser/renderer_host/media/audio_input_renderer_host.h"
101 #include "content/browser/renderer_host/media/audio_renderer_host.h" 102 #include "content/browser/renderer_host/media/audio_renderer_host.h"
102 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" 103 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h"
(...skipping 574 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 channel_->Pause(); 917 channel_->Pause();
918 918
919 fast_shutdown_started_ = false; 919 fast_shutdown_started_ = false;
920 } 920 }
921 921
922 if (!gpu_observer_registered_) { 922 if (!gpu_observer_registered_) {
923 gpu_observer_registered_ = true; 923 gpu_observer_registered_ = true;
924 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); 924 ui::GpuSwitchingManager::GetInstance()->AddObserver(this);
925 } 925 }
926 926
927 power_monitor_broadcaster_.Init();
928
929 is_initialized_ = true; 927 is_initialized_ = true;
930 init_time_ = base::TimeTicks::Now(); 928 init_time_ = base::TimeTicks::Now();
931 return true; 929 return true;
932 } 930 }
933 931
934 void RenderProcessHostImpl::EnableSendQueue() { 932 void RenderProcessHostImpl::EnableSendQueue() {
935 if (!channel_) 933 if (!channel_)
936 InitializeChannelProxy(); 934 InitializeChannelProxy();
937 } 935 }
938 936
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 // BrowserMainLoop, which owns TimeZoneMonitor, is alive for the lifetime of 1273 // BrowserMainLoop, which owns TimeZoneMonitor, is alive for the lifetime of
1276 // Mojo communication (see BrowserMainLoop::ShutdownThreadsAndCleanUp(), 1274 // Mojo communication (see BrowserMainLoop::ShutdownThreadsAndCleanUp(),
1277 // which shuts down Mojo). Hence, passing that TimeZoneMonitor instance as 1275 // which shuts down Mojo). Hence, passing that TimeZoneMonitor instance as
1278 // a raw pointer here is safe. 1276 // a raw pointer here is safe.
1279 AddUIThreadInterface( 1277 AddUIThreadInterface(
1280 registry.get(), 1278 registry.get(),
1281 base::Bind(&device::TimeZoneMonitor::Bind, 1279 base::Bind(&device::TimeZoneMonitor::Bind,
1282 base::Unretained( 1280 base::Unretained(
1283 BrowserMainLoop::GetInstance()->time_zone_monitor()))); 1281 BrowserMainLoop::GetInstance()->time_zone_monitor())));
1284 1282
1283 AddUIThreadInterface(registry.get(),
1284 base::Bind(&PowerMonitorMessageBroadcaster::Create));
1285
1285 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner = 1286 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner =
1286 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE); 1287 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE);
1287 registry->AddInterface(base::Bind(&MimeRegistryImpl::Create), 1288 registry->AddInterface(base::Bind(&MimeRegistryImpl::Create),
1288 file_task_runner); 1289 file_task_runner);
1289 #if defined(USE_MINIKIN_HYPHENATION) 1290 #if defined(USE_MINIKIN_HYPHENATION)
1290 registry->AddInterface(base::Bind(&hyphenation::HyphenationImpl::Create), 1291 registry->AddInterface(base::Bind(&hyphenation::HyphenationImpl::Create),
1291 file_task_runner); 1292 file_task_runner);
1292 #endif 1293 #endif
1293 1294
1294 // These callbacks will be run immediately on the IO thread. 1295 // These callbacks will be run immediately on the IO thread.
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after
3010 bad_message::ReceivedBadMessage(render_process_id, 3011 bad_message::ReceivedBadMessage(render_process_id,
3011 bad_message::RPH_MOJO_PROCESS_ERROR); 3012 bad_message::RPH_MOJO_PROCESS_ERROR);
3012 } 3013 }
3013 3014
3014 void RenderProcessHostImpl::CreateURLLoaderFactory( 3015 void RenderProcessHostImpl::CreateURLLoaderFactory(
3015 mojo::InterfaceRequest<mojom::URLLoaderFactory> request) { 3016 mojo::InterfaceRequest<mojom::URLLoaderFactory> request) {
3016 URLLoaderFactoryImpl::Create(resource_message_filter_, std::move(request)); 3017 URLLoaderFactoryImpl::Create(resource_message_filter_, std::move(request));
3017 } 3018 }
3018 3019
3019 } // namespace content 3020 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698