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 "platform/graphics/paint/SubsequenceRecorder.h" | 6 #include "platform/graphics/paint/SubsequenceRecorder.h" |
7 | 7 |
8 #include "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
10 #include "platform/graphics/paint/CachedDisplayItem.h" | 10 #include "platform/graphics/paint/CachedDisplayItem.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 if (!context.displayItemList()->clientCacheIsValid(client.displayItemClient(
))) | 26 if (!context.displayItemList()->clientCacheIsValid(client.displayItemClient(
))) |
27 return false; | 27 return false; |
28 | 28 |
29 context.displayItemList()->createAndAppend<CachedDisplayItem>(client, Displa
yItem::CachedSubsequence); | 29 context.displayItemList()->createAndAppend<CachedDisplayItem>(client, Displa
yItem::CachedSubsequence); |
30 return true; | 30 return true; |
31 } | 31 } |
32 | 32 |
33 SubsequenceRecorder::SubsequenceRecorder(GraphicsContext& context, const Display
ItemClientWrapper& client) | 33 SubsequenceRecorder::SubsequenceRecorder(GraphicsContext& context, const Display
ItemClientWrapper& client) |
34 : m_displayItemList(context.displayItemList()) | 34 : m_displayItemList(context.displayItemList()) |
35 , m_client(client) | 35 , m_client(client) |
| 36 , m_beginSubsequenceIndex(0) |
36 { | 37 { |
37 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 38 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
38 return; | 39 return; |
39 | 40 |
40 ASSERT(m_displayItemList); | 41 ASSERT(m_displayItemList); |
| 42 m_beginSubsequenceIndex = m_displayItemList->newDisplayItems().size(); |
41 m_displayItemList->createAndAppend<BeginSubsequenceDisplayItem>(m_client); | 43 m_displayItemList->createAndAppend<BeginSubsequenceDisplayItem>(m_client); |
42 } | 44 } |
43 | 45 |
44 SubsequenceRecorder::~SubsequenceRecorder() | 46 SubsequenceRecorder::~SubsequenceRecorder() |
45 { | 47 { |
46 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 48 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
47 return; | 49 return; |
48 | 50 |
49 // Don't remove no-op BeginSubsequence/EndSubsequence pairs because we need
to | 51 if (m_displayItemList->lastDisplayItemIsNoopBegin()) { |
50 // match them later with CachedSubsequences. | 52 ASSERT(m_beginSubsequenceIndex == m_displayItemList->newDisplayItems().s
ize() - 1); |
| 53 // Remove uncacheable no-op BeginSubsequence/EndSubsequence pairs. |
| 54 // Don't remove cacheable no-op pairs because we need to match them late
r with CachedSubsequences. |
| 55 if (m_displayItemList->newDisplayItems().last().skippedCache()) { |
| 56 m_displayItemList->removeLastDisplayItem(); |
| 57 return; |
| 58 } |
| 59 } |
| 60 |
51 m_displayItemList->createAndAppend<EndSubsequenceDisplayItem>(m_client); | 61 m_displayItemList->createAndAppend<EndSubsequenceDisplayItem>(m_client); |
52 } | 62 } |
53 | 63 |
| 64 void SubsequenceRecorder::setUncacheable() |
| 65 { |
| 66 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 67 return; |
| 68 |
| 69 ASSERT(m_displayItemList->newDisplayItems()[m_beginSubsequenceIndex].type()
== DisplayItem::BeginSubsequence); |
| 70 m_displayItemList->newDisplayItems()[m_beginSubsequenceIndex].setSkippedCach
e(); |
| 71 } |
| 72 |
54 } // namespace blink | 73 } // namespace blink |
OLD | NEW |