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

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

Issue 883843002: Update mojo sdk to rev 126532ce21c5c3c55a1e1693731411cb60169efd (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes to adapt to roll 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"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "mojo/common/message_pump_mojo.h" 12 #include "mojo/common/message_pump_mojo.h"
13 #include "third_party/mojo/src/mojo/public/cpp/application/application_delegate. h" 13 #include "mojo/public/cpp/application/application_delegate.h"
14 #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h" 14 #include "mojo/public/cpp/application/application_impl.h"
15 15
16 namespace mojo { 16 namespace mojo {
17 17
18 // static 18 // static
19 void ApplicationImpl::Terminate() { 19 void ApplicationImpl::Terminate() {
20 if (base::MessageLoop::current()->is_running()) 20 if (base::MessageLoop::current()->is_running())
21 base::MessageLoop::current()->Quit(); 21 base::MessageLoop::current()->Quit();
22 } 22 }
23 23
24 ApplicationRunnerChromium::ApplicationRunnerChromium( 24 ApplicationRunnerChromium::ApplicationRunnerChromium(
25 ApplicationDelegate* delegate) 25 ApplicationDelegate* delegate)
26 : delegate_(scoped_ptr<ApplicationDelegate>(delegate)), 26 : delegate_(scoped_ptr<ApplicationDelegate>(delegate)),
27 message_loop_type_(base::MessageLoop::TYPE_CUSTOM), 27 message_loop_type_(base::MessageLoop::TYPE_CUSTOM),
28 has_run_(false) {} 28 has_run_(false) {}
29 29
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 #if !defined(COMPONENT_BUILD)
46 base::AtExitManager at_exit; 46 base::AtExitManager at_exit;
47 #endif
48 47
49 #ifndef NDEBUG 48 #ifndef NDEBUG
50 base::debug::EnableInProcessStackDumping(); 49 base::debug::EnableInProcessStackDumping();
51 #endif 50 #endif
52 51
53 { 52 {
54 scoped_ptr<base::MessageLoop> loop; 53 scoped_ptr<base::MessageLoop> loop;
55 if (message_loop_type_ == base::MessageLoop::TYPE_CUSTOM) 54 if (message_loop_type_ == base::MessageLoop::TYPE_CUSTOM)
56 loop.reset(new base::MessageLoop(common::MessagePumpMojo::Create())); 55 loop.reset(new base::MessageLoop(common::MessagePumpMojo::Create()));
57 else 56 else
58 loop.reset(new base::MessageLoop(message_loop_type_)); 57 loop.reset(new base::MessageLoop(message_loop_type_));
59 58
60 ApplicationImpl impl(delegate_.get(), 59 ApplicationImpl impl(delegate_.get(),
61 MakeScopedHandle(MessagePipeHandle(shell_handle))); 60 MakeRequest<Application>(MakeScopedHandle(
61 MessagePipeHandle(application_request_handle))));
62 loop->Run(); 62 loop->Run();
63 } 63 }
64 delegate_.reset(); 64 delegate_.reset();
65 return MOJO_RESULT_OK; 65 return MOJO_RESULT_OK;
66 } 66 }
67 67
68 } // namespace mojo 68 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/application/application_test_main_chromium.cc » ('j') | mojo/services/html_viewer/html_viewer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698