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

Side by Side Diff: Source/web/WebViewImpl.cpp

Issue 908453003: Blink changes to record interest rects for http://w3c.github.io/frame-timing/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add Experimental Blink Feature flag for this change Created 5 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 #include "core/page/DragData.h" 79 #include "core/page/DragData.h"
80 #include "core/page/DragSession.h" 80 #include "core/page/DragSession.h"
81 #include "core/page/EventHandler.h" 81 #include "core/page/EventHandler.h"
82 #include "core/page/FocusController.h" 82 #include "core/page/FocusController.h"
83 #include "core/page/FrameTree.h" 83 #include "core/page/FrameTree.h"
84 #include "core/page/Page.h" 84 #include "core/page/Page.h"
85 #include "core/page/PagePopupClient.h" 85 #include "core/page/PagePopupClient.h"
86 #include "core/page/PointerLockController.h" 86 #include "core/page/PointerLockController.h"
87 #include "core/page/ScopedPageLoadDeferrer.h" 87 #include "core/page/ScopedPageLoadDeferrer.h"
88 #include "core/page/TouchDisambiguation.h" 88 #include "core/page/TouchDisambiguation.h"
89 #include "core/paint/DeprecatedPaintLayer.h"
90 #include "core/timing/DOMWindowPerformance.h"
91 #include "core/timing/Performance.h"
89 #include "modules/accessibility/AXObject.h" 92 #include "modules/accessibility/AXObject.h"
90 #include "modules/accessibility/AXObjectCacheImpl.h" 93 #include "modules/accessibility/AXObjectCacheImpl.h"
91 #include "modules/credentialmanager/CredentialManagerClient.h" 94 #include "modules/credentialmanager/CredentialManagerClient.h"
92 #include "modules/encryptedmedia/MediaKeysController.h" 95 #include "modules/encryptedmedia/MediaKeysController.h"
93 #include "modules/storage/StorageNamespaceController.h" 96 #include "modules/storage/StorageNamespaceController.h"
94 #include "platform/ContextMenu.h" 97 #include "platform/ContextMenu.h"
95 #include "platform/ContextMenuItem.h" 98 #include "platform/ContextMenuItem.h"
96 #include "platform/Cursor.h" 99 #include "platform/Cursor.h"
97 #include "platform/KeyboardCodes.h" 100 #include "platform/KeyboardCodes.h"
98 #include "platform/Logging.h" 101 #include "platform/Logging.h"
(...skipping 19 matching lines...) Expand all
118 #include "public/platform/WebFloatPoint.h" 121 #include "public/platform/WebFloatPoint.h"
119 #include "public/platform/WebGestureCurve.h" 122 #include "public/platform/WebGestureCurve.h"
120 #include "public/platform/WebImage.h" 123 #include "public/platform/WebImage.h"
121 #include "public/platform/WebLayerTreeView.h" 124 #include "public/platform/WebLayerTreeView.h"
122 #include "public/platform/WebURLRequest.h" 125 #include "public/platform/WebURLRequest.h"
123 #include "public/platform/WebVector.h" 126 #include "public/platform/WebVector.h"
124 #include "public/web/WebAXObject.h" 127 #include "public/web/WebAXObject.h"
125 #include "public/web/WebActiveWheelFlingParameters.h" 128 #include "public/web/WebActiveWheelFlingParameters.h"
126 #include "public/web/WebAutofillClient.h" 129 #include "public/web/WebAutofillClient.h"
127 #include "public/web/WebBeginFrameArgs.h" 130 #include "public/web/WebBeginFrameArgs.h"
131 #include "public/web/WebFrame.h"
128 #include "public/web/WebFrameClient.h" 132 #include "public/web/WebFrameClient.h"
129 #include "public/web/WebHitTestResult.h" 133 #include "public/web/WebHitTestResult.h"
130 #include "public/web/WebInputElement.h" 134 #include "public/web/WebInputElement.h"
131 #include "public/web/WebMediaPlayerAction.h" 135 #include "public/web/WebMediaPlayerAction.h"
132 #include "public/web/WebNode.h" 136 #include "public/web/WebNode.h"
133 #include "public/web/WebPlugin.h" 137 #include "public/web/WebPlugin.h"
134 #include "public/web/WebPluginAction.h" 138 #include "public/web/WebPluginAction.h"
135 #include "public/web/WebRange.h" 139 #include "public/web/WebRange.h"
136 #include "public/web/WebSelection.h" 140 #include "public/web/WebSelection.h"
137 #include "public/web/WebTextInputInfo.h" 141 #include "public/web/WebTextInputInfo.h"
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after
1906 if (m_continuousPaintingEnabled) { 1910 if (m_continuousPaintingEnabled) {
1907 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlays.get()); 1911 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlays.get());
1908 m_client->scheduleAnimation(); 1912 m_client->scheduleAnimation();
1909 } 1913 }
1910 } 1914 }
1911 1915
1912 void WebViewImpl::setNeedsLayoutAndFullPaintInvalidation() 1916 void WebViewImpl::setNeedsLayoutAndFullPaintInvalidation()
1913 { 1917 {
1914 if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame ()->view()) 1918 if (!mainFrameImpl() || !mainFrameImpl()->frame() || !mainFrameImpl()->frame ()->view())
1915 return; 1919 return;
1916
1917 FrameView* view = mainFrameImpl()->frame()->view(); 1920 FrameView* view = mainFrameImpl()->frame()->view();
1918 view->setNeedsLayout(); 1921 view->setNeedsLayout();
1919 view->setNeedsFullPaintInvalidation(); 1922 view->setNeedsFullPaintInvalidation();
1920 } 1923 }
1921 1924
1925 static void pushFrameTimingRequestRectsToGraphicsLayer(Page* page)
chrishtr 2015/04/17 23:59:57 Are you intending to collect here the sizes of all
1926 {
1927 typedef WTF::HashMap<const GraphicsLayer*,
chrishtr 2015/04/30 01:07:33 Move this function to FrameView, which will avoid
MikeB 2015/05/07 23:09:48 Done.
1928 std::vector<std::pair<int64_t, WebRect>>>
1929 GraphicsLayerFrameTimingRequests;
1930
1931 GraphicsLayerFrameTimingRequests glRequests;
chrishtr 2015/04/30 01:07:33 s/glRequests/graphicsLayerTimingRequests/
MikeB 2015/05/07 23:09:47 Done.
1932
1933 for (Frame* frame = page ? page->mainFrame() : 0; frame;
1934 frame = frame->tree().traverseNext()) {
1935
1936 // Need a LocalFrame to get the GraphicsLayer to use.
1937 if (!frame->isLocalFrame())
1938 continue;
1939
1940 LocalFrame* localframe = toLocalFrame(frame);
chrishtr 2015/04/30 01:07:33 s/localframe/localFrame/
MikeB 2015/05/07 23:09:47 Done.
1941 Document* document = localframe->document();
1942 HTMLFrameOwnerElement* ownerElement = document->ownerElement();
1943
1944 const GraphicsLayer* graphicsLayer = nullptr;
1945
1946 // Find frame's rect in graphics layer space
1947 LayoutRect rect = localframe->contentRenderer()->viewRect();
1948 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(
chrishtr 2015/04/30 01:07:33 I think you should be able to simply write: Depre
MikeB 2015/05/07 23:09:47 enclosingLayerForPaintInvalidationCrossingFrameBou
1949 localframe->contentRenderer(),
1950 localframe->contentRenderer()->containerForPaintInvalidation(),
1951 rect);
1952
1953 if (document->layoutView()->enclosingLayer()->compositingState()
1954 == PaintsIntoOwnBacking || !ownerElement) {
1955 DeprecatedPaintLayer* layer = document->layoutView()
1956 ->enclosingLayer()
1957 ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries();
1958 graphicsLayer = layer ? layer->graphicsLayerBacking() : nullptr;
1959 } else if (ownerElement->layoutObject()) {
1960 DeprecatedPaintLayer* layer = ownerElement->layoutObject()
1961 ->enclosingLayer()
1962 ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries();
1963 graphicsLayer = layer ? layer->graphicsLayerBacking() : nullptr;
1964 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(
1965 ownerElement->layoutObject(),
1966 ownerElement->layoutObject()->containerForPaintInvalidation(),
1967 rect);
1968 }
1969 if (!graphicsLayer)
1970 continue;
1971
1972 GraphicsLayerFrameTimingRequests::iterator requestIterator = glRequests. find(graphicsLayer);
1973 std::vector<std::pair<int64_t, WebRect>> *graphicsLayerTimingRects;
1974 if (requestIterator == glRequests.end()) {
1975 graphicsLayerTimingRects = &glRequests.add(graphicsLayer,
1976 std::vector<std::pair<int64_t, WebRect>>()).storedValue->value;
1977 } else {
1978 graphicsLayerTimingRects = &requestIterator->value;
1979 }
1980 graphicsLayerTimingRects->push_back(std::make_pair(frame->frameID(), enc losingIntRect(rect)));
1981 }
1982
1983 for (GraphicsLayerFrameTimingRequests::const_iterator iter = glRequests.begi n(); iter != glRequests.end(); ++iter) {
chrishtr 2015/04/30 01:07:33 Change WebLayer to have a method addFrameTimingReq
MikeB 2015/05/07 23:09:48 Not yet done. Will see about making this change on
1984 const GraphicsLayer* graphicsLayer = iter->key;
1985 graphicsLayer->platformLayer()->setFrameTimingRequests(iter->value);
1986 }
1987 }
1988
1922 void WebViewImpl::layout() 1989 void WebViewImpl::layout()
1923 { 1990 {
1924 TRACE_EVENT0("blink", "WebViewImpl::layout"); 1991 TRACE_EVENT0("blink", "WebViewImpl::layout");
1925 if (!mainFrameImpl()) 1992 if (!mainFrameImpl())
1926 return; 1993 return;
1927 1994
1928 PageWidgetDelegate::layout(*m_page, *mainFrameImpl()->frame()); 1995 PageWidgetDelegate::layout(*m_page, *mainFrameImpl()->frame());
1929 updateLayerTreeBackgroundColor(); 1996 updateLayerTreeBackgroundColor();
1930 1997
1931 for (size_t i = 0; i < m_linkHighlights.size(); ++i) 1998 for (size_t i = 0; i < m_linkHighlights.size(); ++i)
1932 m_linkHighlights[i]->updateGeometry(); 1999 m_linkHighlights[i]->updateGeometry();
2000
2001 if (RuntimeEnabledFeatures::frameTimingSupportEnabled())
2002 pushFrameTimingRequestRectsToGraphicsLayer(m_page.get());
chrishtr 2015/04/30 01:07:33 I think this should go in FrameView::updateLayoutA
MikeB 2015/05/07 23:09:48 Done, except for the dirty bit.
1933 } 2003 }
1934 2004
1935 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) 2005 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect)
1936 { 2006 {
1937 // This should only be used when compositing is not being used for this 2007 // This should only be used when compositing is not being used for this
1938 // WebView, and it is painting into the recording of its parent. 2008 // WebView, and it is painting into the recording of its parent.
1939 ASSERT(!isAcceleratedCompositingActive()); 2009 ASSERT(!isAcceleratedCompositingActive());
1940 2010
1941 double paintStart = currentTime(); 2011 double paintStart = currentTime();
1942 PageWidgetDelegate::paint(*m_page, pageOverlays(), canvas, rect, *m_page->de precatedLocalMainFrame()); 2012 PageWidgetDelegate::paint(*m_page, pageOverlays(), canvas, rect, *m_page->de precatedLocalMainFrame());
(...skipping 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after
4303 4373
4304 if (pageScaleDelta != 1) 4374 if (pageScaleDelta != 1)
4305 m_doubleTapZoomPending = false; 4375 m_doubleTapZoomPending = false;
4306 4376
4307 frameView->setElasticOverscroll(elasticOverscrollDelta + frameView->elasticO verscroll()); 4377 frameView->setElasticOverscroll(elasticOverscrollDelta + frameView->elasticO verscroll());
4308 4378
4309 updateMainFrameScrollPosition(frameView->scrollableArea()->scrollPositionDou ble() + 4379 updateMainFrameScrollPosition(frameView->scrollableArea()->scrollPositionDou ble() +
4310 DoubleSize(outerViewportDelta.width, outerViewportDelta.height), /* prog rammaticScroll */ false); 4380 DoubleSize(outerViewportDelta.width, outerViewportDelta.height), /* prog rammaticScroll */ false);
4311 } 4381 }
4312 4382
4383 void WebViewImpl::recordFrameTimingEvent(FrameTimingEventType eventType, int64_t FrameId, const WebVector<std::pair<int, double>>& events)
4384 {
4385 Frame* frame = m_page ? m_page->mainFrame() : 0;
4386
4387 while (frame && frame->frameID() != FrameId) {
4388 frame = frame->tree().traverseNext();
4389 }
4390
4391 if (!frame || !frame->domWindow() || !frame->domWindow()->document())
4392 return; // Can't find frame, it may have been cleaned up from the DOM.
4393
4394 blink::DOMWindow* domWindow = frame->domWindow();
4395 blink::Performance* performance = DOMWindowPerformance::performance(*domWind ow);
4396 for (size_t i = 0; i < events.size(); ++i) {
4397 if (eventType == CompositeEvent)
4398 performance->addCompositeTiming(domWindow->document(), events[i].fir st, events[i].second);
4399 else if (eventType == RenderEvent)
4400 performance->addRenderTiming(domWindow->document(), events[i].first, events[i].second);
4401 }
4402 }
4403
4313 void WebViewImpl::updateLayerTreeViewport() 4404 void WebViewImpl::updateLayerTreeViewport()
4314 { 4405 {
4315 if (!page() || !m_layerTreeView) 4406 if (!page() || !m_layerTreeView)
4316 return; 4407 return;
4317 4408
4318 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS caleFactor(), maximumPageScaleFactor()); 4409 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS caleFactor(), maximumPageScaleFactor());
4319 } 4410 }
4320 4411
4321 void WebViewImpl::updateLayerTreeBackgroundColor() 4412 void WebViewImpl::updateLayerTreeBackgroundColor()
4322 { 4413 {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
4457 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4548 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4458 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4549 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4459 } 4550 }
4460 4551
4461 void WebViewImpl::forceNextWebGLContextCreationToFail() 4552 void WebViewImpl::forceNextWebGLContextCreationToFail()
4462 { 4553 {
4463 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); 4554 WebGLRenderingContext::forceNextWebGLContextCreationToFail();
4464 } 4555 }
4465 4556
4466 } // namespace blink 4557 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698