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

Unified Diff: mojo/public/cpp/bindings/array.h

Issue 311273003: Mojo: Add resize and push_back to Array. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ForwardType 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
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/array_internal.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/array.h
diff --git a/mojo/public/cpp/bindings/array.h b/mojo/public/cpp/bindings/array.h
index bf971764526a926b29f4c8a32587ef8637bad90f..daf7125bb3c57d7e6355b64c9549ce91be25fbc7 100644
--- a/mojo/public/cpp/bindings/array.h
+++ b/mojo/public/cpp/bindings/array.h
@@ -27,6 +27,7 @@ class Array {
typedef typename Traits::ConstRefType ConstRefType;
typedef typename Traits::RefType RefType;
typedef typename Traits::StorageType StorageType;
+ typedef typename Traits::ForwardType ForwardType;
typedef internal::Array_Data<typename internal::WrapperTraits<T>::DataType>
Data_;
@@ -75,6 +76,16 @@ class Array {
RefType at(size_t offset) { return Traits::at(&vec_, offset); }
RefType operator[](size_t offset) { return at(offset); }
+ void push_back(ForwardType value) {
+ is_null_ = false;
+ Traits::PushBack(&vec_, value);
+ }
+
+ void resize(size_t size) {
+ is_null_ = false;
+ Traits::Resize(&vec_, size);
+ }
+
const std::vector<StorageType>& storage() const {
return vec_;
}
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/lib/array_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698