Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/SubsequenceRecorder.cpp

Issue 1379883003: Create PaintChunk and begin writing code to build paint chunks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "platform/graphics/paint/DisplayItemList.h" 11 #include "platform/graphics/paint/DisplayItemList.h"
12 #include "platform/graphics/paint/SubsequenceDisplayItem.h" 12 #include "platform/graphics/paint/SubsequenceDisplayItem.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 bool SubsequenceRecorder::useCachedSubsequenceIfPossible(GraphicsContext& contex t, const DisplayItemClientWrapper& client) 16 bool SubsequenceRecorder::useCachedSubsequenceIfPossible(GraphicsContext& contex t, const DisplayItemClientWrapper& client)
17 { 17 {
18 if (!RuntimeEnabledFeatures::slimmingPaintSubsequenceCachingEnabled()) 18 if (!RuntimeEnabledFeatures::slimmingPaintSubsequenceCachingEnabled())
19 return false; 19 return false;
20 20
21 ASSERT(context.displayItemList()); 21 ASSERT(context.displayItemList());
22 22
23 // TODO(jbroman): When SPv2 paint property code can handle it, don't skip
pdr. 2015/10/01 00:32:48 I think we should hold off on turning off subseque
jbroman 2015/10/01 18:04:20 Done.
24 // subsequence recording.
25 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
26 return false;
27
23 if (context.displayItemList()->displayItemConstructionIsDisabled()) 28 if (context.displayItemList()->displayItemConstructionIsDisabled())
24 return false; 29 return false;
25 30
26 if (!context.displayItemList()->clientCacheIsValid(client.displayItemClient( ))) 31 if (!context.displayItemList()->clientCacheIsValid(client.displayItemClient( )))
27 return false; 32 return false;
28 33
29 context.displayItemList()->createAndAppend<CachedDisplayItem>(client, Displa yItem::CachedSubsequence); 34 context.displayItemList()->createAndAppend<CachedDisplayItem>(client, Displa yItem::CachedSubsequence);
30 35
31 #if ENABLE(ASSERT) 36 #if ENABLE(ASSERT)
32 // When under-invalidation checking is enabled, we output CachedSubsequence display item 37 // When under-invalidation checking is enabled, we output CachedSubsequence display item
33 // followed by forced painting of the subsequence. 38 // followed by forced painting of the subsequence.
34 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled()) 39 if (RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabled())
35 return false; 40 return false;
36 #endif 41 #endif
37 42
38 return true; 43 return true;
39 } 44 }
40 45
41 SubsequenceRecorder::SubsequenceRecorder(GraphicsContext& context, const Display ItemClientWrapper& client) 46 SubsequenceRecorder::SubsequenceRecorder(GraphicsContext& context, const Display ItemClientWrapper& client)
42 : m_displayItemList(context.displayItemList()) 47 : m_displayItemList(context.displayItemList())
43 , m_client(client) 48 , m_client(client)
44 , m_beginSubsequenceIndex(0) 49 , m_beginSubsequenceIndex(0)
45 { 50 {
46 if (!RuntimeEnabledFeatures::slimmingPaintSubsequenceCachingEnabled()) 51 if (!RuntimeEnabledFeatures::slimmingPaintSubsequenceCachingEnabled())
47 return; 52 return;
48 53
54 // TODO(jbroman): When SPv2 paint property code can handle it, don't skip
55 // subsequence recording.
56 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
57 return;
58
49 ASSERT(m_displayItemList); 59 ASSERT(m_displayItemList);
50 if (m_displayItemList->displayItemConstructionIsDisabled()) 60 if (m_displayItemList->displayItemConstructionIsDisabled())
51 return; 61 return;
52 62
53 m_beginSubsequenceIndex = m_displayItemList->newDisplayItems().size(); 63 m_beginSubsequenceIndex = m_displayItemList->newDisplayItems().size();
54 m_displayItemList->createAndAppend<BeginSubsequenceDisplayItem>(m_client); 64 m_displayItemList->createAndAppend<BeginSubsequenceDisplayItem>(m_client);
55 } 65 }
56 66
57 SubsequenceRecorder::~SubsequenceRecorder() 67 SubsequenceRecorder::~SubsequenceRecorder()
58 { 68 {
(...skipping 22 matching lines...) Expand all
81 return; 91 return;
82 92
83 if (m_displayItemList->displayItemConstructionIsDisabled()) 93 if (m_displayItemList->displayItemConstructionIsDisabled())
84 return; 94 return;
85 95
86 ASSERT(m_displayItemList->newDisplayItems()[m_beginSubsequenceIndex].type() == DisplayItem::BeginSubsequence); 96 ASSERT(m_displayItemList->newDisplayItems()[m_beginSubsequenceIndex].type() == DisplayItem::BeginSubsequence);
87 m_displayItemList->newDisplayItems()[m_beginSubsequenceIndex].setSkippedCach e(); 97 m_displayItemList->newDisplayItems()[m_beginSubsequenceIndex].setSkippedCach e();
88 } 98 }
89 99
90 } // namespace blink 100 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698