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

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

Issue 340353006: [webcrypto] Replace KeyAlgorithm interfaces with an Object. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove const reference and make v8value a value Created 6 years, 5 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/core/v8/Dictionary.h ('k') | Source/bindings/modules/v8/custom/V8CryptoKeyCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/Dictionary.cpp
diff --git a/Source/bindings/core/v8/Dictionary.cpp b/Source/bindings/core/v8/Dictionary.cpp
index 7a8266a9e6fb1af2a43735e3ddf78adf9795e6b0..04ff2ebe761ecde9f5d97300825dba3d53e26c58 100644
--- a/Source/bindings/core/v8/Dictionary.cpp
+++ b/Source/bindings/core/v8/Dictionary.cpp
@@ -65,6 +65,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)
@@ -600,6 +606,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);
« no previous file with comments | « Source/bindings/core/v8/Dictionary.h ('k') | Source/bindings/modules/v8/custom/V8CryptoKeyCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698