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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8PerformanceObserverCallback.cpp

Issue 2367543004: Extended implementation to use interface as arguments (Closed)
Patch Set: Use generated code for callback function Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/V8PerformanceObserverCallback.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerformanceObserverCallback.cpp b/third_party/WebKit/Source/bindings/core/v8/V8PerformanceObserverCallback.cpp
index b6b52f225454ff1cbcea33d5410a96abffd77b9f..34e4b3a9b43476686d049836a6219dad1e861fa8 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8PerformanceObserverCallback.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8PerformanceObserverCallback.cpp
@@ -18,11 +18,10 @@ namespace blink {
V8PerformanceObserverCallback::V8PerformanceObserverCallback(v8::Local<v8::Function> callback, v8::Local<v8::Object> owner, ScriptState* scriptState)
: ActiveDOMCallback(scriptState->getExecutionContext())
- , m_callback(scriptState->isolate(), callback)
+ , m_callback(V8PerformanceObserverInnerCallback::create(scriptState->isolate(), callback))
, m_scriptState(scriptState)
{
V8PrivateProperty::getPerformanceObserverCallback(scriptState->isolate()).set(scriptState->context(), owner, callback);
- m_callback.setPhantom();
}
V8PerformanceObserverCallback::~V8PerformanceObserverCallback()
@@ -31,35 +30,17 @@ V8PerformanceObserverCallback::~V8PerformanceObserverCallback()
void V8PerformanceObserverCallback::handleEvent(PerformanceObserverEntryList* entries, PerformanceObserver* observer)
{
- if (!canInvokeCallback())
- return;
+ ScriptWrappable* scriptWrappable;
+ ScriptState* scriptState;
- if (!m_scriptState->contextIsValid())
- return;
- ScriptState::Scope scope(m_scriptState.get());
-
- if (m_callback.isEmpty())
- return;
- v8::Local<v8::Value> observerHandle = toV8(observer, m_scriptState->context()->Global(), m_scriptState->isolate());
- if (!observerHandle->IsObject())
- return;
-
- v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(observerHandle);
- v8::Local<v8::Value> entriesHandle = toV8(entries, m_scriptState->context()->Global(), m_scriptState->isolate());
- if (entriesHandle.IsEmpty()) {
- return;
- }
- v8::Local<v8::Value> argv[] = { entriesHandle, observerHandle };
-
- v8::TryCatch exceptionCatcher(m_scriptState->isolate());
- exceptionCatcher.SetVerbose(true);
- V8ScriptRunner::callFunction(m_callback.newLocal(m_scriptState->isolate()), m_scriptState->getExecutionContext(), thisObject, 2, argv, m_scriptState->isolate());
+ m_callback->call(scriptState = nullptr , scriptWrappable = nullptr , entries, observer);
}
DEFINE_TRACE(V8PerformanceObserverCallback)
{
PerformanceObserverCallback::trace(visitor);
ActiveDOMCallback::trace(visitor);
+ visitor->trace(m_callback);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698