Chromium Code Reviews| 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..d5fd6caaa9a53fe10ce806f6325a6158f5a5b489 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::getCustomElement##Name(isolate); \ |
| + DCHECK(!symbol##Name.hasValue(prototype)); \ |
| + { \ |
| + v8::Local<v8::Function> function; \ |
| + if (Maybe.ToLocal(&function)) \ |
|
haraken
2017/03/30 14:04:45
Can we use ToLocalChecked?
peria
2017/04/04 05:48:58
Done.
|
| + symbol##Name.set(prototype, function); \ |
| + } |
| + |
| + CALLBACK_LIST(SET_PRIVATE_PROPERTY) |
| +#undef SET_PRIVATE_PROPERTY |
| return new V8V0CustomElementLifecycleCallbacks( |
| scriptState, prototype, created, attached, detached, attributeChanged); |