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

Side by Side Diff: shell/context.cc

Issue 1061413002: Shell: Make a separate binary for child processes. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Don't look at kChildProcess in desktop/main.cc. Created 5 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "shell/context.h" 5 #include "shell/context.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 void Context::SetCommandLineCWD(const base::FilePath& path) { 229 void Context::SetCommandLineCWD(const base::FilePath& path) {
230 command_line_cwd_ = AddTrailingSlashIfNeeded(FilePathToFileURL(path)); 230 command_line_cwd_ = AddTrailingSlashIfNeeded(FilePathToFileURL(path));
231 } 231 }
232 232
233 GURL Context::ResolveCommandLineURL(const std::string& path) { 233 GURL Context::ResolveCommandLineURL(const std::string& path) {
234 return command_line_cwd_.Resolve(path); 234 return command_line_cwd_.Resolve(path);
235 } 235 }
236 236
237 bool Context::Init() { 237 bool Context::Init() {
238 TRACE_EVENT0("mojo_shell", "Context::Init"); 238 base::FilePath shell_path = base::MakeAbsoluteFilePath(
239 base::CommandLine::ForCurrentProcess()->GetProgram());
240 base::FilePath shell_child_path =
241 shell_path.DirName().AppendASCII("mojo_shell_child");
242 return InitWithPaths(shell_path, shell_child_path);
243 }
244
245 bool Context::InitWithPaths(const base::FilePath& shell_path,
246 const base::FilePath& shell_child_path) {
247 TRACE_EVENT0("mojo_shell", "Context::InitWithPaths");
239 const base::CommandLine& command_line = 248 const base::CommandLine& command_line =
240 *base::CommandLine::ForCurrentProcess(); 249 *base::CommandLine::ForCurrentProcess();
241 250
242 if (command_line.HasSwitch(switches::kWaitForDebugger)) 251 if (command_line.HasSwitch(switches::kWaitForDebugger))
243 base::debug::WaitForDebugger(60, true); 252 base::debug::WaitForDebugger(60, true);
244 253
245 mojo_shell_path_ = base::MakeAbsoluteFilePath(command_line.GetProgram()); 254 mojo_shell_path_ = shell_path;
246 // TODO(vtl): For the moment, the child is the same as the parent. 255 mojo_shell_child_path_ = shell_child_path;
247 mojo_shell_child_path_ = mojo_shell_path_;
248 256
249 EnsureEmbedderIsInitialized(); 257 EnsureEmbedderIsInitialized();
250 task_runners_.reset( 258 task_runners_.reset(
251 new TaskRunners(base::MessageLoop::current()->message_loop_proxy())); 259 new TaskRunners(base::MessageLoop::current()->message_loop_proxy()));
252 260
253 // TODO(vtl): Probably these failures should be checked before |Init()|, and 261 // TODO(vtl): Probably these failures should be checked before |Init()|, and
254 // this function simply shouldn't fail. 262 // this function simply shouldn't fail.
255 if (!shell_file_root_.is_valid()) 263 if (!shell_file_root_.is_valid())
256 return false; 264 return false;
257 if (!ConfigureURLMappings(command_line, this)) 265 if (!ConfigureURLMappings(command_line, this))
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) { 332 if (app_urls_.empty() && base::MessageLoop::current()->is_running()) {
325 DCHECK_EQ(base::MessageLoop::current()->task_runner(), 333 DCHECK_EQ(base::MessageLoop::current()->task_runner(),
326 task_runners_->shell_runner()); 334 task_runners_->shell_runner());
327 base::MessageLoop::current()->Quit(); 335 base::MessageLoop::current()->Quit();
328 } 336 }
329 } 337 }
330 } 338 }
331 339
332 } // namespace shell 340 } // namespace shell
333 } // namespace mojo 341 } // namespace mojo
OLDNEW
« shell/android/main.cc ('K') | « shell/context.h ('k') | shell/desktop/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698