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

Side by Side Diff: mojo/application/application_runner_chromium.cc

Issue 868463008: Remove Client relationship between mojo.Shell/mojo.Application (Closed) Base URL: git@github.com:domokit/mojo.git@app_impl_init
Patch Set: fix android Created 5 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 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 "mojo/application/application_runner_chromium.h" 5 #include "mojo/application/application_runner_chromium.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/stack_trace.h" 9 #include "base/debug/stack_trace.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 19 matching lines...) Expand all
30 ApplicationRunnerChromium::~ApplicationRunnerChromium() {} 30 ApplicationRunnerChromium::~ApplicationRunnerChromium() {}
31 31
32 void ApplicationRunnerChromium::set_message_loop_type( 32 void ApplicationRunnerChromium::set_message_loop_type(
33 base::MessageLoop::Type type) { 33 base::MessageLoop::Type type) {
34 DCHECK_NE(base::MessageLoop::TYPE_CUSTOM, type); 34 DCHECK_NE(base::MessageLoop::TYPE_CUSTOM, type);
35 DCHECK(!has_run_); 35 DCHECK(!has_run_);
36 36
37 message_loop_type_ = type; 37 message_loop_type_ = type;
38 } 38 }
39 39
40 MojoResult ApplicationRunnerChromium::Run(MojoHandle shell_handle) { 40 MojoResult ApplicationRunnerChromium::Run(
41 MojoHandle application_request_handle) {
41 DCHECK(!has_run_); 42 DCHECK(!has_run_);
42 has_run_ = true; 43 has_run_ = true;
43 44
44 base::CommandLine::Init(0, NULL); 45 base::CommandLine::Init(0, NULL);
45 base::AtExitManager at_exit; 46 base::AtExitManager at_exit;
46 47
47 #ifndef NDEBUG 48 #ifndef NDEBUG
48 base::debug::EnableInProcessStackDumping(); 49 base::debug::EnableInProcessStackDumping();
49 #endif 50 #endif
50 51
51 { 52 {
52 scoped_ptr<base::MessageLoop> loop; 53 scoped_ptr<base::MessageLoop> loop;
53 if (message_loop_type_ == base::MessageLoop::TYPE_CUSTOM) 54 if (message_loop_type_ == base::MessageLoop::TYPE_CUSTOM)
54 loop.reset(new base::MessageLoop(common::MessagePumpMojo::Create())); 55 loop.reset(new base::MessageLoop(common::MessagePumpMojo::Create()));
55 else 56 else
56 loop.reset(new base::MessageLoop(message_loop_type_)); 57 loop.reset(new base::MessageLoop(message_loop_type_));
57 58
58 ShellPtr shell; 59 ApplicationImpl impl(delegate_.get(),
59 shell.Bind(MakeScopedHandle(MessagePipeHandle(shell_handle))); 60 MakeRequest<Application>(MakeScopedHandle(
60 ApplicationImpl impl(delegate_.get(), shell.Pass()); 61 MessagePipeHandle(application_request_handle))));
61 loop->Run(); 62 loop->Run();
62 } 63 }
63 delegate_.reset(); 64 delegate_.reset();
64 return MOJO_RESULT_OK; 65 return MOJO_RESULT_OK;
65 } 66 }
66 67
67 } // namespace mojo 68 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698