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

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

Issue 340353006: [webcrypto] Replace KeyAlgorithm interfaces with an Object. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase onto master Created 6 years, 6 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/v8/Dictionary.cpp
diff --git a/Source/bindings/v8/Dictionary.cpp b/Source/bindings/v8/Dictionary.cpp
index c39a8d627bb5fc24606e99272341294db6d0363a..ab1a74b309383da3c27da0767acc239df77886df 100644
--- a/Source/bindings/v8/Dictionary.cpp
+++ b/Source/bindings/v8/Dictionary.cpp
@@ -64,6 +64,12 @@ Dictionary::Dictionary()
{
}
+Dictionary::Dictionary(v8::Isolate* isolate)
+ : m_options(v8::Object::New(isolate))
+ , m_isolate(isolate)
+{
+}
+
Dictionary::Dictionary(const v8::Handle<v8::Value>& options, v8::Isolate* isolate)
: m_options(options)
, m_isolate(isolate)
@@ -589,6 +595,31 @@ bool Dictionary::get(const String& key, RefPtr<Headers>& value) const
return true;
}
+bool Dictionary::set(const String& key, const v8::Handle<v8::Value>& value)
+{
+ if (isUndefinedOrNull())
+ return false;
+ v8::Local<v8::Object> options = m_options->ToObject();
+ ASSERT(!options.IsEmpty());
+
+ return options->Set(v8String(m_isolate, key), value);
+}
+
+bool Dictionary::set(const String& key, const String& value)
+{
+ return set(key, v8String(m_isolate, value));
+}
+
+bool Dictionary::set(const String& key, unsigned value)
+{
+ return set(key, v8::Integer::NewFromUnsigned(m_isolate, value));
+}
+
+bool Dictionary::set(const String& key, const Dictionary& value)
+{
+ return set(key, value.v8Value());
+}
+
bool Dictionary::convert(ConversionContext& context, const String& key, Dictionary& value) const
{
ConversionContextScope scope(context);

Powered by Google App Engine
This is Rietveld 408576698