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

Side by Side 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, 7 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
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698