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

Unified Diff: Source/bindings/core/v8/DictionaryHelperForCore.cpp

Issue 1154943009: bindings: Remove [EventConstructor] and [InitializedByEventConstructor] (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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
Index: Source/bindings/core/v8/DictionaryHelperForCore.cpp
diff --git a/Source/bindings/core/v8/DictionaryHelperForCore.cpp b/Source/bindings/core/v8/DictionaryHelperForCore.cpp
index 3bee6a4f21dbb075b707389dd11bee72ad73e9fd..57d0717742016994ebe1cd4f62702f317ff07cfc 100644
--- a/Source/bindings/core/v8/DictionaryHelperForCore.cpp
+++ b/Source/bindings/core/v8/DictionaryHelperForCore.cpp
@@ -69,14 +69,6 @@ CORE_EXPORT bool DictionaryHelper::get(const Dictionary& dictionary, const Strin
}
template <>
-bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::ConversionContext& context, const String& key, bool& value)
-{
- Dictionary::ConversionContextScope scope(context);
- DictionaryHelper::get(dictionary, key, value);
- return true;
-}
-
-template <>
CORE_EXPORT bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, int32_t& value)
{
v8::Local<v8::Value> v8Value;
@@ -106,19 +98,6 @@ bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, doub
return DictionaryHelper::get(dictionary, key, value, unused);
}
-template <>
-bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::ConversionContext& context, const String& key, double& value)
-{
- Dictionary::ConversionContextScope scope(context);
-
- bool hasValue = false;
- if (!DictionaryHelper::get(dictionary, key, value, hasValue) && hasValue) {
- context.throwTypeError(ExceptionMessages::incorrectPropertyType(key, "is not of type 'double'."));
- return false;
- }
- return true;
-}
-
template<typename StringType>
bool getStringType(const Dictionary& dictionary, const String& key, StringType& value)
{
@@ -146,22 +125,6 @@ bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Atom
}
template <>
-bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::ConversionContext& context, const String& key, String& value)
-{
- Dictionary::ConversionContextScope scope(context);
-
- v8::Local<v8::Value> v8Value;
- if (!dictionary.get(key, v8Value))
- return true;
-
- V8StringResource<> stringValue(v8Value);
- if (!stringValue.prepare())
- return false;
- value = stringValue;
- return true;
-}
-
-template <>
bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, ScriptValue& value)
{
v8::Local<v8::Value> v8Value;
@@ -172,15 +135,6 @@ bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, Scri
return true;
}
-template <>
-bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::ConversionContext& context, const String& key, ScriptValue& value)
-{
- Dictionary::ConversionContextScope scope(context);
-
- DictionaryHelper::get(dictionary, key, value);
- return true;
-}
-
template<typename NumericType>
bool getNumericType(const Dictionary& dictionary, const String& key, NumericType& value)
{
@@ -344,26 +298,6 @@ CORE_EXPORT bool DictionaryHelper::get(const Dictionary& dictionary, const Strin
}
template <>
-bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::ConversionContext& context, const String& key, Vector<String>& value)
-{
- Dictionary::ConversionContextScope scope(context);
-
- v8::Local<v8::Value> v8Value;
- if (!dictionary.get(key, v8Value))
- return true;
-
- if (context.isNullable() && blink::isUndefinedOrNull(v8Value))
- return true;
-
- if (!v8Value->IsArray()) {
- context.throwTypeError(ExceptionMessages::notASequenceTypeProperty(key));
- return false;
- }
-
- return DictionaryHelper::get(dictionary, key, value);
-}
-
-template <>
CORE_EXPORT bool DictionaryHelper::get(const Dictionary& dictionary, const String& key, ArrayValue& value)
{
v8::Local<v8::Value> v8Value;
@@ -379,26 +313,6 @@ CORE_EXPORT bool DictionaryHelper::get(const Dictionary& dictionary, const Strin
return true;
}
-template <>
-bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::ConversionContext& context, const String& key, ArrayValue& value)
-{
- Dictionary::ConversionContextScope scope(context);
-
- v8::Local<v8::Value> v8Value;
- if (!dictionary.get(key, v8Value))
- return true;
-
- if (context.isNullable() && blink::isUndefinedOrNull(v8Value))
- return true;
-
- if (!v8Value->IsArray()) {
- context.throwTypeError(ExceptionMessages::notASequenceTypeProperty(key));
- return false;
- }
-
- return DictionaryHelper::get(dictionary, key, value);
-}
-
template CORE_EXPORT bool DictionaryHelper::get(const Dictionary&, const String& key, RefPtr<DOMUint8Array>& value);
template <typename T>
@@ -495,56 +409,4 @@ struct IntegralTypeTraits<long long> {
static const String typeName() { return "Int64"; }
};
-template<typename T>
-bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::ConversionContext& context, const String& key, T& value)
-{
- Dictionary::ConversionContextScope scope(context);
-
- v8::Local<v8::Value> v8Value;
- if (!dictionary.get(key, v8Value))
- return true;
-
- value = IntegralTypeTraits<T>::toIntegral(dictionary.isolate(), v8Value, NormalConversion, context.exceptionState());
- if (context.exceptionState().throwIfNeeded())
- return false;
-
- return true;
-}
-
-template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, uint8_t& value);
-template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, int8_t& value);
-template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, unsigned short& value);
-template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, short& value);
-template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, unsigned& value);
-template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, unsigned long& value);
-template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, int& value);
-template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, long& value);
-template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, long long& value);
-template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, unsigned long long& value);
-
-template bool DictionaryHelper::convert(const Dictionary&, Dictionary::ConversionContext&, const String& key, RefPtrWillBeMember<EventTarget>& value);
-
-template <>
-bool DictionaryHelper::convert(const Dictionary& dictionary, Dictionary::ConversionContext& context, const String& key, MessagePortArray& value)
-{
- Dictionary::ConversionContextScope scope(context);
-
- v8::Local<v8::Value> v8Value;
- if (!dictionary.get(key, v8Value))
- return true;
-
- ASSERT(dictionary.isolate());
- ASSERT(dictionary.isolate() == v8::Isolate::GetCurrent());
-
- if (isUndefinedOrNull(v8Value))
- return true;
-
- value = toRefPtrWillBeMemberNativeArray<MessagePort, V8MessagePort>(v8Value, key, dictionary.isolate(), context.exceptionState());
-
- if (context.exceptionState().throwIfNeeded())
- return false;
-
- return true;
-}
-
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698