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

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: Use PowerMonitor instead of SystemMonitor in XXXMain function Created 7 years, 9 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 #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 <atlbase.h> 62 #include <atlbase.h>
63 #include <atlapp.h> 63 #include <atlapp.h>
64 #include <malloc.h> 64 #include <malloc.h>
65 #include <cstring> 65 #include <cstring>
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/posix/global_descriptors.h" 79 #include "base/posix/global_descriptors.h"
80 #include "content/public/common/content_descriptors.h" 80 #include "content/public/common/content_descriptors.h"
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 // Enable startup tracing asap to avoid early TRACE_EVENT calls being 639 // Enable startup tracing asap to avoid early TRACE_EVENT calls being
640 // ignored. 640 // ignored.
641 if (command_line.HasSwitch(switches::kTraceStartup)) { 641 if (command_line.HasSwitch(switches::kTraceStartup)) {
642 base::debug::TraceLog::GetInstance()->SetEnabled( 642 base::debug::TraceLog::GetInstance()->SetEnabled(
643 command_line.GetSwitchValueASCII(switches::kTraceStartup), 643 command_line.GetSwitchValueASCII(switches::kTraceStartup),
644 base::debug::TraceLog::RECORD_UNTIL_FULL); 644 base::debug::TraceLog::RECORD_UNTIL_FULL);
645 } 645 }
646 646
647 #if defined(OS_MACOSX) && !defined(OS_IOS) 647 #if defined(OS_MACOSX) && !defined(OS_IOS)
648 // We need to allocate the IO Ports before the Sandbox is initialized or 648 // We need to allocate the IO Ports before the Sandbox is initialized or
649 // the first instance of SystemMonitor is created. 649 // the first instance of PowerMonitor is created.
650 // It's important not to allocate the ports for processes which don't 650 // It's important not to allocate the ports for processes which don't
651 // register with the system monitor - see crbug.com/88867. 651 // register with the power monitor - see crbug.com/88867.
652 if (process_type.empty() || 652 if (process_type.empty() ||
653 process_type == switches::kPluginProcess || 653 process_type == switches::kPluginProcess ||
654 process_type == switches::kRendererProcess || 654 process_type == switches::kRendererProcess ||
655 process_type == switches::kUtilityProcess || 655 process_type == switches::kUtilityProcess ||
656 process_type == switches::kWorkerProcess || 656 process_type == switches::kWorkerProcess ||
657 (delegate && 657 (delegate &&
658 delegate->ProcessRegistersWithSystemProcess(process_type))) { 658 delegate->ProcessRegistersWithSystemProcess(process_type))) {
659 base::SystemMonitor::AllocateSystemIOPorts(); 659 base::PowerMonitor::AllocateSystemIOPorts();
660 } 660 }
661 661
662 if (!process_type.empty() && 662 if (!process_type.empty() &&
663 (!delegate || delegate->ShouldSendMachPort(process_type))) { 663 (!delegate || delegate->ShouldSendMachPort(process_type))) {
664 SendTaskPortToParentProcess(); 664 SendTaskPortToParentProcess();
665 } 665 }
666 #elif defined(OS_WIN) 666 #elif defined(OS_WIN)
667 // This must be done early enough since some helper functions like 667 // This must be done early enough since some helper functions like
668 // IsTouchEnabled, needed to load resources, may call into the theme dll. 668 // IsTouchEnabled, needed to load resources, may call into the theme dll.
669 EnableThemeSupportOnAllWindowStations(); 669 EnableThemeSupportOnAllWindowStations();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 817
818 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 818 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
819 }; 819 };
820 820
821 // static 821 // static
822 ContentMainRunner* ContentMainRunner::Create() { 822 ContentMainRunner* ContentMainRunner::Create() {
823 return new ContentMainRunnerImpl(); 823 return new ContentMainRunnerImpl();
824 } 824 }
825 825
826 } // namespace content 826 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698