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 "services/shell/runner/host/child_process_base.h" | 5 #include "services/shell/runner/host/child_process_base.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 std::unique_ptr<LinuxSandbox> sandbox(new LinuxSandbox(permissions)); | 50 std::unique_ptr<LinuxSandbox> sandbox(new LinuxSandbox(permissions)); |
51 sandbox->Warmup(); | 51 sandbox->Warmup(); |
52 sandbox->EngageNamespaceSandbox(); | 52 sandbox->EngageNamespaceSandbox(); |
53 sandbox->EngageSeccompSandbox(); | 53 sandbox->EngageSeccompSandbox(); |
54 sandbox->Seal(); | 54 sandbox->Seal(); |
55 return sandbox; | 55 return sandbox; |
56 } | 56 } |
57 #endif | 57 #endif |
58 | 58 |
59 // Should be created and initialized on the main thread and kept alive as long | 59 // Should be created and initialized on the main thread and kept alive as long |
60 // a Mojo application is running in the current process. | 60 // a Service is running in the current process. |
61 class ScopedAppContext : public mojo::edk::ProcessDelegate { | 61 class ScopedAppContext : public mojo::edk::ProcessDelegate { |
62 public: | 62 public: |
63 ScopedAppContext() | 63 ScopedAppContext() |
64 : io_thread_("io_thread"), | 64 : io_thread_("io_thread"), |
65 wait_for_shutdown_event_( | 65 wait_for_shutdown_event_( |
66 base::WaitableEvent::ResetPolicy::MANUAL, | 66 base::WaitableEvent::ResetPolicy::MANUAL, |
67 base::WaitableEvent::InitialState::NOT_SIGNALED) { | 67 base::WaitableEvent::InitialState::NOT_SIGNALED) { |
68 // Initialize Mojo before starting any threads. | 68 // Initialize Mojo before starting any threads. |
69 mojo::edk::Init(); | 69 mojo::edk::Init(); |
70 | 70 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 *base::CommandLine::ForCurrentProcess(); | 119 *base::CommandLine::ForCurrentProcess(); |
120 if (command_line.HasSwitch(switches::kEnableSandbox)) | 120 if (command_line.HasSwitch(switches::kEnableSandbox)) |
121 sandbox = InitializeSandbox(); | 121 sandbox = InitializeSandbox(); |
122 #endif | 122 #endif |
123 | 123 |
124 ScopedAppContext app_context; | 124 ScopedAppContext app_context; |
125 callback.Run(GetServiceRequestFromCommandLine()); | 125 callback.Run(GetServiceRequestFromCommandLine()); |
126 } | 126 } |
127 | 127 |
128 } // namespace shell | 128 } // namespace shell |
OLD | NEW |