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

Side by Side Diff: headless/lib/headless_content_main_delegate.cc

Issue 2184763002: headless: Enable GL support by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 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"
11 #include "content/public/browser/browser_main_runner.h" 11 #include "content/public/browser/browser_main_runner.h"
12 #include "content/public/common/content_switches.h" 12 #include "content/public/common/content_switches.h"
13 #include "headless/lib/browser/headless_browser_impl.h" 13 #include "headless/lib/browser/headless_browser_impl.h"
14 #include "headless/lib/browser/headless_content_browser_client.h" 14 #include "headless/lib/browser/headless_content_browser_client.h"
15 #include "headless/lib/renderer/headless_content_renderer_client.h" 15 #include "headless/lib/renderer/headless_content_renderer_client.h"
16 #include "headless/lib/utility/headless_content_utility_client.h" 16 #include "headless/lib/utility/headless_content_utility_client.h"
17 #include "ui/base/resource/resource_bundle.h" 17 #include "ui/base/resource/resource_bundle.h"
18 #include "ui/gl/gl_switches.h"
18 #include "ui/ozone/public/ozone_switches.h" 19 #include "ui/ozone/public/ozone_switches.h"
19 20
20 namespace headless { 21 namespace headless {
21 namespace { 22 namespace {
22 // Keep in sync with content/common/content_constants_internal.h. 23 // Keep in sync with content/common/content_constants_internal.h.
23 // TODO(skyostil): Add a tracing test for this. 24 // TODO(skyostil): Add a tracing test for this.
24 const int kTraceEventBrowserProcessSortIndex = -6; 25 const int kTraceEventBrowserProcessSortIndex = -6;
25 26
26 HeadlessContentMainDelegate* g_current_headless_content_main_delegate = nullptr; 27 HeadlessContentMainDelegate* g_current_headless_content_main_delegate = nullptr;
27 } // namespace 28 } // namespace
(...skipping 13 matching lines...) Expand all
41 bool HeadlessContentMainDelegate::BasicStartupComplete(int* exit_code) { 42 bool HeadlessContentMainDelegate::BasicStartupComplete(int* exit_code) {
42 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 43 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
43 44
44 if (browser_->options()->single_process_mode) 45 if (browser_->options()->single_process_mode)
45 command_line->AppendSwitch(switches::kSingleProcess); 46 command_line->AppendSwitch(switches::kSingleProcess);
46 47
47 // The headless backend is automatically chosen for a headless build, but also 48 // 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. 49 // adding it here allows us to run in a non-headless build too.
49 command_line->AppendSwitchASCII(switches::kOzonePlatform, "headless"); 50 command_line->AppendSwitchASCII(switches::kOzonePlatform, "headless");
50 51
51 // TODO(skyostil): Investigate using Mesa/SwiftShader for output. 52 if (!browser_->options()->gl_implementation.empty()) {
52 command_line->AppendSwitch(switches::kDisableGpu); 53 command_line->AppendSwitchASCII(switches::kUseGL,
54 browser_->options()->gl_implementation);
55 } else {
56 command_line->AppendSwitch(switches::kDisableGpu);
57 }
53 58
54 SetContentClient(&content_client_); 59 SetContentClient(&content_client_);
55 return false; 60 return false;
56 } 61 }
57 62
58 void HeadlessContentMainDelegate::PreSandboxStartup() { 63 void HeadlessContentMainDelegate::PreSandboxStartup() {
59 InitializeResourceBundle(); 64 InitializeResourceBundle();
60 } 65 }
61 66
62 int HeadlessContentMainDelegate::RunProcess( 67 int HeadlessContentMainDelegate::RunProcess(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return renderer_client_.get(); 120 return renderer_client_.get();
116 } 121 }
117 122
118 content::ContentUtilityClient* 123 content::ContentUtilityClient*
119 HeadlessContentMainDelegate::CreateContentUtilityClient() { 124 HeadlessContentMainDelegate::CreateContentUtilityClient() {
120 utility_client_.reset(new HeadlessContentUtilityClient); 125 utility_client_.reset(new HeadlessContentUtilityClient);
121 return utility_client_.get(); 126 return utility_client_.get();
122 } 127 }
123 128
124 } // namespace headless 129 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698