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

Unified Diff: Source/core/frame/FrameView.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: Move Frame Timing rect collection from WebViewImpl to FrameView. Created 5 years, 7 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
Index: Source/core/frame/FrameView.cpp
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
index add17f97e6f65830268df93b0136af9dba331407..0ce09b6ed15dccd3b1169fcbd8c21ac0963a8050 100644
--- a/Source/core/frame/FrameView.cpp
+++ b/Source/core/frame/FrameView.cpp
@@ -2535,6 +2535,9 @@ void FrameView::updateLayoutAndStyleForPainting()
updateCompositedSelectionIfNeeded();
+ if (RuntimeEnabledFeatures::frameTimingSupportEnabled())
+ updateFrameTimingRequestsIfNeeded();
+
scrollContentsIfNeededRecursive();
invalidateTreeIfNeededRecursive();
@@ -2545,6 +2548,17 @@ void FrameView::updateLayoutAndStyleForPainting()
ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean);
}
+void FrameView::updateFrameTimingRequestsIfNeeded()
+{
+ GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests;
chrishtr 2015/05/08 16:52:04 Add a TODO(mpb) to add the dirty bit.
MikeB 2015/05/08 18:37:34 Done.
+ collectFrameTimingRequestsRecursive(graphicsLayerTimingRequests);
+
+ for (const auto& iter : graphicsLayerTimingRequests) {
+ const GraphicsLayer* graphicsLayer = iter.key;
+ graphicsLayer->platformLayer()->setFrameTimingRequests(iter.value);
+ }
+}
+
void FrameView::updateLayoutAndStyleIfNeededRecursive()
{
// We have to crawl our entire tree looking for any FrameViews that need
@@ -4004,4 +4018,50 @@ LayoutObject* FrameView::viewportLayoutObject()
return nullptr;
}
+void FrameView::collectFrameTimingRequestsRecursive(
+ GraphicsLayerFrameTimingRequests& graphicsLayerTimingRequests)
chrishtr 2015/05/08 16:52:04 Put this on the same line. Blink has no 80-column
MikeB 2015/05/08 18:37:34 Done.
+{
+ for (Frame* frame = m_frame.get(); frame;
+ frame = frame->tree().traverseNext(m_frame.get())) {
chrishtr 2015/05/08 16:52:04 same here IMO. Consider reducing lines in the rest
MikeB 2015/05/08 18:37:34 Done.
+ if (!frame->isLocalFrame())
+ continue;
+ LocalFrame* localFrame = toLocalFrame(frame);
+ LayoutRect rect = localFrame->contentLayoutObject()->viewRect();
+
+ DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(
+ localFrame->contentLayoutObject(),
+ localFrame->contentLayoutObject()->containerForPaintInvalidation(),
+ rect);
+
+ const DeprecatedPaintLayer* layer = localFrame->contentLayoutObject()
+ ->enclosingLayer()
+ ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries();
chrishtr 2015/05/08 16:52:04 containerForPaintInvalidation() is the same as thi
MikeB 2015/05/08 18:37:34 Done.
+ const GraphicsLayer* graphicsLayer = !layer ? nullptr :
+ layer->graphicsLayerBacking();
+
+ if (!graphicsLayer)
+ continue;
+
+ GraphicsLayerFrameTimingRequests::iterator requestIterator =
+ graphicsLayerTimingRequests.find(graphicsLayer);
chrishtr 2015/05/08 16:52:04 I think you can just write: graphicsLayerTimingRe
MikeB 2015/05/08 18:37:34 error: no viable overloaded operator[] for type 'G
+ std::vector<std::pair<int64_t, WebRect>> *graphicsLayerTimingRects;
+ if (requestIterator == graphicsLayerTimingRequests.end()) {
+ graphicsLayerTimingRects = &graphicsLayerTimingRequests.add(
+ graphicsLayer,
+ std::vector<std::pair<int64_t, WebRect>>()).storedValue->value;
+ } else {
+ graphicsLayerTimingRects = &requestIterator->value;
+ }
+ graphicsLayerTimingRects->push_back(
+ std::make_pair(frame->frameID(), enclosingIntRect(rect)));
+
+ if (frame != m_frame.get()) {
chrishtr 2015/05/08 16:52:04 Factor into two methods, one which does the recurs
MikeB 2015/05/08 18:37:34 Done.
+ if (FrameView* view = localFrame->view()) {
+ view->collectFrameTimingRequestsRecursive(
+ graphicsLayerTimingRequests);
+ }
+ }
+ }
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698