• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef PLATFORM_IMPL_SCOPED_WAKE_LOCK_MAC_H_
6 #define PLATFORM_IMPL_SCOPED_WAKE_LOCK_MAC_H_
7 
8 #include <IOKit/pwr_mgt/IOPMLib.h>
9 
10 #include "platform/api/scoped_wake_lock.h"
11 
12 namespace openscreen {
13 
14 class ScopedWakeLockMac : public ScopedWakeLock {
15  public:
16   ScopedWakeLockMac();
17   ~ScopedWakeLockMac() override;
18 
19  private:
20   struct LockState {
21     int reference_count = 0;
22     IOPMAssertionID assertion_id = kIOPMNullAssertionID;
23   };
24 
25   static void AcquireWakeLock();
26   static void ReleaseWakeLock();
27 
28   static LockState lock_state_;
29 };
30 
31 }  // namespace openscreen
32 
33 #endif  // PLATFORM_IMPL_SCOPED_WAKE_LOCK_MAC_H_
34