Chromium Code Reviews| 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 "platform/graphics/paint/SubsequenceRecorder.h" | |
| 7 | |
| 8 #include "platform/RuntimeEnabledFeatures.h" | |
| 9 #include "platform/graphics/GraphicsContext.h" | |
| 10 #include "platform/graphics/paint/CachedDisplayItem.h" | |
| 11 #include "platform/graphics/paint/DisplayItemList.h" | |
| 12 #include "platform/graphics/paint/SubsequenceDisplayItem.h" | |
| 13 | |
| 14 namespace blink { | |
| 15 | |
| 16 bool SubsequenceRecorder::useCachedSubsequenceIfPossible(GraphicsContext& contex t, const DisplayItemClientWrapper& client) | |
| 17 { | |
| 18 // The conditions of returning false is not complete for a specific client. | |
|
chrishtr
2015/08/26 23:34:23
Move to .h file, and suggest changing as described
Xianzhu
2015/08/26 23:42:36
Done.
| |
| 19 // The client must check additional conditions before calling this function. | |
| 20 | |
| 21 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
| 22 return false; | |
| 23 | |
| 24 ASSERT(context.displayItemList()); | |
| 25 | |
| 26 if (context.displayItemList()->displayItemConstructionIsDisabled() || Runtim eEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) | |
| 27 return false; | |
| 28 | |
| 29 if (!context.displayItemList()->clientCacheIsValid(client.displayItemClient( ))) | |
| 30 return false; | |
| 31 | |
| 32 context.displayItemList()->createAndAppend<CachedDisplayItem>(client, Displa yItem::CachedSubsequence); | |
| 33 return true; | |
| 34 } | |
| 35 | |
| 36 SubsequenceRecorder::SubsequenceRecorder(GraphicsContext& context, const Display ItemClientWrapper& client) | |
| 37 : m_displayItemList(context.displayItemList()) | |
| 38 , m_client(client) | |
| 39 { | |
| 40 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
| 41 return; | |
| 42 | |
| 43 ASSERT(m_displayItemList); | |
| 44 m_displayItemList->createAndAppend<BeginSubsequenceDisplayItem>(m_client); | |
| 45 } | |
| 46 | |
| 47 SubsequenceRecorder::~SubsequenceRecorder() | |
| 48 { | |
| 49 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
| 50 return; | |
| 51 | |
| 52 // Don't remove no-op BeginSubsequence/EndSubsequence pairs because we need to | |
| 53 // match them later with CachedSubsequences. | |
| 54 m_displayItemList->createAndAppend<EndSubsequenceDisplayItem>(m_client); | |
| 55 } | |
| 56 | |
| 57 } // namespace blink | |
| OLD | NEW |