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

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

Issue 2629593004: Disambiguate LifecycleObserver::contextDestroyed (Closed)
Patch Set: temp 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 supplement = new ScreenWakeLock(*frame); 44 supplement = new ScreenWakeLock(*frame);
45 Supplement<LocalFrame>::provideTo(*frame, supplementName(), supplement); 45 Supplement<LocalFrame>::provideTo(*frame, supplementName(), supplement);
46 } 46 }
47 return supplement; 47 return supplement;
48 } 48 }
49 49
50 void ScreenWakeLock::pageVisibilityChanged() { 50 void ScreenWakeLock::pageVisibilityChanged() {
51 notifyService(); 51 notifyService();
52 } 52 }
53 53
54 void ScreenWakeLock::contextDestroyed() { 54 void ScreenWakeLock::contextDestroyed(ExecutionContext*) {
55 setKeepAwake(false); 55 setKeepAwake(false);
56 } 56 }
57 57
58 void ScreenWakeLock::contextDestroyed(Page*) {}
59
58 DEFINE_TRACE(ScreenWakeLock) { 60 DEFINE_TRACE(ScreenWakeLock) {
59 Supplement<LocalFrame>::trace(visitor); 61 Supplement<LocalFrame>::trace(visitor);
60 PageVisibilityObserver::trace(visitor); 62 PageVisibilityObserver::trace(visitor);
61 ContextLifecycleObserver::trace(visitor); 63 ContextLifecycleObserver::trace(visitor);
62 } 64 }
63 65
64 ScreenWakeLock::ScreenWakeLock(LocalFrame& frame) 66 ScreenWakeLock::ScreenWakeLock(LocalFrame& frame)
65 : Supplement<LocalFrame>(frame), 67 : Supplement<LocalFrame>(frame),
66 ContextLifecycleObserver(frame.document()), 68 ContextLifecycleObserver(frame.document()),
67 PageVisibilityObserver(frame.page()), 69 PageVisibilityObserver(frame.page()),
(...skipping 21 matching lines...) Expand all
89 if (!m_service) 91 if (!m_service)
90 return; 92 return;
91 93
92 if (m_keepAwake && page() && page()->isPageVisible()) 94 if (m_keepAwake && page() && page()->isPageVisible())
93 m_service->RequestWakeLock(); 95 m_service->RequestWakeLock();
94 else 96 else
95 m_service->CancelWakeLock(); 97 m_service->CancelWakeLock();
96 } 98 }
97 99
98 } // namespace blink 100 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698