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

Unified Diff: content/browser/wake_lock/wake_lock_state.cc

Issue 1107333002: Wake Lock API implementation (Chromium part) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698