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: Patch for landing 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 | « Source/bindings/core/v8/NativeValueTraits.h ('k') | Source/bindings/core/v8/V8Binding.h » ('j') | no next file with comments »
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..4a727dd732a30cdab4624dc4af2e5e6e06244db8 100644
--- a/Source/bindings/core/v8/ScriptValue.h
+++ b/Source/bindings/core/v8/ScriptValue.h
@@ -31,6 +31,7 @@
#ifndef ScriptValue_h
#define ScriptValue_h
+#include "bindings/core/v8/NativeValueTraits.h"
#include "bindings/core/v8/ScriptState.h"
#include "bindings/core/v8/SharedPersistent.h"
#include "core/CoreExport.h"
@@ -51,6 +52,12 @@ public:
return ScriptValue(scriptState, toV8(value, scriptState->context()->Global(), scriptState->isolate()));
}
+ template<typename T>
+ inline T to(ExceptionState& exceptionState) const
+ {
+ return NativeValueTraits<T>::nativeValue(v8Value(), isolate(), exceptionState);
+ }
+
ScriptValue() { }
ScriptValue(ScriptState* scriptState, v8::Handle<v8::Value> value)
« no previous file with comments | « Source/bindings/core/v8/NativeValueTraits.h ('k') | Source/bindings/core/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698