Chromium Code Reviews| Index: Source/bindings/v8/Dictionary.h |
| diff --git a/Source/bindings/v8/Dictionary.h b/Source/bindings/v8/Dictionary.h |
| index fff0cfa28c754e2d4ab63f0c45090259d36c9a64..20829cfab0ce8ef6bccdf577c6ff4a294918faa3 100644 |
| --- a/Source/bindings/v8/Dictionary.h |
| +++ b/Source/bindings/v8/Dictionary.h |
| @@ -88,8 +88,8 @@ public: |
| bool get(const String&, RefPtr<MediaKeyError>&) const; |
| bool get(const String&, RefPtr<TrackBase>&) const; |
| bool get(const String&, RefPtr<SpeechRecognitionError>&) const; |
| - bool get(const String&, RefPtr<SpeechRecognitionResult>&) const; |
| - bool get(const String&, RefPtr<SpeechRecognitionResultList>&) const; |
| + bool get(const String&, RefPtrWillBeRawPtr<SpeechRecognitionResult>&) const; |
| + bool get(const String&, RefPtrWillBeRawPtr<SpeechRecognitionResultList>&) const; |
| bool get(const String&, RefPtr<MediaStream>&) const; |
| bool get(const String&, RefPtr<EventTarget>&) const; |
| bool get(const String&, HashSet<AtomicString>&) const; |
| @@ -161,6 +161,8 @@ public: |
| bool convert(ConversionContext &, const String&, ArrayValue&) const; |
| template<typename T> |
| bool convert(ConversionContext &, const String&, RefPtr<T>&) const; |
| + template<typename T> |
| + bool convert(ConversionContext &, const String&, RawPtr<T>&) const; |
|
haraken
2014/02/12 05:18:45
Nit: Unnecessary space before '&'.
sof
2014/02/12 07:48:51
Well spotted, fixed.
|
| template<typename StringType> |
| bool getStringType(const String&, StringType&) const; |
| @@ -321,6 +323,25 @@ template<typename T> bool Dictionary::convert(ConversionContext& context, const |
| return false; |
| } |
| +template<typename T> bool Dictionary::convert(ConversionContext& context, const String& key, RawPtr<T>& value) const |
|
haraken
2014/02/12 05:18:45
Nit: It's a shame that we have to duplicate the co
sof
2014/02/12 07:48:51
Seems ripe for that; we can handle that separately
|
| +{ |
| + ConversionContextScope scope(context); |
| + |
| + if (!get(key, value)) |
| + return true; |
| + |
| + if (value) |
| + return true; |
| + |
| + v8::Local<v8::Value> v8Value; |
| + getKey(key, v8Value); |
| + if (context.isNullable() && WebCore::isUndefinedOrNull(v8Value)) |
| + return true; |
| + |
| + context.throwTypeError(ExceptionMessages::incorrectPropertyType(key, "does not have a " + context.typeName() + " type.")); |
| + return false; |
| +} |
| + |
| } |
| #endif // Dictionary_h |