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

Side by Side Diff: examples/indirect_service/indirect_service_demo.cc

Issue 2011383002: Get rid of {Run,Terminate}MainApplication(), and more ApplicationDelegate conversion. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cstdlib> 5 #include <cstdlib>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "examples/indirect_service/indirect_service_demo.mojom.h" 11 #include "examples/indirect_service/indirect_service_demo.mojom.h"
12 #include "mojo/environment/scoped_chromium_init.h"
12 #include "mojo/message_pump/message_pump_mojo.h" 13 #include "mojo/message_pump/message_pump_mojo.h"
13 #include "mojo/public/c/system/main.h" 14 #include "mojo/public/c/system/main.h"
14 #include "mojo/public/cpp/application/application_impl_base.h" 15 #include "mojo/public/cpp/application/application_impl_base.h"
15 #include "mojo/public/cpp/application/connect.h" 16 #include "mojo/public/cpp/application/connect.h"
16 #include "mojo/public/cpp/application/run_application.h" 17 #include "mojo/public/cpp/application/run_application.h"
17 18
18 namespace mojo { 19 namespace mojo {
19 namespace examples { 20 namespace examples {
20 21
21 class DemoTask; 22 class DemoTask;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 133 }
133 134
134 void DoFinishDemoTask(DemoTask* task, const std::vector<int32_t>& results) { 135 void DoFinishDemoTask(DemoTask* task, const std::vector<int32_t>& results) {
135 std::string display(kTaskCount * kTaskIterationCount, ' '); 136 std::string display(kTaskCount * kTaskIterationCount, ' ');
136 for (unsigned i = 0; i < results.size(); i++) 137 for (unsigned i = 0; i < results.size(); i++)
137 display[results[i]] = '0' + (results[i] % 10); 138 display[results[i]] = '0' + (results[i] % 10);
138 printf("DemoTask Thread [%s]\n", display.c_str()); 139 printf("DemoTask Thread [%s]\n", display.c_str());
139 tasks_.erase(std::remove(tasks_.begin(), tasks_.end(), task), tasks_.end()); 140 tasks_.erase(std::remove(tasks_.begin(), tasks_.end(), task), tasks_.end());
140 delete task; // Stop the DemoTask's thread etc. 141 delete task; // Stop the DemoTask's thread etc.
141 if (tasks_.empty()) 142 if (tasks_.empty())
142 TerminateMainApplication(MOJO_RESULT_OK); 143 TerminateApplication(MOJO_RESULT_OK);
143 } 144 }
144 145
145 IndirectIntegerServicePtr indirect_integer_service_; 146 IndirectIntegerServicePtr indirect_integer_service_;
146 std::vector<DemoTask*> tasks_; 147 std::vector<DemoTask*> tasks_;
147 }; 148 };
148 149
149 } // namespace examples 150 } // namespace examples
150 } // namespace mojo 151 } // namespace mojo
151 152
152 MojoResult MojoMain(MojoHandle application_request) { 153 MojoResult MojoMain(MojoHandle application_request) {
154 mojo::ScopedChromiumInit init;
153 mojo::examples::IndirectServiceDemoApp indirect_service_demo_app; 155 mojo::examples::IndirectServiceDemoApp indirect_service_demo_app;
154 return mojo::RunMainApplication(application_request, 156 return mojo::RunApplication(application_request, &indirect_service_demo_app);
155 &indirect_service_demo_app);
156 } 157 }
OLDNEW
« no previous file with comments | « examples/indirect_service/indirect_integer_service.cc ('k') | examples/indirect_service/integer_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698