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

Side by Side Diff: chrome/app/mash/mash_runner.cc

Issue 2351603002: mojo: Use TYPE_DEFAULT message-loop for browser-tests. (Closed)
Patch Set: . Created 4 years, 3 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
« no previous file with comments | « base/threading/thread_restrictions.h ('k') | chrome/test/base/mash_browser_tests_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/app/mash/mash_runner.h" 5 #include "chrome/app/mash/mash_runner.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/debugger.h" 10 #include "base/debug/debugger.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 void MashRunner::RunChild() { 121 void MashRunner::RunChild() {
122 base::i18n::InitializeICU(); 122 base::i18n::InitializeICU();
123 shell::ChildProcessMainWithCallback( 123 shell::ChildProcessMainWithCallback(
124 base::Bind(&MashRunner::StartChildApp, base::Unretained(this))); 124 base::Bind(&MashRunner::StartChildApp, base::Unretained(this)));
125 } 125 }
126 126
127 void MashRunner::StartChildApp( 127 void MashRunner::StartChildApp(
128 shell::mojom::ServiceRequest service_request) { 128 shell::mojom::ServiceRequest service_request) {
129 // TODO(sky): use MessagePumpMojo. 129 // TODO(sad): Normally, this would be a TYPE_DEFAULT message loop. However,
130 // TYPE_UI is needed for mojo:ui. But it is not known whether the child app is
131 // going to be mojo:ui at this point. So always create a TYPE_UI message loop
132 // for now.
130 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); 133 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI);
131 service_.reset(new mash::MashPackagedService); 134 service_.reset(new mash::MashPackagedService);
132 service_->set_context(base::MakeUnique<shell::ServiceContext>( 135 service_->set_context(base::MakeUnique<shell::ServiceContext>(
133 service_.get(), std::move(service_request))); 136 service_.get(), std::move(service_request)));
134 base::RunLoop().Run(); 137 base::RunLoop().Run();
135 } 138 }
136 139
137 int MashMain() { 140 int MashMain() {
138 #if defined(OS_WIN) 141 #if defined(OS_WIN)
139 base::RouteStdioToConsole(false); 142 base::RouteStdioToConsole(false);
140 #endif 143 #endif
141 // TODO(sky): wire this up correctly. 144 // TODO(sky): wire this up correctly.
142 logging::LoggingSettings settings; 145 logging::LoggingSettings settings;
143 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 146 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
144 logging::InitLogging(settings); 147 logging::InitLogging(settings);
145 // To view log output with IDs and timestamps use "adb logcat -v threadtime". 148 // To view log output with IDs and timestamps use "adb logcat -v threadtime".
146 logging::SetLogItems(true, // Process ID 149 logging::SetLogItems(true, // Process ID
147 true, // Thread ID 150 true, // Thread ID
148 true, // Timestamp 151 true, // Timestamp
149 true); // Tick count 152 true); // Tick count
150 153
151 // TODO(sky): use MessagePumpMojo.
152 std::unique_ptr<base::MessageLoop> message_loop; 154 std::unique_ptr<base::MessageLoop> message_loop;
153 #if defined(OS_LINUX) 155 #if defined(OS_LINUX)
154 base::AtExitManager exit_manager; 156 base::AtExitManager exit_manager;
155 #endif 157 #endif
156 if (!IsChild()) 158 if (!IsChild())
157 message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI)); 159 message_loop.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
158 160
159 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 161 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
160 switches::kTraceToConsole)) { 162 switches::kTraceToConsole)) {
161 base::trace_event::TraceConfig trace_config = 163 base::trace_event::TraceConfig trace_config =
162 tracing::GetConfigForTraceToConsole(); 164 tracing::GetConfigForTraceToConsole();
163 base::trace_event::TraceLog::GetInstance()->SetEnabled( 165 base::trace_event::TraceLog::GetInstance()->SetEnabled(
164 trace_config, 166 trace_config,
165 base::trace_event::TraceLog::RECORDING_MODE); 167 base::trace_event::TraceLog::RECORDING_MODE);
166 } 168 }
167 169
168 MashRunner mash_runner; 170 MashRunner mash_runner;
169 mash_runner.Run(); 171 mash_runner.Run();
170 return 0; 172 return 0;
171 } 173 }
OLDNEW
« no previous file with comments | « base/threading/thread_restrictions.h ('k') | chrome/test/base/mash_browser_tests_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698