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

Side by Side Diff: Source/modules/wake_lock/WakeLock.h

Issue 1084923002: Wake Lock API implementation (Blink part) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Applied review comments 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 #ifndef WakeLock_h
6 #define WakeLock_h
7
8 #include "core/dom/DocumentLifecycleObserver.h"
9 #include "core/dom/DocumentSupplementable.h"
10 #include "core/page/PageVisibilityState.h"
11 #include "modules/wake_lock/WakeLockController.h"
12 #include "platform/heap/Handle.h"
13
14 namespace blink {
15
16 class Document;
17
18 class WakeLock final
19 : public NoBaseWillBeGarbageCollectedFinalized<WakeLock>
20 , public DocumentSupplement
21 , public DocumentLifecycleObserver {
22 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(WakeLock);
mlamouri (slow - plz ping) 2015/05/05 13:45:44 WTF_MAKE_NONCOPYABLE?
23 public:
24 static const char* supplementName();
25 static WakeLock& from(Document&);
26
27 static bool keepScreenAwake(Document&);
28 static void setKeepScreenAwake(Document&, bool);
29
30 // DocumentLifecycleObserver implementation
31 virtual void documentWasDetached() override;
32
33 DECLARE_VIRTUAL_TRACE();
34
35 private:
36 class WakeLockDocumentVisibilityObserver;
37
38 explicit WakeLock(Document&);
39
40 void didChangeVisibilityState(PageVisibilityState);
41 void setKeepScreenAwake(bool);
42 void notifyController() const;
43
44 RawPtrWillBeMember<WakeLockController> m_controller;
45
46 // We need visibility observer as a member rather than as a base becasue
47 // when Oilpan is disabled, we need to be able to delete it before
48 // Document's destructor runs, as it asserts empty visibility observer list.
49 // This instance is owned by Document's base DocumentSupplementable, so
50 // it will be destroyed only after Document's destructor has finished.
51 OwnPtrWillBeMember<WakeLockDocumentVisibilityObserver> m_observer;
52
53 PageVisibilityState m_pageVisibilityState;
54 bool m_keepScreenAwake;
55 };
56
57 } // namespace blink
58
59 #endif // WakeLock_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698