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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.cpp

Issue 2777943005: [Bindings] Move and remove some private symbols from V8HiddenValue (Closed)
Patch Set: Fix test failures Created 3 years, 8 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/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.cpp b/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.cpp
index 261f30fbd15655ee7fd4c2b86bb2aeba1d68d0a8..0e87c5939b5a3a735cea5058a37ce4d4ea2067d7 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8V0CustomElementLifecycleCallbacks.cpp
@@ -30,15 +30,15 @@
#include "bindings/core/v8/V8V0CustomElementLifecycleCallbacks.h"
+#include <memory>
#include "bindings/core/v8/DOMDataStore.h"
#include "bindings/core/v8/ScriptController.h"
#include "bindings/core/v8/V0CustomElementBinding.h"
#include "bindings/core/v8/V8Binding.h"
#include "bindings/core/v8/V8Element.h"
-#include "bindings/core/v8/V8HiddenValue.h"
#include "bindings/core/v8/V8PerContextData.h"
+#include "bindings/core/v8/V8PrivateProperty.h"
#include "core/dom/ExecutionContext.h"
-#include <memory>
namespace blink {
@@ -57,20 +57,21 @@ V8V0CustomElementLifecycleCallbacks::create(
v8::MaybeLocal<v8::Function> detached,
v8::MaybeLocal<v8::Function> attributeChanged) {
v8::Isolate* isolate = scriptState->isolate();
+
// A given object can only be used as a Custom Element prototype
// once; see customElementIsInterfacePrototypeObject
-#define SET_HIDDEN_VALUE(Value, Name) \
- ASSERT( \
- V8HiddenValue::getHiddenValue( \
- scriptState, prototype, V8HiddenValue::customElement##Name(isolate)) \
- .IsEmpty()); \
- if (!Value.IsEmpty()) \
- V8HiddenValue::setHiddenValue(scriptState, prototype, \
- V8HiddenValue::customElement##Name(isolate), \
- Value.ToLocalChecked());
-
- CALLBACK_LIST(SET_HIDDEN_VALUE)
-#undef SET_HIDDEN_VALUE
+#define SET_PRIVATE_PROPERTY(Maybe, Name) \
+ V8PrivateProperty::Symbol symbol##Name = \
+ V8PrivateProperty::getCustomElementLifecycle##Name(isolate); \
+ DCHECK(!symbol##Name.hasValue(prototype)); \
+ { \
+ v8::Local<v8::Function> function; \
+ if (Maybe.ToLocal(&function)) \
+ symbol##Name.set(prototype, function); \
+ }
+
+ CALLBACK_LIST(SET_PRIVATE_PROPERTY)
+#undef SET_PRIVATE_PROPERTY
return new V8V0CustomElementLifecycleCallbacks(
scriptState, prototype, created, attached, detached, attributeChanged);

Powered by Google App Engine
This is Rietveld 408576698