OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "headless/lib/headless_content_main_delegate.h" | 5 #include "headless/lib/headless_content_main_delegate.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 DCHECK(g_current_headless_content_main_delegate == this); | 37 DCHECK(g_current_headless_content_main_delegate == this); |
38 g_current_headless_content_main_delegate = nullptr; | 38 g_current_headless_content_main_delegate = nullptr; |
39 } | 39 } |
40 | 40 |
41 bool HeadlessContentMainDelegate::BasicStartupComplete(int* exit_code) { | 41 bool HeadlessContentMainDelegate::BasicStartupComplete(int* exit_code) { |
42 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 42 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
43 | 43 |
44 if (browser_->options()->single_process_mode) | 44 if (browser_->options()->single_process_mode) |
45 command_line->AppendSwitch(switches::kSingleProcess); | 45 command_line->AppendSwitch(switches::kSingleProcess); |
46 | 46 |
| 47 if (browser_->options()->disable_sandbox) |
| 48 command_line->AppendSwitch(switches::kNoSandbox); |
| 49 |
47 // The headless backend is automatically chosen for a headless build, but also | 50 // The headless backend is automatically chosen for a headless build, but also |
48 // adding it here allows us to run in a non-headless build too. | 51 // adding it here allows us to run in a non-headless build too. |
49 command_line->AppendSwitchASCII(switches::kOzonePlatform, "headless"); | 52 command_line->AppendSwitchASCII(switches::kOzonePlatform, "headless"); |
50 | 53 |
51 // TODO(skyostil): Investigate using Mesa/SwiftShader for output. | 54 // TODO(skyostil): Investigate using Mesa/SwiftShader for output. |
52 command_line->AppendSwitch(switches::kDisableGpu); | 55 command_line->AppendSwitch(switches::kDisableGpu); |
53 | 56 |
54 SetContentClient(&content_client_); | 57 SetContentClient(&content_client_); |
55 return false; | 58 return false; |
56 } | 59 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 return renderer_client_.get(); | 118 return renderer_client_.get(); |
116 } | 119 } |
117 | 120 |
118 content::ContentUtilityClient* | 121 content::ContentUtilityClient* |
119 HeadlessContentMainDelegate::CreateContentUtilityClient() { | 122 HeadlessContentMainDelegate::CreateContentUtilityClient() { |
120 utility_client_.reset(new HeadlessContentUtilityClient); | 123 utility_client_.reset(new HeadlessContentUtilityClient); |
121 return utility_client_.get(); | 124 return utility_client_.get(); |
122 } | 125 } |
123 | 126 |
124 } // namespace headless | 127 } // namespace headless |
OLD | NEW |