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

Side by Side Diff: third_party/WebKit/Source/core/paint/ObjectPaintProperties.cpp

Issue 1407543003: Preliminary paint property walk implementation for SPv2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address some of the comments. 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
(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 "core/paint/ObjectPaintProperties.h"
7
8 #include "platform/RuntimeEnabledFeatures.h"
9
10 namespace blink {
11
12 ObjectPaintProperties::Owner::NodeMapping* ObjectPaintProperties::Owner::s_nodeM apping = nullptr;
13
14 ObjectPaintProperties::Owner::~Owner()
15 {
16 if (!s_nodeMapping)
17 return;
18 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
19
20 clearObjectPaintProperties();
21 }
22
23 ObjectPaintProperties* ObjectPaintProperties::Owner::objectPaintProperties() con st
24 {
25 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
26
27 if (!s_nodeMapping)
28 return nullptr;
29
30 return s_nodeMapping->get(this);
31 }
32
33 ObjectPaintProperties& ObjectPaintProperties::Owner::ensureObjectPaintProperties ()
34 {
35 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
36
37 if (ObjectPaintProperties* properties = objectPaintProperties())
38 return *properties;
39
40 if (!s_nodeMapping)
41 s_nodeMapping = new NodeMapping;
42
43 ObjectPaintProperties* newProperties = new ObjectPaintProperties;
44 s_nodeMapping->set(this, adoptPtr(newProperties));
45 return *newProperties;
46 }
47
48 void ObjectPaintProperties::Owner::clearObjectPaintProperties()
49 {
50 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
51
52 if (!s_nodeMapping)
53 return;
54 s_nodeMapping->remove(this);
55 }
56
57 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698