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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/ObjectPaintProperties.cpp
diff --git a/third_party/WebKit/Source/core/paint/ObjectPaintProperties.cpp b/third_party/WebKit/Source/core/paint/ObjectPaintProperties.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..901a38315e5838fe02720d8f84bb9882e08fdae3
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/ObjectPaintProperties.cpp
@@ -0,0 +1,57 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/paint/ObjectPaintProperties.h"
+
+#include "platform/RuntimeEnabledFeatures.h"
+
+namespace blink {
+
+ObjectPaintProperties::Owner::NodeMapping* ObjectPaintProperties::Owner::s_nodeMapping = nullptr;
+
+ObjectPaintProperties::Owner::~Owner()
+{
+ if (!s_nodeMapping)
+ return;
+ ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+
+ clearObjectPaintProperties();
+}
+
+ObjectPaintProperties* ObjectPaintProperties::Owner::objectPaintProperties() const
+{
+ ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+
+ if (!s_nodeMapping)
+ return nullptr;
+
+ return s_nodeMapping->get(this);
+}
+
+ObjectPaintProperties& ObjectPaintProperties::Owner::ensureObjectPaintProperties()
+{
+ ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+
+ if (ObjectPaintProperties* properties = objectPaintProperties())
+ return *properties;
+
+ if (!s_nodeMapping)
+ s_nodeMapping = new NodeMapping;
+
+ ObjectPaintProperties* newProperties = new ObjectPaintProperties;
+ s_nodeMapping->set(this, adoptPtr(newProperties));
+ return *newProperties;
+}
+
+void ObjectPaintProperties::Owner::clearObjectPaintProperties()
+{
+ ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+
+ if (!s_nodeMapping)
+ return;
+ s_nodeMapping->remove(this);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698