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

Unified Diff: gin/arguments.cc

Issue 2824883002: [gin] Add Arguments::GetAll() (Closed)
Patch Set: Created 3 years, 8 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: gin/arguments.cc
diff --git a/gin/arguments.cc b/gin/arguments.cc
index 600a811f8483bb0fa77be9156c7c4578a5099167..4d01c0e44d9bce5b818b830f3499ccf6f4a07f96 100644
--- a/gin/arguments.cc
+++ b/gin/arguments.cc
@@ -32,6 +32,19 @@ v8::Local<v8::Value> Arguments::PeekNext() const {
return (*info_)[next_];
}
+std::vector<v8::Local<v8::Value>> Arguments::GetAll() const {
+ std::vector<v8::Local<v8::Value>> result;
+ int length = info_->Length();
+ if (length == 0)
+ return result;
+
+ result.reserve(length);
+ for (int i = 0; i < length; ++i)
+ result.push_back((*info_)[i]);
+
+ return result;
+}
+
v8::Local<v8::Context> Arguments::GetHolderCreationContext() {
return info_->Holder()->CreationContext();
}

Powered by Google App Engine
This is Rietveld 408576698