Chromium Code Reviews| Index: content/browser/wake_lock/wake_lock_state.cc |
| diff --git a/content/browser/wake_lock/wake_lock_state.cc b/content/browser/wake_lock/wake_lock_state.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..41e695f2a83fc85a0060c52394ad2fce59b9b4b1 |
| --- /dev/null |
| +++ b/content/browser/wake_lock/wake_lock_state.cc |
| @@ -0,0 +1,35 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/browser/wake_lock/wake_lock_state.h" |
| + |
| +namespace content { |
| + |
| +WakeLockState::WakeLockState() { |
| +} |
| + |
| +WakeLockState::~WakeLockState() { |
| +} |
| + |
| +void WakeLockState::SetFrameLock(const RenderFrameHost* frame, bool intention) { |
| + if (intention) { |
| + frames_requesting_lock_.insert(frame); |
| + } else { |
| + RemoveFrame(frame); |
|
mlamouri (slow - plz ping)
2015/05/05 14:08:34
It's fairly odd that inserting a frame is done inl
|
| + } |
| +} |
| + |
| +void WakeLockState::RemoveFrame(const RenderFrameHost* frame) { |
| + frames_requesting_lock_.erase(frame); |
| +} |
| + |
| +void WakeLockState::RemoveAllFrames() { |
| + frames_requesting_lock_.clear(); |
| +} |
| + |
| +bool WakeLockState::GetLockState() const { |
| + return !frames_requesting_lock_.empty(); |
| +} |
| + |
| +} // namespace content |