| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright (C) 2013 Google Inc. All rights reserved. |    2  * Copyright (C) 2013 Google Inc. All rights reserved. | 
|    3  * |    3  * | 
|    4  * Redistribution and use in source and binary forms, with or without |    4  * Redistribution and use in source and binary forms, with or without | 
|    5  * modification, are permitted provided that the following conditions are |    5  * modification, are permitted provided that the following conditions are | 
|    6  * met: |    6  * met: | 
|    7  * |    7  * | 
|    8  *     * Redistributions of source code must retain the above copyright |    8  *     * Redistributions of source code must retain the above copyright | 
|    9  * notice, this list of conditions and the following disclaimer. |    9  * notice, this list of conditions and the following disclaimer. | 
|   10  *     * Redistributions in binary form must reproduce the above |   10  *     * Redistributions in binary form must reproduce the above | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
|   41 #include "wtf/PassOwnPtr.h" |   41 #include "wtf/PassOwnPtr.h" | 
|   42  |   42  | 
|   43 namespace blink { |   43 namespace blink { | 
|   44  |   44  | 
|   45 #define CALLBACK_LIST(V)                    \ |   45 #define CALLBACK_LIST(V)                    \ | 
|   46     V(created, CreatedCallback)             \ |   46     V(created, CreatedCallback)             \ | 
|   47     V(attached, AttachedCallback)           \ |   47     V(attached, AttachedCallback)           \ | 
|   48     V(detached, DetachedCallback)           \ |   48     V(detached, DetachedCallback)           \ | 
|   49     V(attributeChanged, AttributeChangedCallback) |   49     V(attributeChanged, AttributeChangedCallback) | 
|   50  |   50  | 
|   51 PassRefPtrWillBeRawPtr<V8CustomElementLifecycleCallbacks> V8CustomElementLifecyc
     leCallbacks::create(ScriptState* scriptState, v8::Local<v8::Object> prototype, v
     8::MaybeLocal<v8::Function> created, v8::MaybeLocal<v8::Function> attached, v8::
     MaybeLocal<v8::Function> detached, v8::MaybeLocal<v8::Function> attributeChanged
     ) |   51 RawPtr<V8CustomElementLifecycleCallbacks> V8CustomElementLifecycleCallbacks::cre
     ate(ScriptState* scriptState, v8::Local<v8::Object> prototype, v8::MaybeLocal<v8
     ::Function> created, v8::MaybeLocal<v8::Function> attached, v8::MaybeLocal<v8::F
     unction> detached, v8::MaybeLocal<v8::Function> attributeChanged) | 
|   52 { |   52 { | 
|   53     v8::Isolate* isolate = scriptState->isolate(); |   53     v8::Isolate* isolate = scriptState->isolate(); | 
|   54     // A given object can only be used as a Custom Element prototype |   54     // A given object can only be used as a Custom Element prototype | 
|   55     // once; see customElementIsInterfacePrototypeObject |   55     // once; see customElementIsInterfacePrototypeObject | 
|   56 #define SET_HIDDEN_VALUE(Value, Name) \ |   56 #define SET_HIDDEN_VALUE(Value, Name) \ | 
|   57     ASSERT(V8HiddenValue::getHiddenValue(scriptState, prototype, V8HiddenValue::
     customElement##Name(isolate)).IsEmpty()); \ |   57     ASSERT(V8HiddenValue::getHiddenValue(scriptState, prototype, V8HiddenValue::
     customElement##Name(isolate)).IsEmpty()); \ | 
|   58     if (!Value.IsEmpty()) \ |   58     if (!Value.IsEmpty()) \ | 
|   59         V8HiddenValue::setHiddenValue(scriptState, prototype, V8HiddenValue::cus
     tomElement##Name(isolate), Value.ToLocalChecked()); |   59         V8HiddenValue::setHiddenValue(scriptState, prototype, V8HiddenValue::cus
     tomElement##Name(isolate), Value.ToLocalChecked()); | 
|   60  |   60  | 
|   61     CALLBACK_LIST(SET_HIDDEN_VALUE) |   61     CALLBACK_LIST(SET_HIDDEN_VALUE) | 
|   62 #undef SET_HIDDEN_VALUE |   62 #undef SET_HIDDEN_VALUE | 
|   63  |   63  | 
|   64     return adoptRefWillBeNoop(new V8CustomElementLifecycleCallbacks(scriptState,
      prototype, created, attached, detached, attributeChanged)); |   64     return (new V8CustomElementLifecycleCallbacks(scriptState, prototype, create
     d, attached, detached, attributeChanged)); | 
|   65 } |   65 } | 
|   66  |   66  | 
|   67 static CustomElementLifecycleCallbacks::CallbackType flagSet(v8::MaybeLocal<v8::
     Function> attached, v8::MaybeLocal<v8::Function> detached, v8::MaybeLocal<v8::Fu
     nction> attributeChanged) |   67 static CustomElementLifecycleCallbacks::CallbackType flagSet(v8::MaybeLocal<v8::
     Function> attached, v8::MaybeLocal<v8::Function> detached, v8::MaybeLocal<v8::Fu
     nction> attributeChanged) | 
|   68 { |   68 { | 
|   69     // V8 Custom Elements always run created to swizzle prototypes. |   69     // V8 Custom Elements always run created to swizzle prototypes. | 
|   70     int flags = CustomElementLifecycleCallbacks::CreatedCallback; |   70     int flags = CustomElementLifecycleCallbacks::CreatedCallback; | 
|   71  |   71  | 
|   72     if (!attached.IsEmpty()) |   72     if (!attached.IsEmpty()) | 
|   73         flags |= CustomElementLifecycleCallbacks::AttachedCallback; |   73         flags |= CustomElementLifecycleCallbacks::AttachedCallback; | 
|   74  |   74  | 
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  241     ScriptController::callFunction(executionContext(), callback, receiver, 0, 0,
      isolate); |  241     ScriptController::callFunction(executionContext(), callback, receiver, 0, 0,
      isolate); | 
|  242 } |  242 } | 
|  243  |  243  | 
|  244 DEFINE_TRACE(V8CustomElementLifecycleCallbacks) |  244 DEFINE_TRACE(V8CustomElementLifecycleCallbacks) | 
|  245 { |  245 { | 
|  246     CustomElementLifecycleCallbacks::trace(visitor); |  246     CustomElementLifecycleCallbacks::trace(visitor); | 
|  247     ContextLifecycleObserver::trace(visitor); |  247     ContextLifecycleObserver::trace(visitor); | 
|  248 } |  248 } | 
|  249  |  249  | 
|  250 } // namespace blink |  250 } // namespace blink | 
| OLD | NEW |