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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 10 matching lines...) Expand all Loading... |
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef V8MutationCallback_h | 26 #ifndef V8MutationCallback_h |
27 #define V8MutationCallback_h | 27 #define V8MutationCallback_h |
28 | 28 |
29 #include "bindings/core/v8/ActiveDOMCallback.h" | 29 #include "bindings/core/v8/ActiveDOMCallback.h" |
30 #include "bindings/core/v8/ScopedPersistent.h" | 30 #include "bindings/core/v8/ScopedPersistent.h" |
31 #include "bindings/core/v8/ScriptState.h" | |
32 #include "core/dom/MutationCallback.h" | 31 #include "core/dom/MutationCallback.h" |
33 #include "wtf/OwnPtr.h" | |
34 #include "wtf/RefPtr.h" | 32 #include "wtf/RefPtr.h" |
35 #include <v8.h> | 33 #include <v8.h> |
36 | 34 |
37 namespace blink { | 35 namespace blink { |
38 | 36 |
39 class ExecutionContext; | 37 class ExecutionContext; |
| 38 class ScriptState; |
40 | 39 |
41 class V8MutationCallback final : public MutationCallback, public ActiveDOMCallba
ck { | 40 class V8MutationCallback final : public MutationCallback, public ActiveDOMCallba
ck { |
42 USING_GARBAGE_COLLECTED_MIXIN(V8MutationCallback); | 41 USING_GARBAGE_COLLECTED_MIXIN(V8MutationCallback); |
43 public: | 42 public: |
44 static V8MutationCallback* create(v8::Local<v8::Function> callback, v8::Loca
l<v8::Object> owner, ScriptState* scriptState) | 43 static V8MutationCallback* create(v8::Local<v8::Function> callback, v8::Loca
l<v8::Object> owner, ScriptState* scriptState) |
45 { | 44 { |
46 return new V8MutationCallback(callback, owner, scriptState); | 45 return new V8MutationCallback(callback, owner, scriptState); |
47 } | 46 } |
48 ~V8MutationCallback() override; | 47 ~V8MutationCallback() override; |
49 | 48 |
50 void call(const HeapVector<Member<MutationRecord>>&, MutationObserver*) over
ride; | 49 void call(const HeapVector<Member<MutationRecord>>&, MutationObserver*) over
ride; |
51 ExecutionContext* getExecutionContext() const override { return ContextLifec
ycleObserver::getExecutionContext(); } | 50 ExecutionContext* getExecutionContext() const override { return ContextLifec
ycleObserver::getExecutionContext(); } |
52 | 51 |
53 DECLARE_VIRTUAL_TRACE(); | 52 DECLARE_VIRTUAL_TRACE(); |
54 | 53 |
55 private: | 54 private: |
56 V8MutationCallback(v8::Local<v8::Function>, v8::Local<v8::Object>, ScriptSta
te*); | 55 V8MutationCallback(v8::Local<v8::Function>, v8::Local<v8::Object>, ScriptSta
te*); |
57 | 56 |
58 static void setWeakCallback(const v8::WeakCallbackInfo<V8MutationCallback>&)
; | |
59 | |
60 ScopedPersistent<v8::Function> m_callback; | 57 ScopedPersistent<v8::Function> m_callback; |
61 RefPtr<ScriptState> m_scriptState; | 58 RefPtr<ScriptState> m_scriptState; |
62 }; | 59 }; |
63 | 60 |
64 } // namespace blink | 61 } // namespace blink |
65 | 62 |
66 #endif // V8MutationCallback_h | 63 #endif // V8MutationCallback_h |
OLD | NEW |