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

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 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 2515 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 if (view) { 2526 if (view) {
2527 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateLayerTreeEvent: :data(m_frame.get())); 2527 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateLayerTreeEvent: :data(m_frame.get()));
2528 2528
2529 view->compositor()->updateIfNeededRecursive(); 2529 view->compositor()->updateIfNeededRecursive();
2530 2530
2531 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) 2531 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot())
2532 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); 2532 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded();
2533 2533
2534 updateCompositedSelectionIfNeeded(); 2534 updateCompositedSelectionIfNeeded();
2535 2535
2536 if (RuntimeEnabledFeatures::frameTimingSupportEnabled())
2537 updateFrameTimingRequestsIfNeeded();
2538
2536 scrollContentsIfNeededRecursive(); 2539 scrollContentsIfNeededRecursive();
2537 2540
2538 invalidateTreeIfNeededRecursive(); 2541 invalidateTreeIfNeededRecursive();
2539 2542
2540 ASSERT(!view->hasPendingSelection()); 2543 ASSERT(!view->hasPendingSelection());
2541 } 2544 }
2542 2545
2543 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); 2546 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean);
2544 } 2547 }
2545 2548
2549 void FrameView::updateFrameTimingRequestsIfNeeded()
2550 {
2551 GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests;
2552 // TODO(mpb) use a 'dirty' bit to not call this every time.
2553 collectFrameTimingRequestsRecursive(graphicsLayerTimingRequests);
2554
2555 for (const auto& iter : graphicsLayerTimingRequests) {
2556 const GraphicsLayer* graphicsLayer = iter.key;
2557 graphicsLayer->platformLayer()->setFrameTimingRequests(iter.value);
2558 }
2559 }
2560
2546 void FrameView::updateLayoutAndStyleIfNeededRecursive() 2561 void FrameView::updateLayoutAndStyleIfNeededRecursive()
2547 { 2562 {
2548 // We have to crawl our entire tree looking for any FrameViews that need 2563 // We have to crawl our entire tree looking for any FrameViews that need
2549 // layout and make sure they are up to date. 2564 // layout and make sure they are up to date.
2550 // Mac actually tests for intersection with the dirty region and tries not t o 2565 // Mac actually tests for intersection with the dirty region and tries not t o
2551 // update layout for frames that are outside the dirty region. Not only doe s this seem 2566 // update layout for frames that are outside the dirty region. Not only doe s this seem
2552 // pointless (since those frames will have set a zero timer to layout anyway ), but 2567 // pointless (since those frames will have set a zero timer to layout anyway ), but
2553 // it is also incorrect, since if two frames overlap, the first could be exc luded from the dirty 2568 // it is also incorrect, since if two frames overlap, the first could be exc luded from the dirty
2554 // region but then become included later by the second frame adding rects to the dirty region 2569 // region but then become included later by the second frame adding rects to the dirty region
2555 // when it lays out. 2570 // when it lays out.
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
3995 4010
3996 LayoutObject* FrameView::viewportLayoutObject() 4011 LayoutObject* FrameView::viewportLayoutObject()
3997 { 4012 {
3998 if (Document* document = frame().document()) { 4013 if (Document* document = frame().document()) {
3999 if (Element* element = document->viewportDefiningElement()) 4014 if (Element* element = document->viewportDefiningElement())
4000 return element->layoutObject(); 4015 return element->layoutObject();
4001 } 4016 }
4002 return nullptr; 4017 return nullptr;
4003 } 4018 }
4004 4019
4020 void FrameView::collectFrameTimingRequestsRecursive(GraphicsLayerFrameTimingRequ ests& graphicsLayerTimingRequests)
4021 {
4022 collectFrameTimingRequests(graphicsLayerTimingRequests);
4023
4024 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
4025 if (!child->isLocalFrame())
4026 continue;
4027
4028 toLocalFrame(child)->view()->collectFrameTimingRequestsRecursive(graphic sLayerTimingRequests);
4029 }
4030 }
4031
4032 void FrameView::collectFrameTimingRequests(GraphicsLayerFrameTimingRequests& gra phicsLayerTimingRequests)
4033 {
4034 if (!m_frame->isLocalFrame())
4035 return;
4036 Frame* frame = m_frame.get();
4037 LocalFrame* localFrame = toLocalFrame(frame);
4038 LayoutRect rect = localFrame->contentLayoutObject()->viewRect();
chrishtr 2015/05/09 00:46:42 s/rect/viewRect/
MikeB 2015/05/11 23:10:51 Done.
4039 const LayoutBoxModelObject* container = localFrame->contentLayoutObject()->c ontainerForPaintInvalidation();
4040 const DeprecatedPaintLayer* layer = container->enclosingLayer();
chrishtr 2015/05/09 00:46:42 Some more nits: Remove the layer local variable,
4041 const GraphicsLayer* graphicsLayer = !layer ? nullptr : layer->graphicsLayer Backing();
4042
4043 if (!graphicsLayer)
4044 return;
4045
4046 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentL ayoutObject(), container, rect);
4047
4048 graphicsLayerTimingRequests.add(graphicsLayer, std::vector<std::pair<int64_t , WebRect>>()).storedValue->value.push_back(std::make_pair(m_frame->frameID(), e nclosingIntRect(rect)));
4049 }
4050
4005 } // namespace blink 4051 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698