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

Side by Side Diff: third_party/WebKit/Source/modules/wake_lock/ScreenWakeLock.cpp

Issue 2634713002: Remove PageVisibilityObserver contextDestroyed() notifications. (Closed)
Patch Set: prefer type aliases Created 3 years, 11 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/wake_lock/ScreenWakeLock.h" 5 #include "modules/wake_lock/ScreenWakeLock.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/frame/Screen.h" 9 #include "core/frame/Screen.h"
10 #include "core/page/PageVisibilityState.h" 10 #include "core/page/PageVisibilityState.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 void ScreenWakeLock::pageVisibilityChanged() { 50 void ScreenWakeLock::pageVisibilityChanged() {
51 notifyService(); 51 notifyService();
52 } 52 }
53 53
54 void ScreenWakeLock::contextDestroyed(ExecutionContext*) { 54 void ScreenWakeLock::contextDestroyed(ExecutionContext*) {
55 setKeepAwake(false); 55 setKeepAwake(false);
56 } 56 }
57 57
58 void ScreenWakeLock::contextDestroyed(Page*) {}
59
60 DEFINE_TRACE(ScreenWakeLock) { 58 DEFINE_TRACE(ScreenWakeLock) {
61 Supplement<LocalFrame>::trace(visitor); 59 Supplement<LocalFrame>::trace(visitor);
62 PageVisibilityObserver::trace(visitor); 60 PageVisibilityObserver::trace(visitor);
63 ContextLifecycleObserver::trace(visitor); 61 ContextLifecycleObserver::trace(visitor);
64 } 62 }
65 63
66 ScreenWakeLock::ScreenWakeLock(LocalFrame& frame) 64 ScreenWakeLock::ScreenWakeLock(LocalFrame& frame)
67 : Supplement<LocalFrame>(frame), 65 : Supplement<LocalFrame>(frame),
68 ContextLifecycleObserver(frame.document()), 66 ContextLifecycleObserver(frame.document()),
69 PageVisibilityObserver(frame.page()), 67 PageVisibilityObserver(frame.page()),
(...skipping 21 matching lines...) Expand all
91 if (!m_service) 89 if (!m_service)
92 return; 90 return;
93 91
94 if (m_keepAwake && page() && page()->isPageVisible()) 92 if (m_keepAwake && page() && page()->isPageVisible())
95 m_service->RequestWakeLock(); 93 m_service->RequestWakeLock();
96 else 94 else
97 m_service->CancelWakeLock(); 95 m_service->CancelWakeLock();
98 } 96 }
99 97
100 } // namespace blink 98 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698