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

Side by Side Diff: mojo/public/cpp/application/lib/application_runner.cc

Issue 441853002: mojo: first take on removing mojo_main_{chromium,standalone}. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/public/cpp/application/application_runner.h"
6
7 #include "mojo/public/cpp/application/application_delegate.h"
8 #include "mojo/public/cpp/application/application_impl.h"
9 #include "mojo/public/cpp/environment/environment.h"
10 #include "mojo/public/cpp/utility/run_loop.h"
11
12 namespace mojo {
13
14 // static
15 void ApplicationImpl::Terminate() {
16 RunLoop::current()->Quit();
17 }
18
19 ApplicationRunner::ApplicationRunner() : delegate_(NULL) {}
20 ApplicationRunner::~ApplicationRunner() { assert(!delegate_); }
21
22 void ApplicationRunner::take_delegate(ApplicationDelegate* delegate) {
23 assert(!delegate_);
24 assert(delegate);
25 delegate_ = delegate;
26 }
27
28 MojoResult ApplicationRunner::Run(MojoHandle shell_handle) {
29 Environment env;
30 env.GetDefaultAsyncWaiter();
31 {
32 RunLoop loop;
33 ApplicationImpl app(delegate_,
34 MakeScopedHandle(MessagePipeHandle(shell_handle)));
35 loop.Run();
36 }
37
38 delete delegate_;
39 delegate_ = NULL;
40 return MOJO_RESULT_OK;
41 }
42
43 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698