OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/host/child_process.h" | 5 #include "mojo/runner/host/child_process.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 354 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
355 scoped_ptr<mojo::runner::LinuxSandbox> sandbox; | 355 scoped_ptr<mojo::runner::LinuxSandbox> sandbox; |
356 #endif | 356 #endif |
357 base::NativeLibrary app_library = 0; | 357 base::NativeLibrary app_library = 0; |
358 // Load the application library before we engage the sandbox. | 358 // Load the application library before we engage the sandbox. |
359 app_library = mojo::runner::LoadNativeApplication( | 359 app_library = mojo::runner::LoadNativeApplication( |
360 command_line.GetSwitchValuePath(switches::kChildProcess)); | 360 command_line.GetSwitchValuePath(switches::kChildProcess)); |
361 base::i18n::InitializeICU(); | 361 base::i18n::InitializeICU(); |
362 if (app_library) | 362 if (app_library) |
363 CallLibraryEarlyInitialization(app_library); | 363 CallLibraryEarlyInitialization(app_library); |
| 364 #if !defined(OFFICIAL_BUILD) |
| 365 // Initialize stack dumping just before initializing sandbox to make |
| 366 // sure symbol names in all loaded libraries will be cached. |
| 367 base::debug::EnableInProcessStackDumping(); |
| 368 #endif |
364 #if defined(OS_LINUX) && !defined(OS_ANDROID) | 369 #if defined(OS_LINUX) && !defined(OS_ANDROID) |
365 if (command_line.HasSwitch(switches::kEnableSandbox)) { | 370 if (command_line.HasSwitch(switches::kEnableSandbox)) |
366 #if !defined(OFFICIAL_BUILD) | |
367 // Initialize stack dumping just before initializing sandbox to make | |
368 // sure symbol names in all loaded libraries will be cached. | |
369 base::debug::EnableInProcessStackDumping(); | |
370 #endif | |
371 sandbox = InitializeSandbox(); | 371 sandbox = InitializeSandbox(); |
372 } | |
373 #endif | 372 #endif |
374 | 373 |
375 embedder::ScopedPlatformHandle platform_channel = | 374 embedder::ScopedPlatformHandle platform_channel = |
376 embedder::PlatformChannelPair::PassClientHandleFromParentProcess( | 375 embedder::PlatformChannelPair::PassClientHandleFromParentProcess( |
377 command_line); | 376 command_line); |
378 CHECK(platform_channel.is_valid()); | 377 CHECK(platform_channel.is_valid()); |
379 | 378 |
380 DCHECK(!base::MessageLoop::current()); | 379 DCHECK(!base::MessageLoop::current()); |
381 | 380 |
382 AppContext app_context; | 381 AppContext app_context; |
(...skipping 10 matching lines...) Expand all Loading... |
393 // This will block, then run whatever the controller wants. | 392 // This will block, then run whatever the controller wants. |
394 blocker.Block(); | 393 blocker.Block(); |
395 | 394 |
396 app_context.Shutdown(); | 395 app_context.Shutdown(); |
397 | 396 |
398 return 0; | 397 return 0; |
399 } | 398 } |
400 | 399 |
401 } // namespace runner | 400 } // namespace runner |
402 } // namespace mojo | 401 } // namespace mojo |
OLD | NEW |