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

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 missing break, rebaseline, no config.h Created 4 years, 12 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 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! 5 #include "bindings/core/v8/V8IntersectionObserverCallback.h"
6
7 #include "config.h"
8 #include "bindings/core/v8/V8PerformanceObserverCallback.h"
9 6
10 #include "bindings/core/v8/ScriptController.h" 7 #include "bindings/core/v8/ScriptController.h"
11 #include "bindings/core/v8/V8Binding.h" 8 #include "bindings/core/v8/V8Binding.h"
12 #include "bindings/core/v8/V8PerformanceObserver.h" 9 #include "bindings/core/v8/V8IntersectionObserver.h"
13 #include "bindings/core/v8/V8PerformanceObserverEntryList.h"
14 #include "core/dom/ExecutionContext.h" 10 #include "core/dom/ExecutionContext.h"
15 #include "wtf/Assertions.h" 11 #include "wtf/Assertions.h"
16 12
17 namespace blink { 13 namespace blink {
18 14
19 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)
20 : ActiveDOMCallback(scriptState->executionContext()) 16 : ActiveDOMCallback(scriptState->executionContext())
21 , m_callback(scriptState->isolate(), callback) 17 , m_callback(scriptState->isolate(), callback)
22 , m_scriptState(scriptState) 18 , m_scriptState(scriptState)
23 { 19 {
24 V8HiddenValue::setHiddenValue(scriptState, owner, V8HiddenValue::callback(sc riptState->isolate()), callback); 20 V8HiddenValue::setHiddenValue(scriptState, owner, V8HiddenValue::callback(sc riptState->isolate()), callback);
25 m_callback.setWeak(this, &setWeakCallback); 21 m_callback.setWeak(this, &setWeakCallback);
26 } 22 }
27 23
28 V8PerformanceObserverCallback::~V8PerformanceObserverCallback() 24 V8IntersectionObserverCallback::~V8IntersectionObserverCallback()
29 { 25 {
30 } 26 }
31 27
32 void V8PerformanceObserverCallback::handleEvent(PerformanceObserverEntryList* en tries, PerformanceObserver* observer) 28 void V8IntersectionObserverCallback::handleEvent(HeapVector<Member<IntersectionO bserverEntry>>& entries, IntersectionObserver& observer)
33 { 29 {
34 if (!canInvokeCallback()) 30 if (!canInvokeCallback())
35 return; 31 return;
36 32
37 if (!m_scriptState->contextIsValid()) 33 if (!m_scriptState->contextIsValid())
38 return; 34 return;
39 ScriptState::Scope scope(m_scriptState.get()); 35 ScriptState::Scope scope(m_scriptState.get());
40 36
41 if (m_callback.isEmpty()) 37 if (m_callback.isEmpty())
42 return; 38 return;
43 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());
44 if (observerHandle.IsEmpty()) { 40 if (observerHandle.IsEmpty()) {
45 if (!isScriptControllerTerminating()) 41 if (!isScriptControllerTerminating())
46 CRASH(); 42 CRASH();
47 return; 43 return;
48 } 44 }
49 45
50 if (!observerHandle->IsObject()) 46 if (!observerHandle->IsObject())
51 return; 47 return;
52 48
53 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);
54 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());
55 if (entriesHandle.IsEmpty()) { 51 if (entriesHandle.IsEmpty()) {
56 return; 52 return;
57 } 53 }
58 v8::Local<v8::Value> argv[] = { entriesHandle, observerHandle }; 54 v8::Local<v8::Value> argv[] = { entriesHandle, observerHandle };
59 55
60 v8::TryCatch exceptionCatcher(m_scriptState->isolate()); 56 v8::TryCatch exceptionCatcher(m_scriptState->isolate());
61 exceptionCatcher.SetVerbose(true); 57 exceptionCatcher.SetVerbose(true);
62 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 ());
63 } 59 }
64 60
65 void V8PerformanceObserverCallback::setWeakCallback(const v8::WeakCallbackInfo<V 8PerformanceObserverCallback>& data) 61 void V8IntersectionObserverCallback::setWeakCallback(const v8::WeakCallbackInfo< V8IntersectionObserverCallback>& data)
66 { 62 {
67 data.GetParameter()->m_callback.clear(); 63 data.GetParameter()->m_callback.clear();
68 } 64 }
69 65
70 DEFINE_TRACE(V8PerformanceObserverCallback) 66 DEFINE_TRACE(V8IntersectionObserverCallback)
71 { 67 {
72 PerformanceObserverCallback::trace(visitor); 68 IntersectionObserverCallback::trace(visitor);
73 ActiveDOMCallback::trace(visitor); 69 ActiveDOMCallback::trace(visitor);
74 } 70 }
75 71
76 } // namespace blink 72 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698