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

Side by Side Diff: base/system_monitor/system_monitor.h

Issue 7235023: Mac: Split SystemMonitor initialization so it's not blocked by the Sandbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced to trunk Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | base/system_monitor/system_monitor_mac.mm » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ 5 #ifndef BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_
6 #define BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ 6 #define BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/base_api.h" 9 #include "base/base_api.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 }; 43 };
44 44
45 // Create SystemMonitor. Only one SystemMonitor instance per application 45 // Create SystemMonitor. Only one SystemMonitor instance per application
46 // is allowed. 46 // is allowed.
47 SystemMonitor(); 47 SystemMonitor();
48 ~SystemMonitor(); 48 ~SystemMonitor();
49 49
50 // Get the application-wide SystemMonitor (if not present, returns NULL). 50 // Get the application-wide SystemMonitor (if not present, returns NULL).
51 static SystemMonitor* Get(); 51 static SystemMonitor* Get();
52 52
53 #if defined(OS_MACOSX)
54 // Allocate system resources needed by the SystemMonitor class.
55 //
56 // This function must be called before instantiating an instance of the class
57 // and before the Sandbox is initialized.
58 static void AllocateSystemIOPorts();
59 #endif
60
53 // 61 //
54 // Power-related APIs 62 // Power-related APIs
55 // 63 //
56 64
57 // Is the computer currently on battery power. 65 // Is the computer currently on battery power.
58 // Can be called on any thread. 66 // Can be called on any thread.
59 bool BatteryPower() const { 67 bool BatteryPower() const {
60 // Using a lock here is not necessary for just a bool. 68 // Using a lock here is not necessary for just a bool.
61 return battery_in_use_; 69 return battery_in_use_;
62 } 70 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 void NotifyResume(); 131 void NotifyResume();
124 132
125 scoped_refptr<ObserverListThreadSafe<PowerObserver> > observer_list_; 133 scoped_refptr<ObserverListThreadSafe<PowerObserver> > observer_list_;
126 bool battery_in_use_; 134 bool battery_in_use_;
127 bool suspended_; 135 bool suspended_;
128 136
129 #if defined(ENABLE_BATTERY_MONITORING) 137 #if defined(ENABLE_BATTERY_MONITORING)
130 base::OneShotTimer<SystemMonitor> delayed_battery_check_; 138 base::OneShotTimer<SystemMonitor> delayed_battery_check_;
131 #endif 139 #endif
132 140
133 #if defined(OS_MACOSX)
134 IONotificationPortRef notification_port_ref_;
135 io_object_t notifier_object_;
136 #endif
137
138 DISALLOW_COPY_AND_ASSIGN(SystemMonitor); 141 DISALLOW_COPY_AND_ASSIGN(SystemMonitor);
139 }; 142 };
140 143
141 } // namespace base 144 } // namespace base
142 145
143 #endif // BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ 146 #endif // BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_
OLDNEW
« no previous file with comments | « no previous file | base/system_monitor/system_monitor_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698