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

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: Rebase Created 3 years, 9 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..99d23162876aa70d3daad1619df6970d1ac46200 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,19 @@ V8V0CustomElementLifecycleCallbacks::create(
v8::MaybeLocal<v8::Function> detached,
v8::MaybeLocal<v8::Function> attributeChanged) {
v8::Isolate* isolate = scriptState->isolate();
+ v8::Local<v8::Context> context = isolate->GetCurrentContext();
+
// 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(Value, Name) \
+ V8PrivateProperty::Symbol symbol##Name = \
+ V8PrivateProperty::getCustomElement##Name(isolate); \
+ DCHECK(symbol##Name.hasValue(context, prototype)); \
Yuki 2017/03/29 12:36:05 DCHECK(!hasValue);
peria 2017/03/30 09:30:16 Done.
+ if (!Value.IsEmpty()) \
+ symbol##Name.set(context, prototype, Value.ToLocalChecked());
Yuki 2017/03/29 12:36:05 This pattern looks a bit strange. Should be: v
peria 2017/03/30 09:30:16 Done.
+
+ 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