Chromium Code Reviews| Index: Source/core/frame/FrameView.cpp |
| diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp |
| index 5d67dc924e04a052fb8c34ce580be8ccf318aa01..3bd91077c27373d01538b927f544434ae32a798b 100644 |
| --- a/Source/core/frame/FrameView.cpp |
| +++ b/Source/core/frame/FrameView.cpp |
| @@ -2533,6 +2533,9 @@ void FrameView::updateLayoutAndStyleForPainting() |
| updateCompositedSelectionIfNeeded(); |
| + if (RuntimeEnabledFeatures::frameTimingSupportEnabled()) |
| + updateFrameTimingRequestsIfNeeded(); |
| + |
| scrollContentsIfNeededRecursive(); |
| invalidateTreeIfNeededRecursive(); |
| @@ -2543,6 +2546,18 @@ void FrameView::updateLayoutAndStyleForPainting() |
| ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean); |
| } |
| +void FrameView::updateFrameTimingRequestsIfNeeded() |
| +{ |
| + GraphicsLayerFrameTimingRequests graphicsLayerTimingRequests; |
| + // TODO(mpb) use a 'dirty' bit to not call this every time. |
| + 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 |
| @@ -4002,4 +4017,35 @@ LayoutObject* FrameView::viewportLayoutObject() |
| return nullptr; |
| } |
| +void FrameView::collectFrameTimingRequestsRecursive(GraphicsLayerFrameTimingRequests& graphicsLayerTimingRequests) |
| +{ |
| + collectFrameTimingRequests(graphicsLayerTimingRequests); |
| + |
| + for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) { |
| + if (!child->isLocalFrame()) |
| + continue; |
| + |
| + toLocalFrame(child)->view()->collectFrameTimingRequestsRecursive(graphicsLayerTimingRequests); |
| + } |
| +} |
| + |
| +void FrameView::collectFrameTimingRequests(GraphicsLayerFrameTimingRequests& graphicsLayerTimingRequests) |
| +{ |
| + if (!m_frame->isLocalFrame()) |
| + return; |
| + Frame* frame = m_frame.get(); |
| + LocalFrame* localFrame = toLocalFrame(frame); |
| + LayoutRect rect = localFrame->contentLayoutObject()->viewRect(); |
|
chrishtr
2015/05/09 00:46:42
s/rect/viewRect/
MikeB
2015/05/11 23:10:51
Done.
|
| + const LayoutBoxModelObject* container = localFrame->contentLayoutObject()->containerForPaintInvalidation(); |
| + const DeprecatedPaintLayer* layer = container->enclosingLayer(); |
|
chrishtr
2015/05/09 00:46:42
Some more nits:
Remove the layer local variable,
|
| + const GraphicsLayer* graphicsLayer = !layer ? nullptr : layer->graphicsLayerBacking(); |
| + |
| + if (!graphicsLayer) |
| + return; |
| + |
| + DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentLayoutObject(), container, rect); |
| + |
| + graphicsLayerTimingRequests.add(graphicsLayer, std::vector<std::pair<int64_t, WebRect>>()).storedValue->value.push_back(std::make_pair(m_frame->frameID(), enclosingIntRect(rect))); |
| +} |
| + |
| } // namespace blink |