OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "core/paint/SubtreeInfoRecorder.h" |
| 7 |
| 8 #include "core/rendering/RenderObject.h" |
| 9 #include "platform/RuntimeEnabledFeatures.h" |
| 10 #include "platform/graphics/GraphicsContext.h" |
| 11 #include "platform/graphics/paint/DisplayItemList.h" |
| 12 #include "platform/graphics/paint/SubtreeDisplayItem.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 SubtreeInfoRecorder::SubtreeInfoRecorder(GraphicsContext* context, const RenderO
bject& subtreeRoot, PaintPhase paintPhase) |
| 17 : m_displayItemList(context->displayItemList()) |
| 18 , m_subtreeRoot(subtreeRoot) |
| 19 , m_paintPhase(paintPhase) |
| 20 , m_begun(false) |
| 21 { |
| 22 if (!RuntimeEnabledFeatures::slimmingPaintEnabled() || !RuntimeEnabledFeatur
es::slimmingPaintDisplayItemCacheEnabled()) |
| 23 return; |
| 24 |
| 25 ASSERT(m_displayItemList); |
| 26 } |
| 27 |
| 28 SubtreeInfoRecorder::~SubtreeInfoRecorder() |
| 29 { |
| 30 if (!RuntimeEnabledFeatures::slimmingPaintEnabled() || !RuntimeEnabledFeatur
es::slimmingPaintDisplayItemCacheEnabled()) |
| 31 return; |
| 32 |
| 33 if (m_begun) |
| 34 addDisplayItem(EndSubtreeDisplayItem::create(m_subtreeRoot.displayItemCl
ient(), DisplayItem::paintPhaseToEndSubtreeType(m_paintPhase))); |
| 35 else if (m_displayItemList->clientCacheIsValid(m_subtreeRoot.displayItemClie
nt())) |
| 36 addDisplayItem(SubtreeCachedDisplayItem::create(m_subtreeRoot.displayIte
mClient(), DisplayItem::paintPhaseToSubtreeCachedType(m_paintPhase))); |
| 37 } |
| 38 |
| 39 void SubtreeInfoRecorder::begin() |
| 40 { |
| 41 if (!RuntimeEnabledFeatures::slimmingPaintEnabled() || !RuntimeEnabledFeatur
es::slimmingPaintDisplayItemCacheEnabled()) |
| 42 return; |
| 43 |
| 44 addDisplayItem(BeginSubtreeDisplayItem::create(m_subtreeRoot.displayItemClie
nt(), DisplayItem::paintPhaseToBeginSubtreeType(m_paintPhase))); |
| 45 m_begun = true; |
| 46 } |
| 47 |
| 48 void SubtreeInfoRecorder::addDisplayItem(PassOwnPtr<DisplayItem> displayItem) |
| 49 { |
| 50 #ifndef NDEBUG |
| 51 displayItem->setClientDebugString(String::format("subtreeRoot: \"%p %s\"", &
m_subtreeRoot, m_subtreeRoot.debugName().utf8().data())); |
| 52 #endif |
| 53 m_displayItemList->add(displayItem); |
| 54 } |
| 55 |
| 56 } // namespace blink |
OLD | NEW |