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

Unified Diff: Source/bindings/core/v8/V8Binding.h

Issue 513203002: Introduce MIDIInputMap and MIDIOutputMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@iterator-adhoc
Patch Set: Created 6 years, 4 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: Source/bindings/core/v8/V8Binding.h
diff --git a/Source/bindings/core/v8/V8Binding.h b/Source/bindings/core/v8/V8Binding.h
index 4c57f6efec798422a1517e29cc192a35c6e50f9a..aa86e4f387df2dd7a5f4851d7a9051c236061c58 100644
--- a/Source/bindings/core/v8/V8Binding.h
+++ b/Source/bindings/core/v8/V8Binding.h
@@ -209,10 +209,13 @@ inline v8::Handle<v8::Value> v8Undefined()
return v8::Handle<v8::Value>();
}
-// Converts a DOM object to a v8 value.
-// This is a no-inline version of toV8(). If you want to call toV8()
-// without creating #include cycles, you can use this function instead.
-// Each specialized implementation will be generated.
+// Converts a DOM object to a v8 value. This function is intended to be used
+// internally. If you want to convert a C++ value to a JS value without
haraken 2014/09/02 01:20:40 JS value => V8 value
yhirano 2014/09/02 04:43:06 Done.
+// including V8X.h, consider using V8ValueTraits<T>::toV8Value.
+// Note: including bindings/{core, bindings}/v8/V8*.h from core and modules
+// is fine. In such a case, perhaps toV8 is what you want.
+// Note: toV8NoInline is a non-inline toV8 and V8ValueTraits::toV8Value offers
+// more: You can handle value conversion generally with it.
haraken 2014/09/02 01:20:40 Slightly more concise: // toV8NoInline is intende
yhirano 2014/09/02 04:43:06 Done.
template<typename T>
v8::Handle<v8::Value> toV8NoInline(T* impl, v8::Handle<v8::Object> creationContext, v8::Isolate*);
@@ -960,6 +963,17 @@ private:
v8::TryCatch& m_block;
};
+// Returns an object representing {done: true, value: undefined}.
+v8::Local<v8::Value> v8DoneIteratorResult(v8::Isolate*);
+
+// Returns an object representing {done: false, value: |value|}.
+v8::Local<v8::Value> v8IteratorResult(v8::Isolate*, v8::Handle<v8::Value>);
+template <typename T>
+v8::Local<v8::Value> v8IteratorResult(ScriptState* scriptState, const T& value)
+{
+ return v8IteratorResult(scriptState->isolate(), V8ValueTraits<T>::toV8Value(value, scriptState->context()->Global(), scriptState->isolate()));
+}
+
} // namespace blink
#endif // V8Binding_h

Powered by Google App Engine
This is Rietveld 408576698