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

Side by Side Diff: third_party/WebKit/Source/web/tests/ScreenWakeLockTest.cpp

Issue 2562323002: Devirtualize Frame::domWindow(). (Closed)
Patch Set: Created 4 years 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/DOMImplementation.h" 7 #include "core/dom/DOMImplementation.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/DocumentInit.h" 9 #include "core/dom/DocumentInit.h"
10 #include "mojo/public/cpp/bindings/interface_request.h" 10 #include "mojo/public/cpp/bindings/interface_request.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 103
104 blink::LocalFrame* frame() { 104 blink::LocalFrame* frame() {
105 DCHECK(m_webViewHelper.webView()); 105 DCHECK(m_webViewHelper.webView());
106 DCHECK(m_webViewHelper.webView()->mainFrameImpl()); 106 DCHECK(m_webViewHelper.webView()->mainFrameImpl());
107 return m_webViewHelper.webView()->mainFrameImpl()->frame(); 107 return m_webViewHelper.webView()->mainFrameImpl()->frame();
108 } 108 }
109 109
110 blink::Screen* screen() { 110 blink::Screen* screen() {
111 DCHECK(frame()); 111 DCHECK(frame());
112 DCHECK(frame()->localDOMWindow()); 112 DCHECK(frame()->domWindow());
113 return frame()->localDOMWindow()->screen(); 113 return frame()->domWindow()->screen();
114 } 114 }
115 115
116 bool screenKeepAwake() { 116 bool screenKeepAwake() {
117 DCHECK(screen()); 117 DCHECK(screen());
118 return ScreenWakeLock::keepAwake(*screen()); 118 return ScreenWakeLock::keepAwake(*screen());
119 } 119 }
120 120
121 bool clientKeepScreenAwake() { 121 bool clientKeepScreenAwake() {
122 return static_cast<MockInterfaceProvider*>( 122 return static_cast<MockInterfaceProvider*>(
123 m_testWebFrameClient.interfaceProvider()) 123 m_testWebFrameClient.interfaceProvider())
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 ASSERT_FALSE(clientKeepScreenAwake()); 205 ASSERT_FALSE(clientKeepScreenAwake());
206 206
207 setKeepAwake(true); 207 setKeepAwake(true);
208 loadFrame(); 208 loadFrame();
209 209
210 EXPECT_FALSE(screenKeepAwake()); 210 EXPECT_FALSE(screenKeepAwake());
211 EXPECT_FALSE(clientKeepScreenAwake()); 211 EXPECT_FALSE(clientKeepScreenAwake());
212 } 212 }
213 213
214 } // namespace 214 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698