Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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 #include "content/browser/wake_lock/wake_lock_state.h" | |
| 6 | |
| 7 namespace content { | |
| 8 | |
| 9 WakeLockState::WakeLockState() { | |
| 10 } | |
| 11 | |
| 12 WakeLockState::~WakeLockState() { | |
| 13 } | |
| 14 | |
| 15 void WakeLockState::SetFrameLock(const RenderFrameHost* frame, bool intention) { | |
| 16 if (intention) { | |
| 17 frames_requesting_lock_.insert(frame); | |
| 18 } else { | |
| 19 RemoveFrame(frame); | |
|
mlamouri (slow - plz ping)
2015/05/05 14:08:34
It's fairly odd that inserting a frame is done inl
| |
| 20 } | |
| 21 } | |
| 22 | |
| 23 void WakeLockState::RemoveFrame(const RenderFrameHost* frame) { | |
| 24 frames_requesting_lock_.erase(frame); | |
| 25 } | |
| 26 | |
| 27 void WakeLockState::RemoveAllFrames() { | |
| 28 frames_requesting_lock_.clear(); | |
| 29 } | |
| 30 | |
| 31 bool WakeLockState::GetLockState() const { | |
| 32 return !frames_requesting_lock_.empty(); | |
| 33 } | |
| 34 | |
| 35 } // namespace content | |
| OLD | NEW |