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(); | |
chrishtr
2015/09/08 22:48:00
You only need access to the size, not the whole ve
Xianzhu
2015/09/09 16:50:33
It's also needed to set uncacheable flag or a prev
| |
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 m_displayItemList->removeLastDisplayItem(); |
51 m_displayItemList->createAndAppend<EndSubsequenceDisplayItem>(m_client); | 53 else |
54 m_displayItemList->createAndAppend<EndSubsequenceDisplayItem>(m_client); | |
55 } | |
56 | |
57 void SubsequenceRecorder::setUncacheable() | |
58 { | |
59 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | |
60 return; | |
61 | |
62 ASSERT(m_displayItemList->newDisplayItems()[m_beginSubsequenceIndex].type() == DisplayItem::BeginSubsequence); | |
63 m_displayItemList->newDisplayItems()[m_beginSubsequenceIndex].setUncacheable (); | |
52 } | 64 } |
53 | 65 |
54 } // namespace blink | 66 } // namespace blink |
OLD | NEW |