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

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, 9 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 | « ppapi/shared_impl/array_var.cc ('k') | ppapi/shared_impl/var.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/dictionary_var.cc
diff --git a/ppapi/shared_impl/dictionary_var.cc b/ppapi/shared_impl/dictionary_var.cc
index 9bfebb94fccefea03ee91f71c078841c74cfc3bc..f7af7d9355d8baeceed8317ca0924977b83ef903 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"
@@ -81,8 +82,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,
« no previous file with comments | « ppapi/shared_impl/array_var.cc ('k') | ppapi/shared_impl/var.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698