OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "services/service_manager/embedder/main.h" | 5 #include "services/service_manager/embedder/main.h" |
6 | 6 |
7 #include "base/allocator/features.h" | 7 #include "base/allocator/features.h" |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 &background_service_manager); | 259 &background_service_manager); |
260 run_loop.Run(); | 260 run_loop.Run(); |
261 | 261 |
262 ipc_thread.Stop(); | 262 ipc_thread.Stop(); |
263 base::TaskScheduler::GetInstance()->Shutdown(); | 263 base::TaskScheduler::GetInstance()->Shutdown(); |
264 | 264 |
265 return exit_code; | 265 return exit_code; |
266 } | 266 } |
267 | 267 |
268 void InitializeResources() { | 268 void InitializeResources() { |
269 ui::RegisterPathProvider(); | |
270 const std::string locale = | 269 const std::string locale = |
271 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 270 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
272 ::switches::kLang); | 271 ::switches::kLang); |
273 // This loads the embedder's common resources (e.g. chrome_100_percent.pak for | 272 // This loads the embedder's common resources (e.g. chrome_100_percent.pak for |
274 // Chrome.) | 273 // Chrome.) |
275 ui::ResourceBundle::InitSharedInstanceWithLocale( | 274 ui::ResourceBundle::InitSharedInstanceWithLocale( |
276 locale, nullptr, ui::ResourceBundle::LOAD_COMMON_RESOURCES); | 275 locale, nullptr, ui::ResourceBundle::LOAD_COMMON_RESOURCES); |
277 } | 276 } |
278 | 277 |
279 int RunService(MainDelegate* delegate) { | 278 int RunService(MainDelegate* delegate) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 // event loop to get rid of the cruft. | 384 // event loop to get rid of the cruft. |
386 std::unique_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool = | 385 std::unique_ptr<base::mac::ScopedNSAutoreleasePool> autorelease_pool = |
387 base::MakeUnique<base::mac::ScopedNSAutoreleasePool>(); | 386 base::MakeUnique<base::mac::ScopedNSAutoreleasePool>(); |
388 init_params.autorelease_pool = autorelease_pool.get(); | 387 init_params.autorelease_pool = autorelease_pool.get(); |
389 InitializeMac(); | 388 InitializeMac(); |
390 #endif | 389 #endif |
391 | 390 |
392 mojo::edk::SetMaxMessageSize(kMaximumMojoMessageSize); | 391 mojo::edk::SetMaxMessageSize(kMaximumMojoMessageSize); |
393 mojo::edk::Init(); | 392 mojo::edk::Init(); |
394 | 393 |
| 394 ui::RegisterPathProvider(); |
| 395 |
395 base::debug::GlobalActivityTracker* tracker = | 396 base::debug::GlobalActivityTracker* tracker = |
396 base::debug::GlobalActivityTracker::Get(); | 397 base::debug::GlobalActivityTracker::Get(); |
397 int exit_code = delegate->Initialize(init_params); | 398 int exit_code = delegate->Initialize(init_params); |
398 if (exit_code >= 0) { | 399 if (exit_code >= 0) { |
399 if (tracker) { | 400 if (tracker) { |
400 tracker->SetProcessPhase( | 401 tracker->SetProcessPhase( |
401 base::debug::GlobalActivityTracker::PROCESS_LAUNCH_FAILED); | 402 base::debug::GlobalActivityTracker::PROCESS_LAUNCH_FAILED); |
402 tracker->process_data().SetInt("exit-code", exit_code); | 403 tracker->process_data().SetInt("exit-code", exit_code); |
403 } | 404 } |
404 return exit_code; | 405 return exit_code; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 autorelease_pool.reset(); | 466 autorelease_pool.reset(); |
466 #endif | 467 #endif |
467 | 468 |
468 if (process_type == ProcessType::kEmbedder) | 469 if (process_type == ProcessType::kEmbedder) |
469 delegate->ShutDownEmbedderProcess(); | 470 delegate->ShutDownEmbedderProcess(); |
470 | 471 |
471 return exit_code; | 472 return exit_code; |
472 } | 473 } |
473 | 474 |
474 } // namespace service_manager | 475 } // namespace service_manager |
OLD | NEW |