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

Unified Diff: src/views/SkOSMenu.cpp

Issue 1549483002: SampleApp: Build list of devices dynamically Base URL: https://skia.googlesource.com/skia.git@sampleapp-01-no-picturedevice
Patch Set: Created 4 years, 11 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 | « samplecode/SampleApp.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/views/SkOSMenu.cpp
diff --git a/src/views/SkOSMenu.cpp b/src/views/SkOSMenu.cpp
index ec92a7b4a5f4e577f313ed79be07cfe107f9c616..50d53480dbf094f41abeb864e3f73a3848617143 100644
--- a/src/views/SkOSMenu.cpp
+++ b/src/views/SkOSMenu.cpp
@@ -148,21 +148,16 @@ int SkOSMenu::appendAction(const char label[], SkEventSinkID target) {
}
int SkOSMenu::appendList(const char label[], const char slotName[],
- SkEventSinkID target, int index, const char option[], ...) {
+ SkEventSinkID target, int index, const SkTArray<const char*>& entries) {
SkEvent* evt = new SkEvent(gMenuEventType, target);
- va_list args;
- if (option) {
- SkString str(option);
- va_start(args, option);
- int count = 1;
- for (const char* arg = va_arg(args, const char*); arg != nullptr; arg = va_arg(args, const char*)) {
+ if (!entries.empty()) {
+ SkString str(entries[0]);
+ for (int i = 1; i < entries.count(); ++i) {
str += gDelimiter;
- str += arg;
- ++count;
+ str += entries[i];
}
- va_end(args);
evt->setString(gList_Items_Str, str);
- evt->setS32(gList_ItemCount_S32, count);
+ evt->setS32(gList_ItemCount_S32, entries.count());
evt->setS32(slotName, index);
}
return appendItem(label, SkOSMenu::kList_Type, slotName, evt);
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698