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

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: Rebased and reformatted 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
« no previous file with comments | « headless/lib/headless_browser_browsertest.cc ('k') | headless/public/headless_browser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16 matching lines...) Expand all
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 if (browser_->options()->disable_sandbox) 48 if (browser_->options()->disable_sandbox)
48 command_line->AppendSwitch(switches::kNoSandbox); 49 command_line->AppendSwitch(switches::kNoSandbox);
49 50
50 // The headless backend is automatically chosen for a headless build, but also 51 // The headless backend is automatically chosen for a headless build, but also
51 // adding it here allows us to run in a non-headless build too. 52 // adding it here allows us to run in a non-headless build too.
52 command_line->AppendSwitchASCII(switches::kOzonePlatform, "headless"); 53 command_line->AppendSwitchASCII(switches::kOzonePlatform, "headless");
53 54
54 // TODO(skyostil): Investigate using Mesa/SwiftShader for output. 55 if (!browser_->options()->gl_implementation.empty()) {
55 command_line->AppendSwitch(switches::kDisableGpu); 56 command_line->AppendSwitchASCII(switches::kUseGL,
57 browser_->options()->gl_implementation);
58 } else {
59 command_line->AppendSwitch(switches::kDisableGpu);
60 }
56 61
57 SetContentClient(&content_client_); 62 SetContentClient(&content_client_);
58 return false; 63 return false;
59 } 64 }
60 65
61 void HeadlessContentMainDelegate::PreSandboxStartup() { 66 void HeadlessContentMainDelegate::PreSandboxStartup() {
62 InitializeResourceBundle(); 67 InitializeResourceBundle();
63 } 68 }
64 69
65 int HeadlessContentMainDelegate::RunProcess( 70 int HeadlessContentMainDelegate::RunProcess(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 return renderer_client_.get(); 123 return renderer_client_.get();
119 } 124 }
120 125
121 content::ContentUtilityClient* 126 content::ContentUtilityClient*
122 HeadlessContentMainDelegate::CreateContentUtilityClient() { 127 HeadlessContentMainDelegate::CreateContentUtilityClient() {
123 utility_client_.reset(new HeadlessContentUtilityClient); 128 utility_client_.reset(new HeadlessContentUtilityClient);
124 return utility_client_.get(); 129 return utility_client_.get();
125 } 130 }
126 131
127 } // namespace headless 132 } // namespace headless
OLDNEW
« no previous file with comments | « headless/lib/headless_browser_browsertest.cc ('k') | headless/public/headless_browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698