| OLD | NEW | 
|---|
| 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 "mojo/runner/context.h" | 5 #include "mojo/runner/context.h" | 
| 6 | 6 | 
| 7 #include <vector> | 7 #include <vector> | 
| 8 | 8 | 
| 9 #include "base/bind.h" | 9 #include "base/bind.h" | 
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" | 
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" | 
|  | 12 #include "base/i18n/icu_util.h" | 
| 12 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" | 
| 13 #include "base/macros.h" | 14 #include "base/macros.h" | 
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" | 
| 15 #include "base/path_service.h" | 16 #include "base/path_service.h" | 
| 16 #include "base/process/process_info.h" | 17 #include "base/process/process_info.h" | 
| 17 #include "base/run_loop.h" | 18 #include "base/run_loop.h" | 
| 18 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" | 
| 19 #include "base/strings/string_split.h" | 20 #include "base/strings/string_split.h" | 
| 20 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" | 
| 21 #include "base/trace_event/trace_event.h" | 22 #include "base/trace_event/trace_event.h" | 
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 185 void Context::EnsureEmbedderIsInitialized() { | 186 void Context::EnsureEmbedderIsInitialized() { | 
| 186   static base::LazyInstance<Setup>::Leaky setup = LAZY_INSTANCE_INITIALIZER; | 187   static base::LazyInstance<Setup>::Leaky setup = LAZY_INSTANCE_INITIALIZER; | 
| 187   setup.Get(); | 188   setup.Get(); | 
| 188 } | 189 } | 
| 189 | 190 | 
| 190 bool Context::Init() { | 191 bool Context::Init() { | 
| 191   TRACE_EVENT0("mojo_shell", "Context::Init"); | 192   TRACE_EVENT0("mojo_shell", "Context::Init"); | 
| 192   const base::CommandLine& command_line = | 193   const base::CommandLine& command_line = | 
| 193       *base::CommandLine::ForCurrentProcess(); | 194       *base::CommandLine::ForCurrentProcess(); | 
| 194 | 195 | 
|  | 196   // ICU data is a thing every part of the system needs. This here warms | 
|  | 197   // up the copy of ICU in the mojo runner. | 
|  | 198   base::i18n::InitializeICU(); | 
|  | 199 | 
| 195   EnsureEmbedderIsInitialized(); | 200   EnsureEmbedderIsInitialized(); | 
| 196   task_runners_.reset( | 201   task_runners_.reset( | 
| 197       new TaskRunners(base::MessageLoop::current()->task_runner())); | 202       new TaskRunners(base::MessageLoop::current()->task_runner())); | 
| 198 | 203 | 
| 199   // TODO(vtl): This should be MASTER, not NONE. | 204   // TODO(vtl): This should be MASTER, not NONE. | 
| 200   embedder::InitIPCSupport( | 205   embedder::InitIPCSupport( | 
| 201       embedder::ProcessType::NONE, task_runners_->shell_runner(), this, | 206       embedder::ProcessType::NONE, task_runners_->shell_runner(), this, | 
| 202       task_runners_->io_runner(), embedder::ScopedPlatformHandle()); | 207       task_runners_->io_runner(), embedder::ScopedPlatformHandle()); | 
| 203 | 208 | 
| 204   package_manager_ = new package_manager::PackageManagerImpl( | 209   package_manager_ = new package_manager::PackageManagerImpl( | 
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 322         base::MessageLoop::current()->QuitWhenIdle(); | 327         base::MessageLoop::current()->QuitWhenIdle(); | 
| 323       } else { | 328       } else { | 
| 324         app_complete_callback_.Run(); | 329         app_complete_callback_.Run(); | 
| 325       } | 330       } | 
| 326     } | 331     } | 
| 327   } | 332   } | 
| 328 } | 333 } | 
| 329 | 334 | 
| 330 }  // namespace runner | 335 }  // namespace runner | 
| 331 }  // namespace mojo | 336 }  // namespace mojo | 
| OLD | NEW | 
|---|