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

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

Issue 171533006: V8 Binding: Introduce toNativeWithTypeCheck (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/tests/results/V8TestTypedefs.cpp ('k') | Source/bindings/v8/IDBBindingUtilities.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/Dictionary.cpp
diff --git a/Source/bindings/v8/Dictionary.cpp b/Source/bindings/v8/Dictionary.cpp
index 95b98fc39bd548cf624f7a31babfa682feffeeb1..8fd6b183853f55c3e7d1f1474ad397d930383693 100644
--- a/Source/bindings/v8/Dictionary.cpp
+++ b/Source/bindings/v8/Dictionary.cpp
@@ -337,9 +337,7 @@ bool Dictionary::get(const String& key, RefPtr<Storage>& value) const
if (!getKey(key, v8Value))
return false;
- value = 0;
- if (V8Storage::hasInstance(v8Value, m_isolate))
- value = V8Storage::toNative(v8::Handle<v8::Object>::Cast(v8Value));
+ value = V8Storage::toNativeWithTypeCheck(m_isolate, v8Value);
return true;
}
@@ -427,9 +425,7 @@ bool Dictionary::get(const String& key, RefPtr<Uint8Array>& value) const
if (!getKey(key, v8Value))
return false;
- value = 0;
- if (V8Uint8Array::hasInstance(v8Value, m_isolate))
- value = V8Uint8Array::toNative(v8::Handle<v8::Object>::Cast(v8Value));
+ value = V8Uint8Array::toNativeWithTypeCheck(m_isolate, v8Value);
return true;
}
@@ -439,9 +435,7 @@ bool Dictionary::get(const String& key, RefPtr<ArrayBufferView>& value) const
if (!getKey(key, v8Value))
return false;
- value = 0;
- if (V8ArrayBufferView::hasInstance(v8Value, m_isolate))
- value = V8ArrayBufferView::toNative(v8::Handle<v8::Object>::Cast(v8Value));
+ value = V8ArrayBufferView::toNativeWithTypeCheck(m_isolate, v8Value);
return true;
}
@@ -451,9 +445,7 @@ bool Dictionary::get(const String& key, RefPtr<MIDIPort>& value) const
if (!getKey(key, v8Value))
return false;
- value = 0;
- if (V8MIDIPort::hasInstance(v8Value, m_isolate))
- value = V8MIDIPort::toNative(v8::Handle<v8::Object>::Cast(v8Value));
+ value = V8MIDIPort::toNativeWithTypeCheck(m_isolate, v8Value);
return true;
}
@@ -463,9 +455,7 @@ bool Dictionary::get(const String& key, RefPtr<MediaKeyError>& value) const
if (!getKey(key, v8Value))
return false;
- value = 0;
- if (V8MediaKeyError::hasInstance(v8Value, m_isolate))
- value = V8MediaKeyError::toNative(v8::Handle<v8::Object>::Cast(v8Value));
+ value = V8MediaKeyError::toNativeWithTypeCheck(m_isolate, v8Value);
return true;
}
@@ -495,9 +485,7 @@ bool Dictionary::get(const String& key, RefPtr<SpeechRecognitionError>& value) c
if (!getKey(key, v8Value))
return false;
- value = 0;
- if (V8SpeechRecognitionError::hasInstance(v8Value, m_isolate))
- value = V8SpeechRecognitionError::toNative(v8::Handle<v8::Object>::Cast(v8Value));
+ value = V8SpeechRecognitionError::toNativeWithTypeCheck(m_isolate, v8Value);
return true;
}
@@ -507,9 +495,7 @@ bool Dictionary::get(const String& key, RefPtrWillBeRawPtr<SpeechRecognitionResu
if (!getKey(key, v8Value))
return false;
- value = 0;
- if (V8SpeechRecognitionResult::hasInstance(v8Value, m_isolate))
- value = V8SpeechRecognitionResult::toNative(v8::Handle<v8::Object>::Cast(v8Value));
+ value = V8SpeechRecognitionResult::toNativeWithTypeCheck(m_isolate, v8Value);
return true;
}
@@ -519,9 +505,7 @@ bool Dictionary::get(const String& key, RefPtrWillBeRawPtr<SpeechRecognitionResu
if (!getKey(key, v8Value))
return false;
- value = 0;
- if (V8SpeechRecognitionResultList::hasInstance(v8Value, m_isolate))
- value = V8SpeechRecognitionResultList::toNative(v8::Handle<v8::Object>::Cast(v8Value));
+ value = V8SpeechRecognitionResultList::toNativeWithTypeCheck(m_isolate, v8Value);
return true;
}
@@ -531,9 +515,7 @@ bool Dictionary::get(const String& key, RefPtr<MediaStream>& value) const
if (!getKey(key, v8Value))
return false;
- value = 0;
- if (V8MediaStream::hasInstance(v8Value, m_isolate))
- value = V8MediaStream::toNative(v8::Handle<v8::Object>::Cast(v8Value));
+ value = V8MediaStream::toNativeWithTypeCheck(m_isolate, v8Value);
return true;
}
« no previous file with comments | « Source/bindings/tests/results/V8TestTypedefs.cpp ('k') | Source/bindings/v8/IDBBindingUtilities.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698