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

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

Issue 168483002: Add a second-order Dictionary::convert() function template. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rename template argument 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 | « no previous file | no next file » | 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 cecd3efd11c797236ba6d068103d283bfb4c82d3..0e4412922271470ed92caaa5d76c70cdb1eebf32 100644
--- a/Source/bindings/v8/Dictionary.h
+++ b/Source/bindings/v8/Dictionary.h
@@ -159,10 +159,8 @@ public:
bool convert(ConversionContext&, const String&, Dictionary&) const;
bool convert(ConversionContext&, const String&, Vector<String>&) const;
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;
+ template<template <typename> class PointerType, typename T>
+ bool convert(ConversionContext&, const String&, PointerType<T>&) const;
template<typename StringType>
bool getStringType(const String&, StringType&) const;
@@ -304,26 +302,7 @@ template<typename T> bool Dictionary::convert(ConversionContext& context, const
return true;
}
-template<typename T> bool Dictionary::convert(ConversionContext& context, const String& key, RefPtr<T>& value) const
-{
- 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;
-}
-
-template<typename T> bool Dictionary::convert(ConversionContext& context, const String& key, RawPtr<T>& value) const
+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 | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698