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

Side by Side 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: Code review comments, plus update Render events to get finishTime as well. 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 2530 matching lines...) Expand 10 before | Expand all | Expand 10 after
2541 if (view) { 2541 if (view) {
2542 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateLayerTreeEvent: :data(m_frame.get())); 2542 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateLayerTreeEvent: :data(m_frame.get()));
2543 2543
2544 view->compositor()->updateIfNeededRecursive(); 2544 view->compositor()->updateIfNeededRecursive();
2545 2545
2546 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) 2546 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot())
2547 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); 2547 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded();
2548 2548
2549 updateCompositedSelectionIfNeeded(); 2549 updateCompositedSelectionIfNeeded();
2550 2550
2551 if (RuntimeEnabledFeatures::frameTimingSupportEnabled())
2552 updateFrameTimingRequestsIfNeeded();
2553
2551 scrollContentsIfNeededRecursive(); 2554 scrollContentsIfNeededRecursive();
2552 2555
2553 invalidateTreeIfNeededRecursive(); 2556 invalidateTreeIfNeededRecursive();
2554 2557
2555 ASSERT(!view->hasPendingSelection()); 2558 ASSERT(!view->hasPendingSelection());
2556 } 2559 }
2557 2560
2558 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); 2561 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean);
2559 } 2562 }
2560 2563
2564 void FrameView::updateFrameTimingRequestsIfNeeded()
2565 {
2566 GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests;
2567 // TODO(mpb) use a 'dirty' bit to not call this every time.
2568 collectFrameTimingRequestsRecursive(graphicsLayerTimingRequests);
2569
2570 for (const auto& iter : graphicsLayerTimingRequests) {
2571 const GraphicsLayer* graphicsLayer = iter.key;
2572 graphicsLayer->platformLayer()->setFrameTimingRequests(iter.value);
2573 }
2574 }
2575
2561 void FrameView::updateLayoutAndStyleIfNeededRecursive() 2576 void FrameView::updateLayoutAndStyleIfNeededRecursive()
2562 { 2577 {
2563 // We have to crawl our entire subtree looking for any FrameViews that need 2578 // We have to crawl our entire subtree looking for any FrameViews that need
2564 // layout and make sure they are up to date. 2579 // layout and make sure they are up to date.
2565 // Mac actually tests for intersection with the dirty region and tries not t o 2580 // Mac actually tests for intersection with the dirty region and tries not t o
2566 // update layout for frames that are outside the dirty region. Not only doe s this seem 2581 // update layout for frames that are outside the dirty region. Not only doe s this seem
2567 // pointless (since those frames will have set a zero timer to layout anyway ), but 2582 // pointless (since those frames will have set a zero timer to layout anyway ), but
2568 // it is also incorrect, since if two frames overlap, the first could be exc luded from the dirty 2583 // it is also incorrect, since if two frames overlap, the first could be exc luded from the dirty
2569 // region but then become included later by the second frame adding rects to the dirty region 2584 // region but then become included later by the second frame adding rects to the dirty region
2570 // when it lays out. 2585 // when it lays out.
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
4010 4025
4011 LayoutObject* FrameView::viewportLayoutObject() 4026 LayoutObject* FrameView::viewportLayoutObject()
4012 { 4027 {
4013 if (Document* document = frame().document()) { 4028 if (Document* document = frame().document()) {
4014 if (Element* element = document->viewportDefiningElement()) 4029 if (Element* element = document->viewportDefiningElement())
4015 return element->layoutObject(); 4030 return element->layoutObject();
4016 } 4031 }
4017 return nullptr; 4032 return nullptr;
4018 } 4033 }
4019 4034
4035 void FrameView::collectFrameTimingRequestsRecursive(GraphicsLayerFrameTimingRequ ests& graphicsLayerTimingRequests)
4036 {
4037 collectFrameTimingRequests(graphicsLayerTimingRequests);
4038
4039 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
4040 if (!child->isLocalFrame())
4041 continue;
4042
4043 toLocalFrame(child)->view()->collectFrameTimingRequestsRecursive(graphic sLayerTimingRequests);
4044 }
4045 }
4046
4047 void FrameView::collectFrameTimingRequests(GraphicsLayerFrameTimingRequests& gra phicsLayerTimingRequests)
4048 {
4049 if (!m_frame->isLocalFrame())
4050 return;
4051 Frame* frame = m_frame.get();
4052 LocalFrame* localFrame = toLocalFrame(frame);
4053 LayoutRect viewRect = localFrame->contentLayoutObject()->viewRect();
4054 const LayoutBoxModelObject* paintInvalidationContainer = localFrame->content LayoutObject()->containerForPaintInvalidation();
4055 const GraphicsLayer* graphicsLayer = paintInvalidationContainer->enclosingLa yer()->graphicsLayerBacking();
4056
4057 if (!graphicsLayer)
4058 return;
4059
4060 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), paintInvalidationContainer, viewRect);
4061
4062 graphicsLayerTimingRequests.add(graphicsLayer, std::vector<std::pair<int64_t , WebRect>>()).storedValue->value.push_back(std::make_pair(m_frame->frameID(), e nclosingIntRect(viewRect)));
4063 }
4064
4020 } // namespace blink 4065 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698