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

Side by Side Diff: content/child/child_thread_impl.cc

Issue 2460823002: Decouple Power Monitor from //content. (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
« no previous file with comments | « content/child/BUILD.gn ('k') | content/child/power_monitor_broadcast_source.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "content/child/child_thread_impl.h" 5 #include "content/child/child_thread_impl.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 24 matching lines...) Expand all
35 #include "components/discardable_memory/client/client_discardable_shared_memory_ manager.h" 35 #include "components/discardable_memory/client/client_discardable_shared_memory_ manager.h"
36 #include "components/tracing/child/child_trace_message_filter.h" 36 #include "components/tracing/child/child_trace_message_filter.h"
37 #include "content/child/child_histogram_message_filter.h" 37 #include "content/child/child_histogram_message_filter.h"
38 #include "content/child/child_process.h" 38 #include "content/child/child_process.h"
39 #include "content/child/child_resource_message_filter.h" 39 #include "content/child/child_resource_message_filter.h"
40 #include "content/child/child_shared_bitmap_manager.h" 40 #include "content/child/child_shared_bitmap_manager.h"
41 #include "content/child/fileapi/file_system_dispatcher.h" 41 #include "content/child/fileapi/file_system_dispatcher.h"
42 #include "content/child/fileapi/webfilesystem_impl.h" 42 #include "content/child/fileapi/webfilesystem_impl.h"
43 #include "content/child/memory/child_memory_message_filter.h" 43 #include "content/child/memory/child_memory_message_filter.h"
44 #include "content/child/notifications/notification_dispatcher.h" 44 #include "content/child/notifications/notification_dispatcher.h"
45 #include "content/child/power_monitor_broadcast_source.h"
46 #include "content/child/push_messaging/push_dispatcher.h" 45 #include "content/child/push_messaging/push_dispatcher.h"
47 #include "content/child/quota_dispatcher.h" 46 #include "content/child/quota_dispatcher.h"
48 #include "content/child/quota_message_filter.h" 47 #include "content/child/quota_message_filter.h"
49 #include "content/child/resource_dispatcher.h" 48 #include "content/child/resource_dispatcher.h"
50 #include "content/child/service_worker/service_worker_message_filter.h" 49 #include "content/child/service_worker/service_worker_message_filter.h"
51 #include "content/child/thread_safe_sender.h" 50 #include "content/child/thread_safe_sender.h"
52 #include "content/common/child_process_messages.h" 51 #include "content/common/child_process_messages.h"
53 #include "content/common/in_process_child_thread_params.h" 52 #include "content/common/in_process_child_thread_params.h"
54 #include "content/public/common/connection_filter.h" 53 #include "content/public/common/connection_filter.h"
55 #include "content/public/common/content_switches.h" 54 #include "content/public/common/content_switches.h"
56 #include "content/public/common/mojo_channel_switches.h" 55 #include "content/public/common/mojo_channel_switches.h"
57 #include "content/public/common/service_manager_connection.h" 56 #include "content/public/common/service_manager_connection.h"
58 #include "content/public/common/service_names.h" 57 #include "content/public/common/service_names.h"
58 #include "device/power_monitor/public/cpp/power_monitor_broadcast_source.h"
59 #include "ipc/ipc_channel_mojo.h" 59 #include "ipc/ipc_channel_mojo.h"
60 #include "ipc/ipc_logging.h" 60 #include "ipc/ipc_logging.h"
61 #include "ipc/ipc_platform_file.h" 61 #include "ipc/ipc_platform_file.h"
62 #include "ipc/ipc_sync_channel.h" 62 #include "ipc/ipc_sync_channel.h"
63 #include "ipc/ipc_sync_message_filter.h" 63 #include "ipc/ipc_sync_message_filter.h"
64 #include "mojo/edk/embedder/embedder.h" 64 #include "mojo/edk/embedder/embedder.h"
65 #include "mojo/edk/embedder/named_platform_channel_pair.h" 65 #include "mojo/edk/embedder/named_platform_channel_pair.h"
66 #include "mojo/edk/embedder/platform_channel_pair.h" 66 #include "mojo/edk/embedder/platform_channel_pair.h"
67 #include "mojo/edk/embedder/scoped_ipc_support.h" 67 #include "mojo/edk/embedder/scoped_ipc_support.h"
68 #include "services/service_manager/public/cpp/connector.h" 68 #include "services/service_manager/public/cpp/connector.h"
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 if (!IsInBrowserProcess()) { 531 if (!IsInBrowserProcess()) {
532 // In single process mode, browser-side tracing and memory will cover the 532 // In single process mode, browser-side tracing and memory will cover the
533 // whole process including renderers. 533 // whole process including renderers.
534 channel_->AddFilter(new tracing::ChildTraceMessageFilter( 534 channel_->AddFilter(new tracing::ChildTraceMessageFilter(
535 ChildProcess::current()->io_task_runner())); 535 ChildProcess::current()->io_task_runner()));
536 channel_->AddFilter(new ChildMemoryMessageFilter()); 536 channel_->AddFilter(new ChildMemoryMessageFilter());
537 } 537 }
538 538
539 // In single process mode we may already have a power monitor 539 // In single process mode we may already have a power monitor
540 if (!base::PowerMonitor::Get()) { 540 if (!base::PowerMonitor::Get()) {
541 std::unique_ptr<PowerMonitorBroadcastSource> power_monitor_source( 541 std::unique_ptr<device::PowerMonitorBroadcastSource> power_monitor_source(
542 new PowerMonitorBroadcastSource()); 542 new device::PowerMonitorBroadcastSource(GetRemoteInterfaces()));
543
543 power_monitor_.reset( 544 power_monitor_.reset(
544 new base::PowerMonitor(std::move(power_monitor_source))); 545 new base::PowerMonitor(std::move(power_monitor_source)));
545 } 546 }
546 547
547 #if defined(OS_POSIX) 548 #if defined(OS_POSIX)
548 // Check that --process-type is specified so we don't do this in unit tests 549 // Check that --process-type is specified so we don't do this in unit tests
549 // and single-process mode. 550 // and single-process mode.
550 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) 551 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType))
551 channel_->AddFilter(new SuicideOnChannelErrorFilter()); 552 channel_->AddFilter(new SuicideOnChannelErrorFilter());
552 #endif 553 #endif
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 connected_to_browser_ = true; 918 connected_to_browser_ = true;
918 child_info_ = local_info; 919 child_info_ = local_info;
919 browser_info_ = remote_info; 920 browser_info_ = remote_info;
920 } 921 }
921 922
922 bool ChildThreadImpl::IsInBrowserProcess() const { 923 bool ChildThreadImpl::IsInBrowserProcess() const {
923 return static_cast<bool>(browser_process_io_runner_); 924 return static_cast<bool>(browser_process_io_runner_);
924 } 925 }
925 926
926 } // namespace content 927 } // namespace content
OLDNEW
« no previous file with comments | « content/child/BUILD.gn ('k') | content/child/power_monitor_broadcast_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698