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