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

Unified Diff: Source/web/WebViewImpl.cpp

Issue 390193003: [not for review] Add Draw entries to window Performance Timeline (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Git pull syncup Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | public/platform/WebLayer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index ed67d3c13a51a80ff78c4f222a4cc9401e4a4ea7..7c866316dbac2ebb1ff40ec50a2cedcc1cea5de5 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -81,10 +81,13 @@
#include "core/page/PointerLockController.h"
#include "core/page/ScopedPageLoadDeferrer.h"
#include "core/page/TouchDisambiguation.h"
+#include "core/rendering/RenderGeometryMap.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/RenderWidget.h"
#include "core/rendering/TextAutosizer.h"
+#include "core/rendering/compositing/CompositedLayerMapping.h"
#include "core/rendering/compositing/RenderLayerCompositor.h"
+#include "core/timing/Performance.h"
#include "modules/credentialmanager/CredentialManagerClient.h"
#include "modules/device_orientation/DeviceOrientationInspectorAgent.h"
#include "modules/encryptedmedia/MediaKeysController.h"
@@ -126,11 +129,13 @@
#include "public/web/WebActiveWheelFlingParameters.h"
#include "public/web/WebAutofillClient.h"
#include "public/web/WebBeginFrameArgs.h"
+#include "public/web/WebFrame.h"
#include "public/web/WebFrameClient.h"
#include "public/web/WebHitTestResult.h"
#include "public/web/WebInputElement.h"
#include "public/web/WebMediaPlayerAction.h"
#include "public/web/WebNode.h"
+#include "public/web/WebPerformance.h"
#include "public/web/WebPlugin.h"
#include "public/web/WebPluginAction.h"
#include "public/web/WebRange.h"
@@ -1780,6 +1785,68 @@ void WebViewImpl::didCommitFrameToCompositor()
Scheduler::shared()->didCommitFrameToCompositor();
}
+typedef WTF::HashMap<const GraphicsLayer*, std::vector<std::pair<int64_t, WebRect> > >
+GraphicsLayerDrawRects;
+
+static void findSmoothnessRequestRects(Page* page)
+{
+ typedef WTF::HashMap<const GraphicsLayer*,
+ std::vector<std::pair<int64_t, WebRect> > >
+ GraphicsLayerSmoothnessRects;
+
+ GraphicsLayerSmoothnessRects glRects;
+
+ for (Frame* frame = page ? page->mainFrame() : 0; frame;
+ frame = frame->tree().traverseNext()) {
+
+ if (!frame->isLocalFrame())
+ continue;
+
+ LocalFrame* localframe = toLocalFrame(frame);
+ Document* document = localframe->document();
+ HTMLFrameOwnerElement* ownerElement = document->ownerElement();
+
+ const GraphicsLayer* graphicsLayer;
+
+ // Find frame's rect in graphics layer space
+ LayoutRect rect =
+ localframe->contentRenderer()->rectForPaintInvalidation();
+
+ if (document->renderView()->enclosingLayer()->compositingState()
+ == PaintsIntoOwnBacking || !ownerElement) {
+ graphicsLayer = document->renderView()->enclosingLayer()
+ ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries()
+ ->graphicsLayerBacking();
+ } else {
+ if (!ownerElement->renderer())
+ continue;
+ graphicsLayer = ownerElement->renderer()->enclosingLayer()
+ ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries()
+ ->graphicsLayerBacking();
+
+ RenderLayer::mapRectToPaintInvalidationBacking(
+ ownerElement->renderer(),
+ ownerElement->renderer()->containerForPaintInvalidation(),
+ rect);
+ }
+
+ GraphicsLayerSmoothnessRects::iterator glIter = glRects.find(graphicsLayer);
+ std::vector<std::pair<int64_t, WebRect> > *glVector;
+ if (glIter == glRects.end()) {
+ glVector = &glRects.add(graphicsLayer,
+ std::vector<std::pair<int64_t, WebRect> >()).storedValue->value;
+ } else {
+ glVector = &glIter->value;
+ }
+ glVector->push_back(std::make_pair(frame->frameID(), enclosingIntRect(rect)));
+ }
+
+ for (GraphicsLayerSmoothnessRects::const_iterator iter = glRects.begin(); iter != glRects.end(); ++iter) {
+ const GraphicsLayer* graphicsLayer = iter->key;
+ graphicsLayer->platformLayer()->setSmoothnessTimingRequests(iter->value);
+ }
+}
+
void WebViewImpl::layout()
{
TRACE_EVENT0("blink", "WebViewImpl::layout");
@@ -1792,6 +1859,8 @@ void WebViewImpl::layout()
for (size_t i = 0; i < m_linkHighlights.size(); ++i)
m_linkHighlights[i]->updateGeometry();
+ findSmoothnessRequestRects(m_page.get());
+
if (m_devToolsAgent)
m_devToolsAgent->didLayout();
}
@@ -4147,6 +4216,32 @@ void WebViewImpl::applyViewportDeltas(const WebSize& scrollDelta, float pageScal
}
}
+void WebViewImpl::recordSmoothnessTimingEvent(smoothnessTimingEventType eventType, int64_t FrameId, const WebVector<std::pair<int, double> >& events)
+{
+ if (!mainFrameImpl() || !mainFrameImpl()->frameView())
+ return;
+
+ Frame* frame = m_page ? m_page->mainFrame() : 0;
+
+ while (frame && frame->frameID() != FrameId) {
+ frame = frame->tree().traverseNext();
+ }
+
+ if (!frame)
+ return; // ASSERT? Other way to report error?
+
+ ASSERT(frame->isLocalFrame());
+
+ blink::LocalDOMWindow* domWindow = toLocalFrame(frame)->domWindow();
+ blink::Performance& performance = domWindow->performance();
+ for (size_t i = 0; i < events.size(); ++i) {
+ if (eventType == CompositeEvent)
+ performance.addSmoothnessTiming("composite", domWindow->document(), events[i].first, events[i].second);
+ else if (eventType == CommitEvent)
+ performance.addSmoothnessTiming("commit", domWindow->document(), events[i].first, events[i].second);
+ }
+}
+
void WebViewImpl::updateLayerTreeViewport()
{
if (!page() || !m_layerTreeView)
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | public/platform/WebLayer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698