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

Side by Side Diff: mojo/shell/standalone/context.cc

Issue 1676913002: [mojo] Delete third_party/mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 10 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 "mojo/shell/standalone/context.h" 5 #include "mojo/shell/standalone/context.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 10 matching lines...) Expand all
21 #include "base/process/process_info.h" 21 #include "base/process/process_info.h"
22 #include "base/run_loop.h" 22 #include "base/run_loop.h"
23 #include "base/strings/string_number_conversions.h" 23 #include "base/strings/string_number_conversions.h"
24 #include "base/strings/string_split.h" 24 #include "base/strings/string_split.h"
25 #include "base/strings/string_util.h" 25 #include "base/strings/string_util.h"
26 #include "base/trace_event/trace_event.h" 26 #include "base/trace_event/trace_event.h"
27 #include "build/build_config.h" 27 #include "build/build_config.h"
28 #include "components/devtools_service/public/cpp/switches.h" 28 #include "components/devtools_service/public/cpp/switches.h"
29 #include "components/devtools_service/public/interfaces/devtools_service.mojom.h " 29 #include "components/devtools_service/public/interfaces/devtools_service.mojom.h "
30 #include "components/tracing/tracing_switches.h" 30 #include "components/tracing/tracing_switches.h"
31 #include "mojo/edk/embedder/embedder.h"
31 #include "mojo/public/cpp/bindings/strong_binding.h" 32 #include "mojo/public/cpp/bindings/strong_binding.h"
32 #include "mojo/services/tracing/public/cpp/switches.h" 33 #include "mojo/services/tracing/public/cpp/switches.h"
33 #include "mojo/services/tracing/public/cpp/trace_provider_impl.h" 34 #include "mojo/services/tracing/public/cpp/trace_provider_impl.h"
34 #include "mojo/services/tracing/public/cpp/tracing_impl.h" 35 #include "mojo/services/tracing/public/cpp/tracing_impl.h"
35 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h" 36 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
36 #include "mojo/shell/application_loader.h" 37 #include "mojo/shell/application_loader.h"
37 #include "mojo/shell/connect_to_application_params.h" 38 #include "mojo/shell/connect_to_application_params.h"
38 #include "mojo/shell/package_manager/package_manager_impl.h" 39 #include "mojo/shell/package_manager/package_manager_impl.h"
39 #include "mojo/shell/query_util.h" 40 #include "mojo/shell/query_util.h"
40 #include "mojo/shell/runner/host/in_process_native_runner.h" 41 #include "mojo/shell/runner/host/in_process_native_runner.h"
41 #include "mojo/shell/runner/host/out_of_process_native_runner.h" 42 #include "mojo/shell/runner/host/out_of_process_native_runner.h"
42 #include "mojo/shell/standalone/register_local_aliases.h" 43 #include "mojo/shell/standalone/register_local_aliases.h"
43 #include "mojo/shell/standalone/switches.h" 44 #include "mojo/shell/standalone/switches.h"
44 #include "mojo/shell/standalone/tracer.h" 45 #include "mojo/shell/standalone/tracer.h"
45 #include "mojo/shell/switches.h" 46 #include "mojo/shell/switches.h"
46 #include "mojo/util/filename_util.h" 47 #include "mojo/util/filename_util.h"
47 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
48 #include "url/gurl.h" 48 #include "url/gurl.h"
49 49
50 namespace mojo { 50 namespace mojo {
51 namespace shell { 51 namespace shell {
52 namespace { 52 namespace {
53 53
54 // Used to ensure we only init once. 54 // Used to ensure we only init once.
55 class Setup { 55 class Setup {
56 public: 56 public:
57 Setup() { 57 Setup() { edk::Init(); }
58 embedder::PreInitializeParentProcess();
59 embedder::Init();
60 }
61 58
62 ~Setup() {} 59 ~Setup() {}
63 60
64 private: 61 private:
65 DISALLOW_COPY_AND_ASSIGN(Setup); 62 DISALLOW_COPY_AND_ASSIGN(Setup);
66 }; 63 };
67 64
68 void InitContentHandlers(PackageManagerImpl* manager, 65 void InitContentHandlers(PackageManagerImpl* manager,
69 const base::CommandLine& command_line) { 66 const base::CommandLine& command_line) {
70 // Default content handlers. 67 // Default content handlers.
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 198
202 // ICU data is a thing every part of the system needs. This here warms 199 // ICU data is a thing every part of the system needs. This here warms
203 // up the copy of ICU in the mojo runner. 200 // up the copy of ICU in the mojo runner.
204 CHECK(base::i18n::InitializeICU()); 201 CHECK(base::i18n::InitializeICU());
205 202
206 EnsureEmbedderIsInitialized(); 203 EnsureEmbedderIsInitialized();
207 task_runners_.reset( 204 task_runners_.reset(
208 new TaskRunners(base::MessageLoop::current()->task_runner())); 205 new TaskRunners(base::MessageLoop::current()->task_runner()));
209 206
210 // TODO(vtl): This should be MASTER, not NONE. 207 // TODO(vtl): This should be MASTER, not NONE.
211 embedder::InitIPCSupport(embedder::ProcessType::NONE, this, 208 edk::InitIPCSupport(this, task_runners_->io_runner());
212 task_runners_->io_runner(),
213 embedder::ScopedPlatformHandle());
214 209
215 package_manager_ = new PackageManagerImpl( 210 package_manager_ = new PackageManagerImpl(
216 shell_file_root, task_runners_->blocking_pool(), nullptr); 211 shell_file_root, task_runners_->blocking_pool(), nullptr);
217 InitContentHandlers(package_manager_, command_line); 212 InitContentHandlers(package_manager_, command_line);
218 213
219 RegisterLocalAliases(package_manager_); 214 RegisterLocalAliases(package_manager_);
220 215
221 scoped_ptr<NativeRunnerFactory> runner_factory; 216 scoped_ptr<NativeRunnerFactory> runner_factory;
222 if (command_line.HasSwitch(switches::kMojoSingleProcess)) { 217 if (command_line.HasSwitch(switches::kMojoSingleProcess)) {
223 #if defined(COMPONENT_BUILD) 218 #if defined(COMPONENT_BUILD)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 void Context::Shutdown() { 272 void Context::Shutdown() {
278 // Actions triggered by ApplicationManager's destructor may require a current 273 // Actions triggered by ApplicationManager's destructor may require a current
279 // message loop, so we should destruct it explicitly now as ~Context() occurs 274 // message loop, so we should destruct it explicitly now as ~Context() occurs
280 // post message loop shutdown. 275 // post message loop shutdown.
281 application_manager_.reset(); 276 application_manager_.reset();
282 277
283 TRACE_EVENT0("mojo_shell", "Context::Shutdown"); 278 TRACE_EVENT0("mojo_shell", "Context::Shutdown");
284 DCHECK_EQ(base::MessageLoop::current()->task_runner(), 279 DCHECK_EQ(base::MessageLoop::current()->task_runner(),
285 task_runners_->shell_runner()); 280 task_runners_->shell_runner());
286 // Post a task in case OnShutdownComplete is called synchronously. 281 // Post a task in case OnShutdownComplete is called synchronously.
287 base::MessageLoop::current()->PostTask( 282 base::MessageLoop::current()->PostTask(FROM_HERE,
288 FROM_HERE, base::Bind(embedder::ShutdownIPCSupport)); 283 base::Bind(edk::ShutdownIPCSupport));
289 // We'll quit when we get OnShutdownComplete(). 284 // We'll quit when we get OnShutdownComplete().
290 base::MessageLoop::current()->Run(); 285 base::MessageLoop::current()->Run();
291 } 286 }
292 287
293 void Context::OnShutdownComplete() { 288 void Context::OnShutdownComplete() {
294 DCHECK_EQ(base::MessageLoop::current()->task_runner(), 289 DCHECK_EQ(base::MessageLoop::current()->task_runner(),
295 task_runners_->shell_runner()); 290 task_runners_->shell_runner());
296 base::MessageLoop::current()->QuitWhenIdle(); 291 base::MessageLoop::current()->QuitWhenIdle();
297 } 292 }
298 293
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 base::MessageLoop::current()->QuitWhenIdle(); 333 base::MessageLoop::current()->QuitWhenIdle();
339 } else { 334 } else {
340 app_complete_callback_.Run(); 335 app_complete_callback_.Run();
341 } 336 }
342 } 337 }
343 } 338 }
344 } 339 }
345 340
346 } // namespace shell 341 } // namespace shell
347 } // namespace mojo 342 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698