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

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: Created 5 years, 10 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "core/frame/Settings.h" 57 #include "core/frame/Settings.h"
58 #include "core/frame/SmartClip.h" 58 #include "core/frame/SmartClip.h"
59 #include "core/html/HTMLInputElement.h" 59 #include "core/html/HTMLInputElement.h"
60 #include "core/html/HTMLMediaElement.h" 60 #include "core/html/HTMLMediaElement.h"
61 #include "core/html/HTMLPlugInElement.h" 61 #include "core/html/HTMLPlugInElement.h"
62 #include "core/html/HTMLTextAreaElement.h" 62 #include "core/html/HTMLTextAreaElement.h"
63 #include "core/html/canvas/WebGLRenderingContext.h" 63 #include "core/html/canvas/WebGLRenderingContext.h"
64 #include "core/html/forms/PopupMenuClient.h" 64 #include "core/html/forms/PopupMenuClient.h"
65 #include "core/html/ime/InputMethodContext.h" 65 #include "core/html/ime/InputMethodContext.h"
66 #include "core/inspector/InspectorController.h" 66 #include "core/inspector/InspectorController.h"
67 #include "core/layout/Layer.h"
67 #include "core/layout/compositing/LayerCompositor.h" 68 #include "core/layout/compositing/LayerCompositor.h"
68 #include "core/loader/DocumentLoader.h" 69 #include "core/loader/DocumentLoader.h"
69 #include "core/loader/FrameLoader.h" 70 #include "core/loader/FrameLoader.h"
70 #include "core/loader/UniqueIdentifier.h" 71 #include "core/loader/UniqueIdentifier.h"
71 #include "core/page/Chrome.h" 72 #include "core/page/Chrome.h"
72 #include "core/page/ContextMenuController.h" 73 #include "core/page/ContextMenuController.h"
73 #include "core/page/ContextMenuProvider.h" 74 #include "core/page/ContextMenuProvider.h"
74 #include "core/page/DragController.h" 75 #include "core/page/DragController.h"
75 #include "core/page/DragData.h" 76 #include "core/page/DragData.h"
76 #include "core/page/DragSession.h" 77 #include "core/page/DragSession.h"
77 #include "core/page/EventHandler.h" 78 #include "core/page/EventHandler.h"
78 #include "core/page/FocusController.h" 79 #include "core/page/FocusController.h"
79 #include "core/page/FrameTree.h" 80 #include "core/page/FrameTree.h"
80 #include "core/page/InjectedStyleSheets.h" 81 #include "core/page/InjectedStyleSheets.h"
81 #include "core/page/Page.h" 82 #include "core/page/Page.h"
82 #include "core/page/PagePopupClient.h" 83 #include "core/page/PagePopupClient.h"
83 #include "core/page/PointerLockController.h" 84 #include "core/page/PointerLockController.h"
84 #include "core/page/ScopedPageLoadDeferrer.h" 85 #include "core/page/ScopedPageLoadDeferrer.h"
85 #include "core/page/TouchDisambiguation.h" 86 #include "core/page/TouchDisambiguation.h"
87 #include "core/rendering/RenderGeometryMap.h"
86 #include "core/rendering/RenderPart.h" 88 #include "core/rendering/RenderPart.h"
87 #include "core/rendering/RenderView.h" 89 #include "core/rendering/RenderView.h"
88 #include "core/rendering/TextAutosizer.h" 90 #include "core/rendering/TextAutosizer.h"
89 #include "core/storage/StorageNamespaceController.h" 91 #include "core/storage/StorageNamespaceController.h"
92 #include "core/timing/Performance.h"
90 #include "modules/accessibility/AXObject.h" 93 #include "modules/accessibility/AXObject.h"
91 #include "modules/accessibility/AXObjectCacheImpl.h" 94 #include "modules/accessibility/AXObjectCacheImpl.h"
92 #include "modules/credentialmanager/CredentialManagerClient.h" 95 #include "modules/credentialmanager/CredentialManagerClient.h"
93 #include "modules/device_orientation/DeviceOrientationInspectorAgent.h" 96 #include "modules/device_orientation/DeviceOrientationInspectorAgent.h"
94 #include "modules/encryptedmedia/MediaKeysController.h" 97 #include "modules/encryptedmedia/MediaKeysController.h"
95 #include "modules/filesystem/InspectorFileSystemAgent.h" 98 #include "modules/filesystem/InspectorFileSystemAgent.h"
96 #include "modules/indexeddb/InspectorIndexedDBAgent.h" 99 #include "modules/indexeddb/InspectorIndexedDBAgent.h"
97 #include "modules/webdatabase/InspectorDatabaseAgent.h" 100 #include "modules/webdatabase/InspectorDatabaseAgent.h"
98 #include "platform/ContextMenu.h" 101 #include "platform/ContextMenu.h"
99 #include "platform/ContextMenuItem.h" 102 #include "platform/ContextMenuItem.h"
(...skipping 22 matching lines...) Expand all
122 #include "public/platform/WebFloatPoint.h" 125 #include "public/platform/WebFloatPoint.h"
123 #include "public/platform/WebGestureCurve.h" 126 #include "public/platform/WebGestureCurve.h"
124 #include "public/platform/WebImage.h" 127 #include "public/platform/WebImage.h"
125 #include "public/platform/WebLayerTreeView.h" 128 #include "public/platform/WebLayerTreeView.h"
126 #include "public/platform/WebURLRequest.h" 129 #include "public/platform/WebURLRequest.h"
127 #include "public/platform/WebVector.h" 130 #include "public/platform/WebVector.h"
128 #include "public/web/WebAXObject.h" 131 #include "public/web/WebAXObject.h"
129 #include "public/web/WebActiveWheelFlingParameters.h" 132 #include "public/web/WebActiveWheelFlingParameters.h"
130 #include "public/web/WebAutofillClient.h" 133 #include "public/web/WebAutofillClient.h"
131 #include "public/web/WebBeginFrameArgs.h" 134 #include "public/web/WebBeginFrameArgs.h"
135 #include "public/web/WebFrame.h"
132 #include "public/web/WebFrameClient.h" 136 #include "public/web/WebFrameClient.h"
133 #include "public/web/WebHitTestResult.h" 137 #include "public/web/WebHitTestResult.h"
134 #include "public/web/WebInputElement.h" 138 #include "public/web/WebInputElement.h"
135 #include "public/web/WebMediaPlayerAction.h" 139 #include "public/web/WebMediaPlayerAction.h"
136 #include "public/web/WebNode.h" 140 #include "public/web/WebNode.h"
141 #include "public/web/WebPerformance.h"
137 #include "public/web/WebPlugin.h" 142 #include "public/web/WebPlugin.h"
138 #include "public/web/WebPluginAction.h" 143 #include "public/web/WebPluginAction.h"
139 #include "public/web/WebRange.h" 144 #include "public/web/WebRange.h"
140 #include "public/web/WebTextInputInfo.h" 145 #include "public/web/WebTextInputInfo.h"
141 #include "public/web/WebViewClient.h" 146 #include "public/web/WebViewClient.h"
142 #include "public/web/WebWindowFeatures.h" 147 #include "public/web/WebWindowFeatures.h"
143 #include "web/CompositionUnderlineVectorBuilder.h" 148 #include "web/CompositionUnderlineVectorBuilder.h"
144 #include "web/ContextFeaturesClientImpl.h" 149 #include "web/ContextFeaturesClientImpl.h"
145 #include "web/DatabaseClientImpl.h" 150 #include "web/DatabaseClientImpl.h"
146 #include "web/FullscreenController.h" 151 #include "web/FullscreenController.h"
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 // FIXME: This should probably be using the local root? 1904 // FIXME: This should probably be using the local root?
1900 if (m_page->mainFrame()->isLocalFrame()) 1905 if (m_page->mainFrame()->isLocalFrame())
1901 PageWidgetDelegate::animate(*m_page, validFrameTime.lastFrameTimeMonoton ic, *m_page->deprecatedLocalMainFrame()); 1906 PageWidgetDelegate::animate(*m_page, validFrameTime.lastFrameTimeMonoton ic, *m_page->deprecatedLocalMainFrame());
1902 1907
1903 if (m_continuousPaintingEnabled) { 1908 if (m_continuousPaintingEnabled) {
1904 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlays.get()); 1909 ContinuousPainter::setNeedsDisplayRecursive(m_rootGraphicsLayer, m_pageO verlays.get());
1905 m_client->scheduleAnimation(); 1910 m_client->scheduleAnimation();
1906 } 1911 }
1907 } 1912 }
1908 1913
1914 static void findFrameTimingRequestRects(Page* page)
enne (OOO) 2015/02/10 00:17:49 Sorry for always bikeshedding, but find in a funct
MikeB 2015/03/18 21:18:34 Done.
1915 {
1916 typedef WTF::HashMap<const GraphicsLayer*,
enne (OOO) 2015/02/10 00:17:49 It's really too bad that Blink hasn't moved into t
MikeB 2015/03/18 21:18:34 I'm happy to take a stab at it, but not 100% clear
1917 std::vector<std::pair<int64_t, WebRect>>>
1918 GraphicsLayerFrameTimingRects;
enne (OOO) 2015/02/10 00:17:49 Rects => Requests?
MikeB 2015/03/18 21:18:34 Done.
1919
1920 GraphicsLayerFrameTimingRects glRects;
1921
1922 for (Frame* frame = page ? page->mainFrame() : 0; frame;
1923 frame = frame->tree().traverseNext()) {
1924
1925 if (!frame->isLocalFrame())
enne (OOO) 2015/02/10 00:17:49 Can you leave a comment why this is? How do reques
MikeB 2015/03/18 21:18:34 If I don't have a local frame, then I don't have a
1926 continue;
1927
1928 LocalFrame* localframe = toLocalFrame(frame);
1929 Document* document = localframe->document();
1930 HTMLFrameOwnerElement* ownerElement = document->ownerElement();
1931
1932 const GraphicsLayer* graphicsLayer;
1933
1934 // Find frame's rect in graphics layer space
1935 LayoutRect rect =
1936 localframe->contentRenderer()->rectForPaintInvalidation();
1937
1938 if (document->renderView()->enclosingLayer()->compositingState()
1939 == PaintsIntoOwnBacking || !ownerElement) {
1940 graphicsLayer = document->renderView()->enclosingLayer()
1941 ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries()
1942 ->graphicsLayerBacking();
1943 } else {
1944 if (!ownerElement->renderer())
1945 continue;
1946 graphicsLayer = ownerElement->renderer()->enclosingLayer()
1947 ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries()
1948 ->graphicsLayerBacking();
1949
1950 Layer::mapRectToPaintInvalidationBacking(
1951 ownerElement->renderer(),
1952 ownerElement->renderer()->containerForPaintInvalidation(),
1953 rect);
1954 }
1955
1956 GraphicsLayerFrameTimingRects::iterator glIter = glRects.find(graphicsLa yer);
1957 std::vector<std::pair<int64_t, WebRect>> *glVector;
1958 if (glIter == glRects.end()) {
1959 glVector = &glRects.add(graphicsLayer,
1960 std::vector<std::pair<int64_t, WebRect>>()).storedValue->value;
1961 } else {
1962 glVector = &glIter->value;
1963 }
1964 glVector->push_back(std::make_pair(frame->frameID(), enclosingIntRect(re ct)));
1965 }
1966
1967 for (GraphicsLayerFrameTimingRects::const_iterator iter = glRects.begin(); i ter != glRects.end(); ++iter) {
1968 const GraphicsLayer* graphicsLayer = iter->key;
1969 graphicsLayer->platformLayer()->setFrameTimingRequests(iter->value);
1970 }
1971 }
1972
1909 void WebViewImpl::layout() 1973 void WebViewImpl::layout()
1910 { 1974 {
1911 TRACE_EVENT0("blink", "WebViewImpl::layout"); 1975 TRACE_EVENT0("blink", "WebViewImpl::layout");
1912 if (!localFrameRootTemporary()) 1976 if (!localFrameRootTemporary())
1913 return; 1977 return;
1914 1978
1915 PageWidgetDelegate::layout(*m_page, *localFrameRootTemporary()->frame()); 1979 PageWidgetDelegate::layout(*m_page, *localFrameRootTemporary()->frame());
1916 updateLayerTreeBackgroundColor(); 1980 updateLayerTreeBackgroundColor();
1917 1981
1918 for (size_t i = 0; i < m_linkHighlights.size(); ++i) 1982 for (size_t i = 0; i < m_linkHighlights.size(); ++i)
1919 m_linkHighlights[i]->updateGeometry(); 1983 m_linkHighlights[i]->updateGeometry();
1984
1985 findFrameTimingRequestRects(m_page.get());
1920 } 1986 }
1921 1987
1922 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) 1988 void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect)
1923 { 1989 {
1924 // This should only be used when compositing is not being used for this 1990 // This should only be used when compositing is not being used for this
1925 // WebView, and it is painting into the recording of its parent. 1991 // WebView, and it is painting into the recording of its parent.
1926 ASSERT(!isAcceleratedCompositingActive()); 1992 ASSERT(!isAcceleratedCompositingActive());
1927 1993
1928 double paintStart = currentTime(); 1994 double paintStart = currentTime();
1929 PageWidgetDelegate::paint(*m_page, pageOverlays(), canvas, rect, isTranspare nt() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque, *m_page->de precatedLocalMainFrame()); 1995 PageWidgetDelegate::paint(*m_page, pageOverlays(), canvas, rect, isTranspare nt() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque, *m_page->de precatedLocalMainFrame());
(...skipping 2525 matching lines...) Expand 10 before | Expand all | Expand 10 after
4455 WebSize scrollOffset = mainFrame()->scrollOffset(); 4521 WebSize scrollOffset = mainFrame()->scrollOffset();
4456 scrollOffset.width += scrollDelta.width; 4522 scrollOffset.width += scrollDelta.width;
4457 scrollOffset.height += scrollDelta.height; 4523 scrollOffset.height += scrollDelta.height;
4458 4524
4459 WebPoint scrollPoint(scrollOffset.width, scrollOffset.height); 4525 WebPoint scrollPoint(scrollOffset.width, scrollOffset.height);
4460 setPageScaleFactor(pageScaleFactor() * pageScaleDelta, scrollPoint); 4526 setPageScaleFactor(pageScaleFactor() * pageScaleDelta, scrollPoint);
4461 m_doubleTapZoomPending = false; 4527 m_doubleTapZoomPending = false;
4462 } 4528 }
4463 } 4529 }
4464 4530
4531 void WebViewImpl::recordFrameTimingEvent(frameTimingEventType eventType, int64_t FrameId, const WebVector<std::pair<int, double>>& events)
4532 {
4533 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
4534 return;
4535
4536 Frame* frame = m_page ? m_page->mainFrame() : 0;
4537
4538 while (frame && frame->frameID() != FrameId) {
4539 frame = frame->tree().traverseNext();
4540 }
4541
4542 if (!frame || !frame->domWindow() || !frame->domWindow()->performance()
4543 || !frame->domWindow()->document())
4544 return; // ASSERT? Other way to report error?
4545
4546 ASSERT(frame->isLocalFrame());
4547
4548 Performance* performance = frame->domWindow()->performance();
4549 for (size_t i = 0; i < events.size(); ++i) {
4550 if (eventType == CompositeEvent)
4551 performance->addCompositeTiming(frame->domWindow()->document(), even ts[i].first, events[i].second);
4552 else if (eventType == RenderEvent)
4553 performance->addRenderTiming(frame->domWindow()->document(), events[ i].first, events[i].second);
4554 }
4555 }
4556
4465 void WebViewImpl::updateLayerTreeViewport() 4557 void WebViewImpl::updateLayerTreeViewport()
4466 { 4558 {
4467 if (!page() || !m_layerTreeView) 4559 if (!page() || !m_layerTreeView)
4468 return; 4560 return;
4469 4561
4470 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS caleFactor(), maximumPageScaleFactor()); 4562 m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), minimumPageS caleFactor(), maximumPageScaleFactor());
4471 } 4563 }
4472 4564
4473 void WebViewImpl::updateLayerTreeBackgroundColor() 4565 void WebViewImpl::updateLayerTreeBackgroundColor()
4474 { 4566 {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
4615 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width 4707 return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
4616 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1); 4708 || (constraints.minimumScale == constraints.maximumScale && constraints. minimumScale != -1);
4617 } 4709 }
4618 4710
4619 void WebViewImpl::forceNextWebGLContextCreationToFail() 4711 void WebViewImpl::forceNextWebGLContextCreationToFail()
4620 { 4712 {
4621 WebGLRenderingContext::forceNextWebGLContextCreationToFail(); 4713 WebGLRenderingContext::forceNextWebGLContextCreationToFail();
4622 } 4714 }
4623 4715
4624 } // namespace blink 4716 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698