| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8IntersectionObserverCallback_h | 5 #ifndef V8IntersectionObserverCallback_h |
| 6 #define V8IntersectionObserverCallback_h | 6 #define V8IntersectionObserverCallback_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/DOMWrapperWorld.h" | 8 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 9 #include "bindings/core/v8/ScopedPersistent.h" | 9 #include "bindings/core/v8/ScopedPersistent.h" |
| 10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
| 11 #include "core/dom/ExecutionContext.h" |
| 11 #include "core/dom/IntersectionObserverCallback.h" | 12 #include "core/dom/IntersectionObserverCallback.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 class V8IntersectionObserverCallback final | 16 class V8IntersectionObserverCallback final |
| 16 : public IntersectionObserverCallback { | 17 : public IntersectionObserverCallback { |
| 17 public: | 18 public: |
| 18 CORE_EXPORT V8IntersectionObserverCallback(v8::Local<v8::Function>, | 19 CORE_EXPORT V8IntersectionObserverCallback(v8::Local<v8::Function>, |
| 19 v8::Local<v8::Object>, | 20 v8::Local<v8::Object>, |
| 20 ScriptState*); | 21 ScriptState*); |
| 21 ~V8IntersectionObserverCallback() override; | 22 ~V8IntersectionObserverCallback() override; |
| 22 | 23 |
| 23 DECLARE_VIRTUAL_TRACE(); | 24 DECLARE_VIRTUAL_TRACE(); |
| 24 | 25 |
| 25 void HandleEvent(const HeapVector<Member<IntersectionObserverEntry>>&, | 26 void HandleEvent(const HeapVector<Member<IntersectionObserverEntry>>&, |
| 26 IntersectionObserver&) override; | 27 IntersectionObserver&) override; |
| 27 | 28 |
| 28 ExecutionContext* GetExecutionContext() const override { | 29 ExecutionContext* GetExecutionContext() const override { |
| 29 return script_state_->GetExecutionContext(); | 30 return ExecutionContext::From(script_state_.Get()); |
| 30 } | 31 } |
| 31 | 32 |
| 32 private: | 33 private: |
| 33 ScopedPersistent<v8::Function> callback_; | 34 ScopedPersistent<v8::Function> callback_; |
| 34 RefPtr<ScriptState> script_state_; | 35 RefPtr<ScriptState> script_state_; |
| 35 }; | 36 }; |
| 36 | 37 |
| 37 } // namespace blink | 38 } // namespace blink |
| 38 #endif // V8IntersectionObserverCallback_h | 39 #endif // V8IntersectionObserverCallback_h |
| OLD | NEW |