Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8IntersectionObserverCallback.cpp

Issue 1449623002: IntersectionObserver: second cut. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Add RuntimeEnabled flags to all idl's, fix test expectations. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 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 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 #include "bindings/core/v8/V8IntersectionObserverCallback.h"
6
7 #include "bindings/core/v8/V8PerformanceObserverCallback.h"
8 6
9 #include "bindings/core/v8/ScriptController.h" 7 #include "bindings/core/v8/ScriptController.h"
10 #include "bindings/core/v8/V8Binding.h" 8 #include "bindings/core/v8/V8Binding.h"
11 #include "bindings/core/v8/V8PerformanceObserver.h" 9 #include "bindings/core/v8/V8IntersectionObserver.h"
12 #include "bindings/core/v8/V8PerformanceObserverEntryList.h"
13 #include "core/dom/ExecutionContext.h" 10 #include "core/dom/ExecutionContext.h"
14 #include "wtf/Assertions.h" 11 #include "wtf/Assertions.h"
15 12
16 namespace blink { 13 namespace blink {
17 14
18 V8PerformanceObserverCallback::V8PerformanceObserverCallback(v8::Local<v8::Funct ion> callback, v8::Local<v8::Object> owner, ScriptState* scriptState) 15 V8IntersectionObserverCallback::V8IntersectionObserverCallback(v8::Local<v8::Fun ction> callback, v8::Local<v8::Object> owner, ScriptState* scriptState)
19 : ActiveDOMCallback(scriptState->executionContext()) 16 : ActiveDOMCallback(scriptState->executionContext())
20 , m_callback(scriptState->isolate(), callback) 17 , m_callback(scriptState->isolate(), callback)
21 , m_scriptState(scriptState) 18 , m_scriptState(scriptState)
22 { 19 {
23 V8HiddenValue::setHiddenValue(scriptState, owner, V8HiddenValue::callback(sc riptState->isolate()), callback); 20 V8HiddenValue::setHiddenValue(scriptState, owner, V8HiddenValue::callback(sc riptState->isolate()), callback);
24 m_callback.setWeak(this, &setWeakCallback); 21 m_callback.setWeak(this, &setWeakCallback);
25 } 22 }
26 23
27 V8PerformanceObserverCallback::~V8PerformanceObserverCallback() 24 V8IntersectionObserverCallback::~V8IntersectionObserverCallback()
28 { 25 {
29 } 26 }
30 27
31 void V8PerformanceObserverCallback::handleEvent(PerformanceObserverEntryList* en tries, PerformanceObserver* observer) 28 void V8IntersectionObserverCallback::handleEvent(const HeapVector<Member<Interse ctionObserverEntry>>& entries, IntersectionObserver& observer)
32 { 29 {
33 if (!canInvokeCallback()) 30 if (!canInvokeCallback())
34 return; 31 return;
35 32
36 if (!m_scriptState->contextIsValid()) 33 if (!m_scriptState->contextIsValid())
37 return; 34 return;
38 ScriptState::Scope scope(m_scriptState.get()); 35 ScriptState::Scope scope(m_scriptState.get());
39 36
40 if (m_callback.isEmpty()) 37 if (m_callback.isEmpty())
41 return; 38 return;
42 v8::Local<v8::Value> observerHandle = toV8(observer, m_scriptState->context( )->Global(), m_scriptState->isolate()); 39 v8::Local<v8::Value> observerHandle = toV8(&observer, m_scriptState->context ()->Global(), m_scriptState->isolate());
43 if (observerHandle.IsEmpty()) { 40 if (observerHandle.IsEmpty()) {
44 if (!isScriptControllerTerminating()) 41 if (!isScriptControllerTerminating())
45 CRASH(); 42 CRASH();
46 return; 43 return;
47 } 44 }
48 45
49 if (!observerHandle->IsObject()) 46 if (!observerHandle->IsObject())
50 return; 47 return;
51 48
52 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(observerHandl e); 49 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(observerHandl e);
53 v8::Local<v8::Value> entriesHandle = toV8(entries, m_scriptState->context()- >Global(), m_scriptState->isolate()); 50 v8::Local<v8::Value> entriesHandle = toV8(entries, m_scriptState->context()- >Global(), m_scriptState->isolate());
54 if (entriesHandle.IsEmpty()) { 51 if (entriesHandle.IsEmpty()) {
55 return; 52 return;
56 } 53 }
57 v8::Local<v8::Value> argv[] = { entriesHandle, observerHandle }; 54 v8::Local<v8::Value> argv[] = { entriesHandle, observerHandle };
58 55
59 v8::TryCatch exceptionCatcher(m_scriptState->isolate()); 56 v8::TryCatch exceptionCatcher(m_scriptState->isolate());
60 exceptionCatcher.SetVerbose(true); 57 exceptionCatcher.SetVerbose(true);
61 ScriptController::callFunction(m_scriptState->executionContext(), m_callback .newLocal(m_scriptState->isolate()), thisObject, 2, argv, m_scriptState->isolate ()); 58 ScriptController::callFunction(m_scriptState->executionContext(), m_callback .newLocal(m_scriptState->isolate()), thisObject, 2, argv, m_scriptState->isolate ());
62 } 59 }
63 60
64 void V8PerformanceObserverCallback::setWeakCallback(const v8::WeakCallbackInfo<V 8PerformanceObserverCallback>& data) 61 void V8IntersectionObserverCallback::setWeakCallback(const v8::WeakCallbackInfo< V8IntersectionObserverCallback>& data)
65 { 62 {
66 data.GetParameter()->m_callback.clear(); 63 data.GetParameter()->m_callback.clear();
67 } 64 }
68 65
69 DEFINE_TRACE(V8PerformanceObserverCallback) 66 DEFINE_TRACE(V8IntersectionObserverCallback)
70 { 67 {
71 PerformanceObserverCallback::trace(visitor); 68 IntersectionObserverCallback::trace(visitor);
72 ActiveDOMCallback::trace(visitor); 69 ActiveDOMCallback::trace(visitor);
73 } 70 }
74 71
75 } // namespace blink 72 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698