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

Side by Side Diff: Source/core/paint/ScopeRecorder.cpp

Issue 1144203004: Allow certain SP recorder classes to defer their "begin" operation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/ScopeRecorder.h ('k') | Source/core/paint/ScrollRecorder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "core/paint/ScopeRecorder.h" 6 #include "core/paint/ScopeRecorder.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 12
13 namespace blink { 13 namespace blink {
14 14
15 ScopeRecorder::ScopeRecorder(GraphicsContext& context, const LayoutObject& objec t) 15 ScopeRecorder::ScopeRecorder(GraphicsContext& context, const LayoutObject& objec t, ShouldBegin shouldBegin)
16 : m_displayItemList(context.displayItemList()) 16 : m_displayItemList(context.displayItemList())
17 , m_object(object) 17 , m_object(object)
18 , m_engaged(false)
18 { 19 {
20 if (shouldBegin == BeginOnConstruction)
21 begin();
22 }
23
24 ScopeRecorder::~ScopeRecorder()
25 {
26 if (!m_engaged)
27 return;
28 if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
29 return;
30
31 m_displayItemList->endScope(m_object.displayItemClient());
32 }
33
34 void ScopeRecorder::begin()
35 {
36 ASSERT(!m_engaged);
37 m_engaged = true;
38
19 if (!RuntimeEnabledFeatures::slimmingPaintEnabled()) 39 if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
20 return; 40 return;
21 41
22 ASSERT(m_displayItemList); 42 ASSERT(m_displayItemList);
23 m_displayItemList->beginScope(m_object.displayItemClient()); 43 m_displayItemList->beginScope(m_object.displayItemClient());
24 } 44 }
25 45
26 ScopeRecorder::~ScopeRecorder()
27 {
28 if (!RuntimeEnabledFeatures::slimmingPaintEnabled())
29 return;
30
31 m_displayItemList->endScope(m_object.displayItemClient());
32 }
33
34 } // namespace blink 46 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/ScopeRecorder.h ('k') | Source/core/paint/ScrollRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698