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

Side by Side Diff: content/app/content_main_runner.cc

Issue 10959020: SystemMonitor refactoring: move power state monitor into a separate class called PowerMonitor (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Revert using Singleton pattern for PowerMonitor Created 8 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 (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/public/app/content_main_runner.h" 5 #include "content/public/app/content_main_runner.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/allocator/allocator_extension.h" 9 #include "base/allocator/allocator_extension.h"
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 #if defined(OS_WIN) 61 #if defined(OS_WIN)
62 #include <cstring> 62 #include <cstring>
63 #include <atlbase.h> 63 #include <atlbase.h>
64 #include <atlapp.h> 64 #include <atlapp.h>
65 #include <malloc.h> 65 #include <malloc.h>
66 #elif defined(OS_MACOSX) 66 #elif defined(OS_MACOSX)
67 #include "base/mac/scoped_nsautorelease_pool.h" 67 #include "base/mac/scoped_nsautorelease_pool.h"
68 #if !defined(OS_IOS) 68 #if !defined(OS_IOS)
69 #include "base/mach_ipc_mac.h" 69 #include "base/mach_ipc_mac.h"
70 #include "base/system_monitor/system_monitor.h" 70 #include "base/power_monitor/power_monitor.h"
71 #include "content/browser/mach_broker_mac.h" 71 #include "content/browser/mach_broker_mac.h"
72 #include "content/common/sandbox_init_mac.h" 72 #include "content/common/sandbox_init_mac.h"
73 #endif // !OS_IOS 73 #endif // !OS_IOS
74 #endif // OS_WIN 74 #endif // OS_WIN
75 75
76 #if defined(OS_POSIX) 76 #if defined(OS_POSIX)
77 #include <signal.h> 77 #include <signal.h>
78 78
79 #include "base/global_descriptors_posix.h" 79 #include "base/global_descriptors_posix.h"
80 #include "content/public/common/content_descriptors.h" 80 #include "content/public/common/content_descriptors.h"
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 621
622 // Enable startup tracing asap to avoid early TRACE_EVENT calls being 622 // Enable startup tracing asap to avoid early TRACE_EVENT calls being
623 // ignored. 623 // ignored.
624 if (command_line.HasSwitch(switches::kTraceStartup)) { 624 if (command_line.HasSwitch(switches::kTraceStartup)) {
625 base::debug::TraceLog::GetInstance()->SetEnabled( 625 base::debug::TraceLog::GetInstance()->SetEnabled(
626 command_line.GetSwitchValueASCII(switches::kTraceStartup)); 626 command_line.GetSwitchValueASCII(switches::kTraceStartup));
627 } 627 }
628 628
629 #if defined(OS_MACOSX) && !defined(OS_IOS) 629 #if defined(OS_MACOSX) && !defined(OS_IOS)
630 // We need to allocate the IO Ports before the Sandbox is initialized or 630 // We need to allocate the IO Ports before the Sandbox is initialized or
631 // the first instance of SystemMonitor is created. 631 // the first instance of PowerMonitor is created.
632 // It's important not to allocate the ports for processes which don't 632 // It's important not to allocate the ports for processes which don't
633 // register with the system monitor - see crbug.com/88867. 633 // register with the power monitor - see crbug.com/88867.
634 if (process_type.empty() || 634 if (process_type.empty() ||
635 process_type == switches::kPluginProcess || 635 process_type == switches::kPluginProcess ||
636 process_type == switches::kRendererProcess || 636 process_type == switches::kRendererProcess ||
637 process_type == switches::kUtilityProcess || 637 process_type == switches::kUtilityProcess ||
638 process_type == switches::kWorkerProcess || 638 process_type == switches::kWorkerProcess ||
639 (delegate && 639 (delegate &&
640 delegate->ProcessRegistersWithSystemProcess(process_type))) { 640 delegate->ProcessRegistersWithSystemProcess(process_type))) {
641 base::SystemMonitor::AllocateSystemIOPorts(); 641 base::PowerMonitor::AllocateSystemIOPorts();
642 } 642 }
643 643
644 if (!process_type.empty() && 644 if (!process_type.empty() &&
645 (!delegate || delegate->ShouldSendMachPort(process_type))) { 645 (!delegate || delegate->ShouldSendMachPort(process_type))) {
646 SendTaskPortToParentProcess(); 646 SendTaskPortToParentProcess();
647 } 647 }
648 #elif defined(OS_WIN) 648 #elif defined(OS_WIN)
649 // This must be done early enough since some helper functions like 649 // This must be done early enough since some helper functions like
650 // IsTouchEnanbled, needed to load resources, may call into the theme dll. 650 // IsTouchEnanbled, needed to load resources, may call into the theme dll.
651 EnableThemeSupportOnAllWindowStations(); 651 EnableThemeSupportOnAllWindowStations();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 799
800 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 800 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
801 }; 801 };
802 802
803 // static 803 // static
804 ContentMainRunner* ContentMainRunner::Create() { 804 ContentMainRunner* ContentMainRunner::Create() {
805 return new ContentMainRunnerImpl(); 805 return new ContentMainRunnerImpl();
806 } 806 }
807 807
808 } // namespace content 808 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698