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

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: Update patch per vandebo's comments Created 8 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 (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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 #if defined(OS_WIN) 58 #if defined(OS_WIN)
59 #include <cstring> 59 #include <cstring>
60 #include <atlbase.h> 60 #include <atlbase.h>
61 #include <atlapp.h> 61 #include <atlapp.h>
62 #include <malloc.h> 62 #include <malloc.h>
63 #elif defined(OS_MACOSX) 63 #elif defined(OS_MACOSX)
64 #include "base/mac/scoped_nsautorelease_pool.h" 64 #include "base/mac/scoped_nsautorelease_pool.h"
65 #if !defined(OS_IOS) 65 #if !defined(OS_IOS)
66 #include "base/mach_ipc_mac.h" 66 #include "base/mach_ipc_mac.h"
67 #include "base/system_monitor/system_monitor.h" 67 #include "base/power_monitor/power_monitor.h"
68 #include "content/browser/mach_broker_mac.h" 68 #include "content/browser/mach_broker_mac.h"
69 #include "content/common/sandbox_init_mac.h" 69 #include "content/common/sandbox_init_mac.h"
70 #endif // !OS_IOS 70 #endif // !OS_IOS
71 #endif // OS_WIN 71 #endif // OS_WIN
72 72
73 #if defined(OS_POSIX) 73 #if defined(OS_POSIX)
74 #include <signal.h> 74 #include <signal.h>
75 75
76 #include "base/global_descriptors_posix.h" 76 #include "base/global_descriptors_posix.h"
77 #include "content/public/common/content_descriptors.h" 77 #include "content/public/common/content_descriptors.h"
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 614
615 // Enable startup tracing asap to avoid early TRACE_EVENT calls being 615 // Enable startup tracing asap to avoid early TRACE_EVENT calls being
616 // ignored. 616 // ignored.
617 if (command_line.HasSwitch(switches::kTraceStartup)) { 617 if (command_line.HasSwitch(switches::kTraceStartup)) {
618 base::debug::TraceLog::GetInstance()->SetEnabled( 618 base::debug::TraceLog::GetInstance()->SetEnabled(
619 command_line.GetSwitchValueASCII(switches::kTraceStartup)); 619 command_line.GetSwitchValueASCII(switches::kTraceStartup));
620 } 620 }
621 621
622 #if defined(OS_MACOSX) && !defined(OS_IOS) 622 #if defined(OS_MACOSX) && !defined(OS_IOS)
623 // We need to allocate the IO Ports before the Sandbox is initialized or 623 // We need to allocate the IO Ports before the Sandbox is initialized or
624 // the first instance of SystemMonitor is created. 624 // the first instance of PowerMonitor is created.
625 // It's important not to allocate the ports for processes which don't 625 // It's important not to allocate the ports for processes which don't
626 // register with the system monitor - see crbug.com/88867. 626 // register with the power monitor - see crbug.com/88867.
627 if (process_type.empty() || 627 if (process_type.empty() ||
628 process_type == switches::kPluginProcess || 628 process_type == switches::kPluginProcess ||
629 process_type == switches::kRendererProcess || 629 process_type == switches::kRendererProcess ||
630 process_type == switches::kUtilityProcess || 630 process_type == switches::kUtilityProcess ||
631 process_type == switches::kWorkerProcess || 631 process_type == switches::kWorkerProcess ||
632 (delegate && 632 (delegate &&
633 delegate->ProcessRegistersWithSystemProcess(process_type))) { 633 delegate->ProcessRegistersWithSystemProcess(process_type))) {
634 base::SystemMonitor::AllocateSystemIOPorts(); 634 base::PowerMonitor::AllocateSystemIOPorts();
635 } 635 }
636 636
637 if (!process_type.empty() && 637 if (!process_type.empty() &&
638 (!delegate || delegate->ShouldSendMachPort(process_type))) { 638 (!delegate || delegate->ShouldSendMachPort(process_type))) {
639 SendTaskPortToParentProcess(); 639 SendTaskPortToParentProcess();
640 } 640 }
641 #elif defined(OS_WIN) 641 #elif defined(OS_WIN)
642 // This must be done early enough since some helper functions like 642 // This must be done early enough since some helper functions like
643 // IsTouchEnanbled, needed to load resources, may call into the theme dll. 643 // IsTouchEnanbled, needed to load resources, may call into the theme dll.
644 EnableThemeSupportOnAllWindowStations(); 644 EnableThemeSupportOnAllWindowStations();
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 792
793 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 793 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
794 }; 794 };
795 795
796 // static 796 // static
797 ContentMainRunner* ContentMainRunner::Create() { 797 ContentMainRunner* ContentMainRunner::Create() {
798 return new ContentMainRunnerImpl(); 798 return new ContentMainRunnerImpl();
799 } 799 }
800 800
801 } // namespace content 801 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698