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

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

Issue 1009503003: [bindings] Introduce ScriptValue.to<T> to convert to native values. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8Binding.h » ('j') | Source/bindings/core/v8/V8Binding.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/ScriptValue.h
diff --git a/Source/bindings/core/v8/ScriptValue.h b/Source/bindings/core/v8/ScriptValue.h
index ca543728397bfa153f717b246367ab07a5b15eb2..f1b220b1b9c1cd374727789cd720562084b9f7e3 100644
--- a/Source/bindings/core/v8/ScriptValue.h
+++ b/Source/bindings/core/v8/ScriptValue.h
@@ -41,8 +41,12 @@
namespace blink {
+class ExceptionState;
class JSONValue;
+template <typename T>
+T script_value_cast(const v8::Local<v8::Value>&, v8::Isolate*, ExceptionState&);
+
class CORE_EXPORT ScriptValue final {
public:
template<typename T>
@@ -51,6 +55,12 @@ public:
return ScriptValue(scriptState, toV8(value, scriptState->context()->Global(), scriptState->isolate()));
}
+ template<typename T>
+ T to(ExceptionState& exceptionState) const
+ {
+ return script_value_cast<T>(v8Value(), isolate(), exceptionState);
haraken 2015/03/14 01:27:19 I'm wondering why we cannot simply call: Native
+ }
+
ScriptValue() { }
ScriptValue(ScriptState* scriptState, v8::Handle<v8::Value> value)
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8Binding.h » ('j') | Source/bindings/core/v8/V8Binding.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698