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

Side by Side Diff: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp

Issue 1839643009: RELEASE_ASSERT -> CHECK and ASSERT -> DCHECK in web. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Return DCHECK_IS_ON checks. Created 4 years, 8 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 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 , m_rootGraphicsLayer(nullptr) 96 , m_rootGraphicsLayer(nullptr)
97 , m_isAcceleratedCompositingActive(false) 97 , m_isAcceleratedCompositingActive(false)
98 , m_layerTreeViewClosed(false) 98 , m_layerTreeViewClosed(false)
99 , m_suppressNextKeypressEvent(false) 99 , m_suppressNextKeypressEvent(false)
100 , m_ignoreInputEvents(false) 100 , m_ignoreInputEvents(false)
101 , m_isTransparent(false) 101 , m_isTransparent(false)
102 #if ENABLE(OILPAN) 102 #if ENABLE(OILPAN)
103 , m_selfKeepAlive(this) 103 , m_selfKeepAlive(this)
104 #endif 104 #endif
105 { 105 {
106 ASSERT(m_localRoot->frame()->isLocalRoot()); 106 DCHECK(m_localRoot->frame()->isLocalRoot());
107 initializeLayerTreeView(); 107 initializeLayerTreeView();
108 m_localRoot->setFrameWidget(this); 108 m_localRoot->setFrameWidget(this);
109 allInstances().add(this); 109 allInstances().add(this);
110 110
111 if (localRoot->parent()) 111 if (localRoot->parent())
112 setIsTransparent(true); 112 setIsTransparent(true);
113 } 113 }
114 114
115 WebFrameWidgetImpl::~WebFrameWidgetImpl() 115 WebFrameWidgetImpl::~WebFrameWidgetImpl()
116 { 116 {
117 } 117 }
118 118
119 DEFINE_TRACE(WebFrameWidgetImpl) 119 DEFINE_TRACE(WebFrameWidgetImpl)
120 { 120 {
121 visitor->trace(m_localRoot); 121 visitor->trace(m_localRoot);
122 visitor->trace(m_mouseCaptureNode); 122 visitor->trace(m_mouseCaptureNode);
123 } 123 }
124 124
125 // WebWidget ------------------------------------------------------------------ 125 // WebWidget ------------------------------------------------------------------
126 126
127 void WebFrameWidgetImpl::close() 127 void WebFrameWidgetImpl::close()
128 { 128 {
129 WebDevToolsAgentImpl::webFrameWidgetImplClosed(this); 129 WebDevToolsAgentImpl::webFrameWidgetImplClosed(this);
130 ASSERT(allInstances().contains(this)); 130 DCHECK(allInstances().contains(this));
131 allInstances().remove(this); 131 allInstances().remove(this);
132 132
133 m_localRoot->setFrameWidget(nullptr); 133 m_localRoot->setFrameWidget(nullptr);
134 m_localRoot = nullptr; 134 m_localRoot = nullptr;
135 // Reset the delegate to prevent notifications being sent as we're being 135 // Reset the delegate to prevent notifications being sent as we're being
136 // deleted. 136 // deleted.
137 m_client = nullptr; 137 m_client = nullptr;
138 138
139 m_layerTreeView = nullptr; 139 m_layerTreeView = nullptr;
140 m_rootLayer = nullptr; 140 m_rootLayer = nullptr;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 if (!view) 211 if (!view)
212 return; 212 return;
213 213
214 WebSize layoutSize = m_size; 214 WebSize layoutSize = m_size;
215 215
216 view->setLayoutSize(layoutSize); 216 view->setLayoutSize(layoutSize);
217 } 217 }
218 218
219 void WebFrameWidgetImpl::setIgnoreInputEvents(bool newValue) 219 void WebFrameWidgetImpl::setIgnoreInputEvents(bool newValue)
220 { 220 {
221 ASSERT(m_ignoreInputEvents != newValue); 221 DCHECK_NE(m_ignoreInputEvents, newValue);
222 m_ignoreInputEvents = newValue; 222 m_ignoreInputEvents = newValue;
223 } 223 }
224 224
225 void WebFrameWidgetImpl::didEnterFullScreen() 225 void WebFrameWidgetImpl::didEnterFullScreen()
226 { 226 {
227 // FIXME: Implement full screen for out-of-process iframes. 227 // FIXME: Implement full screen for out-of-process iframes.
228 } 228 }
229 229
230 void WebFrameWidgetImpl::didExitFullScreen() 230 void WebFrameWidgetImpl::didExitFullScreen()
231 { 231 {
232 // FIXME: Implement full screen for out-of-process iframes. 232 // FIXME: Implement full screen for out-of-process iframes.
233 } 233 }
234 234
235 void WebFrameWidgetImpl::beginFrame(double lastFrameTimeMonotonic) 235 void WebFrameWidgetImpl::beginFrame(double lastFrameTimeMonotonic)
236 { 236 {
237 TRACE_EVENT1("blink", "WebFrameWidgetImpl::beginFrame", "frameTime", lastFra meTimeMonotonic); 237 TRACE_EVENT1("blink", "WebFrameWidgetImpl::beginFrame", "frameTime", lastFra meTimeMonotonic);
238 ASSERT(lastFrameTimeMonotonic); 238 DCHECK(lastFrameTimeMonotonic);
239 PageWidgetDelegate::animate(*page(), lastFrameTimeMonotonic); 239 PageWidgetDelegate::animate(*page(), lastFrameTimeMonotonic);
240 } 240 }
241 241
242 void WebFrameWidgetImpl::updateAllLifecyclePhases() 242 void WebFrameWidgetImpl::updateAllLifecyclePhases()
243 { 243 {
244 TRACE_EVENT0("blink", "WebFrameWidgetImpl::updateAllLifecyclePhases"); 244 TRACE_EVENT0("blink", "WebFrameWidgetImpl::updateAllLifecyclePhases");
245 if (!m_localRoot) 245 if (!m_localRoot)
246 return; 246 return;
247 247
248 PageWidgetDelegate::updateAllLifecyclePhases(*page(), *m_localRoot->frame()) ; 248 PageWidgetDelegate::updateAllLifecyclePhases(*page(), *m_localRoot->frame()) ;
(...skipping 19 matching lines...) Expand all
268 void WebFrameWidgetImpl::updateLayerTreeBackgroundColor() 268 void WebFrameWidgetImpl::updateLayerTreeBackgroundColor()
269 { 269 {
270 if (!m_layerTreeView) 270 if (!m_layerTreeView)
271 return; 271 return;
272 272
273 m_layerTreeView->setBackgroundColor(backgroundColor()); 273 m_layerTreeView->setBackgroundColor(backgroundColor());
274 } 274 }
275 275
276 void WebFrameWidgetImpl::updateLayerTreeDeviceScaleFactor() 276 void WebFrameWidgetImpl::updateLayerTreeDeviceScaleFactor()
277 { 277 {
278 ASSERT(page()); 278 DCHECK(page());
279 ASSERT(m_layerTreeView); 279 DCHECK(m_layerTreeView);
280 280
281 float deviceScaleFactor = page()->deviceScaleFactor(); 281 float deviceScaleFactor = page()->deviceScaleFactor();
282 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor); 282 m_layerTreeView->setDeviceScaleFactor(deviceScaleFactor);
283 } 283 }
284 284
285 void WebFrameWidgetImpl::setIsTransparent(bool isTransparent) 285 void WebFrameWidgetImpl::setIsTransparent(bool isTransparent)
286 { 286 {
287 m_isTransparent = isTransparent; 287 m_isTransparent = isTransparent;
288 288
289 if (m_layerTreeView) 289 if (m_layerTreeView)
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 ASSERT_NOT_REACHED(); 749 ASSERT_NOT_REACHED();
750 } 750 }
751 LocalFrame* frame = m_localRoot->frame(); 751 LocalFrame* frame = m_localRoot->frame();
752 eventResult = frame->eventHandler().handleGestureEvent(PlatformGestureEventB uilder(frame->view(), event)); 752 eventResult = frame->eventHandler().handleGestureEvent(PlatformGestureEventB uilder(frame->view(), event));
753 m_client->didHandleGestureEvent(event, eventCancelled); 753 m_client->didHandleGestureEvent(event, eventCancelled);
754 return eventResult; 754 return eventResult;
755 } 755 }
756 756
757 WebInputEventResult WebFrameWidgetImpl::handleKeyEvent(const WebKeyboardEvent& e vent) 757 WebInputEventResult WebFrameWidgetImpl::handleKeyEvent(const WebKeyboardEvent& e vent)
758 { 758 {
759 ASSERT((event.type == WebInputEvent::RawKeyDown) 759 DCHECK((event.type == WebInputEvent::RawKeyDown)
760 || (event.type == WebInputEvent::KeyDown) 760 || (event.type == WebInputEvent::KeyDown)
761 || (event.type == WebInputEvent::KeyUp)); 761 || (event.type == WebInputEvent::KeyUp));
762 762
763 // Please refer to the comments explaining the m_suppressNextKeypressEvent 763 // Please refer to the comments explaining the m_suppressNextKeypressEvent
764 // member. 764 // member.
765 // The m_suppressNextKeypressEvent is set if the KeyDown is handled by 765 // The m_suppressNextKeypressEvent is set if the KeyDown is handled by
766 // Webkit. A keyDown event is typically associated with a keyPress(char) 766 // Webkit. A keyDown event is typically associated with a keyPress(char)
767 // event and a keyUp event. We reset this flag here as this is a new keyDown 767 // event and a keyUp event. We reset this flag here as this is a new keyDown
768 // event. 768 // event.
769 m_suppressNextKeypressEvent = false; 769 m_suppressNextKeypressEvent = false;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 view()->sendContextMenuEvent(event); 808 view()->sendContextMenuEvent(event);
809 return WebInputEventResult::HandledSystem; 809 return WebInputEventResult::HandledSystem;
810 } 810 }
811 #endif // !OS(MACOSX) 811 #endif // !OS(MACOSX)
812 812
813 return keyEventDefault(event); 813 return keyEventDefault(event);
814 } 814 }
815 815
816 WebInputEventResult WebFrameWidgetImpl::handleCharEvent(const WebKeyboardEvent& event) 816 WebInputEventResult WebFrameWidgetImpl::handleCharEvent(const WebKeyboardEvent& event)
817 { 817 {
818 ASSERT(event.type == WebInputEvent::Char); 818 DCHECK_EQ(event.type, WebInputEvent::Char);
819 819
820 // Please refer to the comments explaining the m_suppressNextKeypressEvent 820 // Please refer to the comments explaining the m_suppressNextKeypressEvent
821 // member. The m_suppressNextKeypressEvent is set if the KeyDown is 821 // member. The m_suppressNextKeypressEvent is set if the KeyDown is
822 // handled by Webkit. A keyDown event is typically associated with a 822 // handled by Webkit. A keyDown event is typically associated with a
823 // keyPress(char) event and a keyUp event. We reset this flag here as it 823 // keyPress(char) event and a keyUp event. We reset this flag here as it
824 // only applies to the current keyPress event. 824 // only applies to the current keyPress event.
825 bool suppress = m_suppressNextKeypressEvent; 825 bool suppress = m_suppressNextKeypressEvent;
826 m_suppressNextKeypressEvent = false; 826 m_suppressNextKeypressEvent = false;
827 827
828 LocalFrame* frame = toLocalFrame(focusedCoreFrame()); 828 LocalFrame* frame = toLocalFrame(focusedCoreFrame());
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 997
998 if (WebDevToolsAgentImpl* devTools = m_localRoot->devToolsAgentImpl()) 998 if (WebDevToolsAgentImpl* devTools = m_localRoot->devToolsAgentImpl())
999 devTools->layerTreeViewChanged(m_layerTreeView); 999 devTools->layerTreeViewChanged(m_layerTreeView);
1000 1000
1001 page()->settings().setAcceleratedCompositingEnabled(m_layerTreeView); 1001 page()->settings().setAcceleratedCompositingEnabled(m_layerTreeView);
1002 if (m_layerTreeView) 1002 if (m_layerTreeView)
1003 page()->layerTreeViewInitialized(*m_layerTreeView); 1003 page()->layerTreeViewInitialized(*m_layerTreeView);
1004 1004
1005 // FIXME: only unittests, click to play, Android priting, and printing (for headers and footers) 1005 // FIXME: only unittests, click to play, Android priting, and printing (for headers and footers)
1006 // make this assert necessary. We should make them not hit this code and the n delete allowsBrokenNullLayerTreeView. 1006 // make this assert necessary. We should make them not hit this code and the n delete allowsBrokenNullLayerTreeView.
1007 ASSERT(m_layerTreeView || !m_client || m_client->allowsBrokenNullLayerTreeVi ew()); 1007 DCHECK(m_layerTreeView || !m_client || m_client->allowsBrokenNullLayerTreeVi ew());
1008 } 1008 }
1009 1009
1010 void WebFrameWidgetImpl::setIsAcceleratedCompositingActive(bool active) 1010 void WebFrameWidgetImpl::setIsAcceleratedCompositingActive(bool active)
1011 { 1011 {
1012 // In the middle of shutting down; don't try to spin back up a compositor. 1012 // In the middle of shutting down; don't try to spin back up a compositor.
1013 // FIXME: compositing startup/shutdown should be refactored so that it 1013 // FIXME: compositing startup/shutdown should be refactored so that it
1014 // turns on explicitly rather than lazily, which causes this awkwardness. 1014 // turns on explicitly rather than lazily, which causes this awkwardness.
1015 if (m_layerTreeViewClosed) 1015 if (m_layerTreeViewClosed)
1016 return; 1016 return;
1017 1017
1018 ASSERT(!active || m_layerTreeView); 1018 DCHECK(!active || m_layerTreeView);
1019 1019
1020 if (m_isAcceleratedCompositingActive == active) 1020 if (m_isAcceleratedCompositingActive == active)
1021 return; 1021 return;
1022 1022
1023 if (!m_client) 1023 if (!m_client)
1024 return; 1024 return;
1025 1025
1026 if (active) { 1026 if (active) {
1027 TRACE_EVENT0("blink", "WebViewImpl::setIsAcceleratedCompositingActive(tr ue)"); 1027 TRACE_EVENT0("blink", "WebViewImpl::setIsAcceleratedCompositingActive(tr ue)");
1028 m_layerTreeView->setRootLayer(*m_rootLayer); 1028 m_layerTreeView->setRootLayer(*m_rootLayer);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 1093
1094 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p osInRootFrame) 1094 HitTestResult WebFrameWidgetImpl::hitTestResultForRootFramePos(const IntPoint& p osInRootFrame)
1095 { 1095 {
1096 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo tFrame)); 1096 IntPoint docPoint(m_localRoot->frame()->view()->rootFrameToContents(posInRoo tFrame));
1097 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active); 1097 HitTestResult result = m_localRoot->frame()->eventHandler().hitTestResultAtP oint(docPoint, HitTestRequest::ReadOnly | HitTestRequest::Active);
1098 result.setToShadowHostIfInUserAgentShadowRoot(); 1098 result.setToShadowHostIfInUserAgentShadowRoot();
1099 return result; 1099 return result;
1100 } 1100 }
1101 1101
1102 } // namespace blink 1102 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebFrameSerializerImpl.cpp ('k') | third_party/WebKit/Source/web/WebGeolocationController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698