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

Unified Diff: Source/bindings/v8/Dictionary.h

Issue 177633006: Implement IDBVersionChangeEvent ctor w/ IDBVersionChangeEventInit dict (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 10 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/bindings.gypi ('k') | Source/bindings/v8/Nullable.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/Dictionary.h
diff --git a/Source/bindings/v8/Dictionary.h b/Source/bindings/v8/Dictionary.h
index 7d19bba33d4c0cbe00a8f663e8e5a66b6618aa27..1b82fc9e1d78298829a8817b8fb9cc61383cccaa 100644
--- a/Source/bindings/v8/Dictionary.h
+++ b/Source/bindings/v8/Dictionary.h
@@ -28,6 +28,7 @@
#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
+#include "bindings/v8/Nullable.h"
#include "bindings/v8/ScriptValue.h"
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8BindingMacros.h"
@@ -154,6 +155,9 @@ public:
template<typename IntegralType>
bool convert(ConversionContext&, const String&, IntegralType&) const;
+ template<typename IntegralType>
+ bool convert(ConversionContext&, const String&, Nullable<IntegralType>&) const;
+
bool convert(ConversionContext&, const String&, MessagePortArray&) const;
bool convert(ConversionContext&, const String&, HashSet<AtomicString>&) const;
bool convert(ConversionContext&, const String&, Dictionary&) const;
@@ -302,6 +306,28 @@ template<typename T> bool Dictionary::convert(ConversionContext& context, const
return true;
}
+template<typename T> bool Dictionary::convert(ConversionContext& context, const String& key, Nullable<T>& value) const
+{
+ ConversionContextScope scope(context);
+
+ v8::Local<v8::Value> v8Value;
+ if (!getKey(key, v8Value))
+ return true;
+
+ if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) {
+ value = Nullable<T>();
+ return true;
+ }
+
+ T converted = IntegralTypeTraits<T>::toIntegral(v8Value, NormalConversion, context.exceptionState());
+
+ if (context.exceptionState().throwIfNeeded())
+ return false;
+
+ value = Nullable<T>(converted);
+ return true;
+}
+
template<template <typename> class PointerType, typename T> bool Dictionary::convert(ConversionContext& context, const String& key, PointerType<T>& value) const
{
ConversionContextScope scope(context);
« no previous file with comments | « Source/bindings/bindings.gypi ('k') | Source/bindings/v8/Nullable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698