Chromium Code Reviews| Index: Source/bindings/core/v8/V8PerformanceObserverCallback.cpp |
| diff --git a/Source/bindings/core/v8/V8PerformanceObserverCallback.cpp b/Source/bindings/core/v8/V8PerformanceObserverCallback.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6456ab880d7fe0dee5279cda133e8e02e2c95777 |
| --- /dev/null |
| +++ b/Source/bindings/core/v8/V8PerformanceObserverCallback.cpp |
| @@ -0,0 +1,64 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
| + |
| +#include "config.h" |
| +#include "V8PerformanceObserverCallback.h" |
| + |
| +#include "bindings/core/v8/ScriptController.h" |
| +#include "bindings/core/v8/V8Binding.h" |
| +#include "bindings/core/v8/V8PerformanceObserver.h" |
| +#include "bindings/core/v8/V8PerformanceObserverEntryList.h" |
| +#include "core/dom/ExecutionContext.h" |
| +#include "wtf/Assertions.h" |
| +#include "wtf/GetPtr.h" |
| +#include "wtf/RefPtr.h" |
| + |
| +namespace blink { |
| + |
| +V8PerformanceObserverCallback::V8PerformanceObserverCallback(v8::Local<v8::Function> callback, ScriptState* scriptState) |
| + : ActiveDOMCallback(scriptState->executionContext()) |
| + , m_scriptState(scriptState) |
| +{ |
| + m_callback.set(scriptState->isolate(), callback); |
| +} |
| + |
| +V8PerformanceObserverCallback::~V8PerformanceObserverCallback() |
| +{ |
| +} |
| + |
| +DEFINE_TRACE(V8PerformanceObserverCallback) |
| +{ |
| + PerformanceObserverCallback::trace(visitor); |
| + ActiveDOMCallback::trace(visitor); |
| +} |
| + |
| +void V8PerformanceObserverCallback::handleEvent(PerformanceObserverEntryList* entries, PerformanceObserver* observer) |
| +{ |
| + if (!canInvokeCallback()) |
| + return; |
| + |
| + if (!m_scriptState->contextIsValid()) |
| + return; |
| + |
| + ScriptState::Scope scope(m_scriptState.get()); |
| + v8::Local<v8::Value> entriesHandle = toV8(entries, m_scriptState->context()->Global(), m_scriptState->isolate()); |
| + if (entriesHandle.IsEmpty()) { |
| + if (!isScriptControllerTerminating()) |
| + CRASH(); |
| + return; |
| + } |
| + v8::Local<v8::Value> observerHandle = toV8(observer, m_scriptState->context()->Global(), m_scriptState->isolate()); |
| + if (observerHandle.IsEmpty()) { |
| + if (!isScriptControllerTerminating()) |
| + CRASH(); |
| + return; |
| + } |
| + v8::Local<v8::Value> argv[] = { entriesHandle, observerHandle }; |
| + |
| + ScriptController::callFunction(m_scriptState->executionContext(), m_callback.newLocal(m_scriptState->isolate()), m_scriptState->context()->Global(), 2, argv, m_scriptState->isolate()); |
|
esprehn
2015/07/18 22:24:15
ditto about the code generator, we should really b
|
| +} |
| + |
| +} // namespace blink |