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

Unified Diff: ppapi/shared_impl/dictionary_var.cc

Issue 12388083: Add PPB_VarArray_Dev support - part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
Index: ppapi/shared_impl/dictionary_var.cc
diff --git a/ppapi/shared_impl/dictionary_var.cc b/ppapi/shared_impl/dictionary_var.cc
index 93a39353c786c6ed4d517991b6ac515b1c0991be..cbe7c0bbada3bcf5c93cf86de2726d3804a11a82 100644
--- a/ppapi/shared_impl/dictionary_var.cc
+++ b/ppapi/shared_impl/dictionary_var.cc
@@ -6,6 +6,7 @@
#include "base/memory/ref_counted.h"
#include "base/string_util.h"
+#include "ppapi/shared_impl/array_var.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/var_tracker.h"
@@ -79,8 +80,16 @@ PP_Bool DictionaryVar::HasKey(const PP_Var& key) const {
}
PP_Var DictionaryVar::GetKeys() const {
- // TODO(yzshen): Implement once array PP_Var is supported.
- return PP_MakeNull();
+ scoped_refptr<ArrayVar> array_var(new ArrayVar());
+ array_var->elements().reserve(key_value_map_.size());
+
+ for (KeyValueMap::const_iterator iter = key_value_map_.begin();
+ iter != key_value_map_.end(); ++iter) {
+ array_var->elements().push_back(
+ ScopedPPVar(ScopedPPVar::PassRef(),
+ StringVar::StringToPPVar(iter->first)));
+ }
+ return array_var->GetPPVar();
}
bool DictionaryVar::SetWithStringKey(const std::string& utf8_key,

Powered by Google App Engine
This is Rietveld 408576698