OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
| 6 |
| 7 #include "config.h" |
| 8 #include "V8PerformanceObserverCallback.h" |
| 9 |
| 10 #include "bindings/core/v8/ScriptController.h" |
| 11 #include "bindings/core/v8/V8Binding.h" |
| 12 #include "bindings/core/v8/V8PerformanceObserver.h" |
| 13 #include "bindings/core/v8/V8PerformanceObserverEntryList.h" |
| 14 #include "core/dom/ExecutionContext.h" |
| 15 #include "wtf/Assertions.h" |
| 16 #include "wtf/GetPtr.h" |
| 17 #include "wtf/RefPtr.h" |
| 18 |
| 19 namespace blink { |
| 20 |
| 21 V8PerformanceObserverCallback::V8PerformanceObserverCallback(v8::Local<v8::Funct
ion> callback, ScriptState* scriptState) |
| 22 : ActiveDOMCallback(scriptState->executionContext()) |
| 23 , m_scriptState(scriptState) |
| 24 { |
| 25 m_callback.set(scriptState->isolate(), callback); |
| 26 } |
| 27 |
| 28 V8PerformanceObserverCallback::~V8PerformanceObserverCallback() |
| 29 { |
| 30 } |
| 31 |
| 32 DEFINE_TRACE(V8PerformanceObserverCallback) |
| 33 { |
| 34 PerformanceObserverCallback::trace(visitor); |
| 35 ActiveDOMCallback::trace(visitor); |
| 36 } |
| 37 |
| 38 void V8PerformanceObserverCallback::handleEvent(PerformanceObserverEntryList* en
tries, PerformanceObserver* observer) |
| 39 { |
| 40 if (!canInvokeCallback()) |
| 41 return; |
| 42 |
| 43 if (!m_scriptState->contextIsValid()) |
| 44 return; |
| 45 |
| 46 ScriptState::Scope scope(m_scriptState.get()); |
| 47 v8::Local<v8::Value> entriesHandle = toV8(entries, m_scriptState->context()-
>Global(), m_scriptState->isolate()); |
| 48 if (entriesHandle.IsEmpty()) { |
| 49 if (!isScriptControllerTerminating()) |
| 50 CRASH(); |
| 51 return; |
| 52 } |
| 53 v8::Local<v8::Value> observerHandle = toV8(observer, m_scriptState->context(
)->Global(), m_scriptState->isolate()); |
| 54 if (observerHandle.IsEmpty()) { |
| 55 if (!isScriptControllerTerminating()) |
| 56 CRASH(); |
| 57 return; |
| 58 } |
| 59 v8::Local<v8::Value> argv[] = { entriesHandle, observerHandle }; |
| 60 |
| 61 ScriptController::callFunction(m_scriptState->executionContext(), m_callback
.newLocal(m_scriptState->isolate()), m_scriptState->context()->Global(), 2, argv
, m_scriptState->isolate()); |
| 62 } |
| 63 |
| 64 } // namespace blink |
OLD | NEW |