OLD | NEW |
(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 |
OLD | NEW |