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

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: 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 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 2517 matching lines...) Expand 10 before | Expand all | Expand 10 after
2528 if (view) { 2528 if (view) {
2529 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateLayerTreeEvent: :data(m_frame.get())); 2529 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateLayerTreeEvent: :data(m_frame.get()));
2530 2530
2531 view->compositor()->updateIfNeededRecursive(); 2531 view->compositor()->updateIfNeededRecursive();
2532 2532
2533 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot()) 2533 if (view->compositor()->inCompositingMode() && m_frame->isLocalRoot())
2534 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded(); 2534 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded();
2535 2535
2536 updateCompositedSelectionIfNeeded(); 2536 updateCompositedSelectionIfNeeded();
2537 2537
2538 if (RuntimeEnabledFeatures::frameTimingSupportEnabled())
2539 updateFrameTimingRequestsIfNeeded();
2540
2538 scrollContentsIfNeededRecursive(); 2541 scrollContentsIfNeededRecursive();
2539 2542
2540 invalidateTreeIfNeededRecursive(); 2543 invalidateTreeIfNeededRecursive();
2541 2544
2542 ASSERT(!view->hasPendingSelection()); 2545 ASSERT(!view->hasPendingSelection());
2543 } 2546 }
2544 2547
2545 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); 2548 ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean);
2546 } 2549 }
2547 2550
2551 void FrameView::updateFrameTimingRequestsIfNeeded()
2552 {
2553 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.
2554 collectFrameTimingRequestsRecursive(graphicsLayerTimingRequests);
2555
2556 for (const auto& iter : graphicsLayerTimingRequests) {
2557 const GraphicsLayer* graphicsLayer = iter.key;
2558 graphicsLayer->platformLayer()->setFrameTimingRequests(iter.value);
2559 }
2560 }
2561
2548 void FrameView::updateLayoutAndStyleIfNeededRecursive() 2562 void FrameView::updateLayoutAndStyleIfNeededRecursive()
2549 { 2563 {
2550 // We have to crawl our entire tree looking for any FrameViews that need 2564 // We have to crawl our entire tree looking for any FrameViews that need
2551 // layout and make sure they are up to date. 2565 // layout and make sure they are up to date.
2552 // Mac actually tests for intersection with the dirty region and tries not t o 2566 // Mac actually tests for intersection with the dirty region and tries not t o
2553 // update layout for frames that are outside the dirty region. Not only doe s this seem 2567 // update layout for frames that are outside the dirty region. Not only doe s this seem
2554 // pointless (since those frames will have set a zero timer to layout anyway ), but 2568 // pointless (since those frames will have set a zero timer to layout anyway ), but
2555 // it is also incorrect, since if two frames overlap, the first could be exc luded from the dirty 2569 // it is also incorrect, since if two frames overlap, the first could be exc luded from the dirty
2556 // region but then become included later by the second frame adding rects to the dirty region 2570 // region but then become included later by the second frame adding rects to the dirty region
2557 // when it lays out. 2571 // when it lays out.
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
3997 4011
3998 LayoutObject* FrameView::viewportLayoutObject() 4012 LayoutObject* FrameView::viewportLayoutObject()
3999 { 4013 {
4000 if (Document* document = frame().document()) { 4014 if (Document* document = frame().document()) {
4001 if (Element* element = document->viewportDefiningElement()) 4015 if (Element* element = document->viewportDefiningElement())
4002 return element->layoutObject(); 4016 return element->layoutObject();
4003 } 4017 }
4004 return nullptr; 4018 return nullptr;
4005 } 4019 }
4006 4020
4021 void FrameView::collectFrameTimingRequestsRecursive(
4022 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.
4023 {
4024 for (Frame* frame = m_frame.get(); frame;
4025 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.
4026 if (!frame->isLocalFrame())
4027 continue;
4028 LocalFrame* localFrame = toLocalFrame(frame);
4029 LayoutRect rect = localFrame->contentLayoutObject()->viewRect();
4030
4031 DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(
4032 localFrame->contentLayoutObject(),
4033 localFrame->contentLayoutObject()->containerForPaintInvalidation(),
4034 rect);
4035
4036 const DeprecatedPaintLayer* layer = localFrame->contentLayoutObject()
4037 ->enclosingLayer()
4038 ->enclosingLayerForPaintInvalidationCrossingFrameBoundaries();
chrishtr 2015/05/08 16:52:04 containerForPaintInvalidation() is the same as thi
MikeB 2015/05/08 18:37:34 Done.
4039 const GraphicsLayer* graphicsLayer = !layer ? nullptr :
4040 layer->graphicsLayerBacking();
4041
4042 if (!graphicsLayer)
4043 continue;
4044
4045 GraphicsLayerFrameTimingRequests::iterator requestIterator =
4046 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
4047 std::vector<std::pair<int64_t, WebRect>> *graphicsLayerTimingRects;
4048 if (requestIterator == graphicsLayerTimingRequests.end()) {
4049 graphicsLayerTimingRects = &graphicsLayerTimingRequests.add(
4050 graphicsLayer,
4051 std::vector<std::pair<int64_t, WebRect>>()).storedValue->value;
4052 } else {
4053 graphicsLayerTimingRects = &requestIterator->value;
4054 }
4055 graphicsLayerTimingRects->push_back(
4056 std::make_pair(frame->frameID(), enclosingIntRect(rect)));
4057
4058 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.
4059 if (FrameView* view = localFrame->view()) {
4060 view->collectFrameTimingRequestsRecursive(
4061 graphicsLayerTimingRequests);
4062 }
4063 }
4064 }
4065 }
4066
4007 } // namespace blink 4067 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698