OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | |
6 | |
7 #include "config.h" | 5 #include "config.h" |
8 #include "bindings/core/v8/V8PerformanceObserverCallback.h" | 6 #include "bindings/core/v8/V8IntersectionObserverCallback.h" |
9 | 7 |
10 #include "bindings/core/v8/ScriptController.h" | 8 #include "bindings/core/v8/ScriptController.h" |
11 #include "bindings/core/v8/V8Binding.h" | 9 #include "bindings/core/v8/V8Binding.h" |
12 #include "bindings/core/v8/V8PerformanceObserver.h" | 10 #include "bindings/core/v8/V8IntersectionObserver.h" |
13 #include "bindings/core/v8/V8PerformanceObserverEntryList.h" | |
14 #include "core/dom/ExecutionContext.h" | 11 #include "core/dom/ExecutionContext.h" |
15 #include "wtf/Assertions.h" | 12 #include "wtf/Assertions.h" |
16 | 13 |
17 namespace blink { | 14 namespace blink { |
18 | 15 |
19 V8PerformanceObserverCallback::V8PerformanceObserverCallback(v8::Local<v8::Funct
ion> callback, v8::Local<v8::Object> owner, ScriptState* scriptState) | 16 V8IntersectionObserverCallback::V8IntersectionObserverCallback(v8::Local<v8::Fun
ction> callback, v8::Local<v8::Object> owner, ScriptState* scriptState) |
20 : ActiveDOMCallback(scriptState->executionContext()) | 17 : ActiveDOMCallback(scriptState->executionContext()) |
21 , m_callback(scriptState->isolate(), callback) | 18 , m_callback(scriptState->isolate(), callback) |
22 , m_scriptState(scriptState) | 19 , m_scriptState(scriptState) |
23 { | 20 { |
24 V8HiddenValue::setHiddenValue(scriptState, owner, V8HiddenValue::callback(sc
riptState->isolate()), callback); | 21 V8HiddenValue::setHiddenValue(scriptState, owner, V8HiddenValue::callback(sc
riptState->isolate()), callback); |
25 m_callback.setWeak(this, &setWeakCallback); | 22 m_callback.setWeak(this, &setWeakCallback); |
26 } | 23 } |
27 | 24 |
28 V8PerformanceObserverCallback::~V8PerformanceObserverCallback() | 25 V8IntersectionObserverCallback::~V8IntersectionObserverCallback() |
29 { | 26 { |
30 } | 27 } |
31 | 28 |
32 void V8PerformanceObserverCallback::handleEvent(PerformanceObserverEntryList* en
tries, PerformanceObserver* observer) | 29 void V8IntersectionObserverCallback::handleEvent(HeapVector<Member<IntersectionO
bserverEntry>>& entries, IntersectionObserver& observer) |
33 { | 30 { |
34 if (!canInvokeCallback()) | 31 if (!canInvokeCallback()) |
35 return; | 32 return; |
36 | 33 |
37 if (!m_scriptState->contextIsValid()) | 34 if (!m_scriptState->contextIsValid()) |
38 return; | 35 return; |
39 ScriptState::Scope scope(m_scriptState.get()); | 36 ScriptState::Scope scope(m_scriptState.get()); |
40 | 37 |
41 if (m_callback.isEmpty()) | 38 if (m_callback.isEmpty()) |
42 return; | 39 return; |
43 v8::Local<v8::Value> observerHandle = toV8(observer, m_scriptState->context(
)->Global(), m_scriptState->isolate()); | 40 v8::Local<v8::Value> observerHandle = toV8(&observer, m_scriptState->context
()->Global(), m_scriptState->isolate()); |
44 if (observerHandle.IsEmpty()) { | 41 if (observerHandle.IsEmpty()) { |
45 if (!isScriptControllerTerminating()) | 42 if (!isScriptControllerTerminating()) |
46 CRASH(); | 43 CRASH(); |
47 return; | 44 return; |
48 } | 45 } |
49 | 46 |
50 if (!observerHandle->IsObject()) | 47 if (!observerHandle->IsObject()) |
51 return; | 48 return; |
52 | 49 |
53 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(observerHandl
e); | 50 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(observerHandl
e); |
54 v8::Local<v8::Value> entriesHandle = toV8(entries, m_scriptState->context()-
>Global(), m_scriptState->isolate()); | 51 v8::Local<v8::Value> entriesHandle = toV8(entries, m_scriptState->context()-
>Global(), m_scriptState->isolate()); |
55 if (entriesHandle.IsEmpty()) { | 52 if (entriesHandle.IsEmpty()) { |
56 return; | 53 return; |
57 } | 54 } |
58 v8::Local<v8::Value> argv[] = { entriesHandle, observerHandle }; | 55 v8::Local<v8::Value> argv[] = { entriesHandle, observerHandle }; |
59 | 56 |
60 v8::TryCatch exceptionCatcher(m_scriptState->isolate()); | 57 v8::TryCatch exceptionCatcher(m_scriptState->isolate()); |
61 exceptionCatcher.SetVerbose(true); | 58 exceptionCatcher.SetVerbose(true); |
62 ScriptController::callFunction(m_scriptState->executionContext(), m_callback
.newLocal(m_scriptState->isolate()), thisObject, 2, argv, m_scriptState->isolate
()); | 59 ScriptController::callFunction(m_scriptState->executionContext(), m_callback
.newLocal(m_scriptState->isolate()), thisObject, 2, argv, m_scriptState->isolate
()); |
63 } | 60 } |
64 | 61 |
65 void V8PerformanceObserverCallback::setWeakCallback(const v8::WeakCallbackInfo<V
8PerformanceObserverCallback>& data) | 62 void V8IntersectionObserverCallback::setWeakCallback(const v8::WeakCallbackInfo<
V8IntersectionObserverCallback>& data) |
66 { | 63 { |
67 data.GetParameter()->m_callback.clear(); | 64 data.GetParameter()->m_callback.clear(); |
68 } | 65 } |
69 | 66 |
70 DEFINE_TRACE(V8PerformanceObserverCallback) | 67 DEFINE_TRACE(V8IntersectionObserverCallback) |
71 { | 68 { |
72 PerformanceObserverCallback::trace(visitor); | 69 IntersectionObserverCallback::trace(visitor); |
73 ActiveDOMCallback::trace(visitor); | 70 ActiveDOMCallback::trace(visitor); |
74 } | 71 } |
75 | 72 |
76 } // namespace blink | 73 } // namespace blink |
OLD | NEW |