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

Unified Diff: third_party/WebKit/Source/bindings/tests/results/core/V8LongExperimentalCallbackFunction.cpp

Issue 2312093003: Generated bindings for IDL callback functions (Closed)
Patch Set: Addressed comments 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/tests/results/core/V8LongExperimentalCallbackFunction.cpp
diff --git a/third_party/WebKit/Source/bindings/tests/results/core/V8LongExperimentalCallbackFunction.cpp b/third_party/WebKit/Source/bindings/tests/results/core/V8LongExperimentalCallbackFunction.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8d3ecc30f6d0ca496eb9b54b391e09e5ba0b4539
--- /dev/null
+++ b/third_party/WebKit/Source/bindings/tests/results/core/V8LongExperimentalCallbackFunction.cpp
@@ -0,0 +1,53 @@
+// 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 "V8LongExperimentalCallbackFunction.h"
+
+#include "wtf/Assertions.h"
bashi 2016/09/16 05:51:19 alphabetical order. (You will need to sort() incl
lkawai 2016/09/16 10:03:20 Done.
+#include "bindings/core/v8/ScriptState.h"
+#include "bindings/core/v8/V8Binding.h"
+
+namespace blink {
+
+V8LongExperimentalCallbackFunction::V8LongExperimentalCallbackFunction(v8::Isolate* isolate, v8::Local<v8::Function> callback)
+ : m_callback(isolate, callback)
+{
+ DCHECK(!m_callback.isEmpty());
+ m_callback.setPhantom();
bashi 2016/09/16 05:51:19 As chatted offline, just calling setPhantom() woul
+}
+
+DEFINE_TRACE(V8LongExperimentalCallbackFunction)
+{
+}
+
+bool V8LongExperimentalCallbackFunction::call(ScriptState* scriptState, ScriptWrappable* scriptWrappable, int num1, int num2, int& returnValue)
+{
+ if (!scriptState->contextIsValid())
+ return false;
+
+ ScriptState::Scope scope(scriptState);
+ if (m_callback.isEmpty())
+ return false;
+
+ v8::Local<v8::Value> num1Handle = v8::Integer::New(scriptState->isolate(), num1);
+ v8::Local<v8::Value> num2Handle = v8::Integer::New(scriptState->isolate(), num2);
+ v8::Local<v8::Value> argv[] = { num1Handle, num2Handle };
bashi 2016/09/16 05:51:19 Handle -> Argument
lkawai 2016/09/16 10:03:20 Done.
+
+ v8::Local<v8::Value> currentValue;
+ v8::TryCatch exceptionCatcher(scriptState->isolate());
+ exceptionCatcher.SetVerbose(true);
+ if (V8ScriptRunner::callFunction(m_callback.newLocal(scriptState->isolate()), scriptState->getExecutionContext(), scriptState->context()->Global(), 2, argv, scriptState->isolate()).ToLocal(&currentValue))
+ {
+ int cppValue = toInt32(info.GetIsolate(), currentValue, NormalConversion, exceptionState);
+if (exceptionState.hadException())
bashi 2016/09/16 05:51:19 wrong indent
lkawai 2016/09/16 10:03:20 Done.
+ return false;
+ returnValue = cppValue;
+ return true;
+ }
+ return false;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698