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

Side by Side Diff: content/public/browser/gpu_utils.cc

Issue 2723363002: gpu: Replace GpuMsg_Finalize ipc with equivalent mojom api (Closed)
Patch Set: . Created 3 years, 9 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 | « content/public/browser/gpu_utils.h ('k') | services/ui/gpu/gpu_service.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "content/public/browser/gpu_utils.h" 5 #include "content/public/browser/gpu_utils.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/single_thread_task_runner.h"
8 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "content/browser/gpu/gpu_process_host.h"
9 #include "content/public/common/content_features.h" 11 #include "content/public/common/content_features.h"
10 #include "content/public/common/content_switches.h" 12 #include "content/public/common/content_switches.h"
11 #include "gpu/command_buffer/service/gpu_switches.h" 13 #include "gpu/command_buffer/service/gpu_switches.h"
12 #include "gpu/config/gpu_switches.h" 14 #include "gpu/config/gpu_switches.h"
13 #include "media/media_features.h" 15 #include "media/media_features.h"
14 #include "ui/gl/gl_switches.h" 16 #include "ui/gl/gl_switches.h"
15 17
16 namespace { 18 namespace {
17 19
18 bool GetUintFromSwitch(const base::CommandLine* command_line, 20 bool GetUintFromSwitch(const base::CommandLine* command_line,
19 const base::StringPiece& switch_string, 21 const base::StringPiece& switch_string,
20 uint32_t* value) { 22 uint32_t* value) {
21 if (!command_line->HasSwitch(switch_string)) 23 if (!command_line->HasSwitch(switch_string))
22 return false; 24 return false;
23 std::string switch_value(command_line->GetSwitchValueASCII(switch_string)); 25 std::string switch_value(command_line->GetSwitchValueASCII(switch_string));
24 return base::StringToUint(switch_value, value); 26 return base::StringToUint(switch_value, value);
25 } 27 }
26 28
29 void RunTaskOnTaskRunner(
30 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
31 const base::Closure& callback) {
32 task_runner->PostTask(FROM_HERE, callback);
33 }
34
35 void StopGpuProcessImpl(const base::Closure& callback,
36 content::GpuProcessHost* host) {
37 if (host)
38 host->gpu_service()->Stop(callback);
39 else
40 callback.Run();
41 }
42
27 } // namespace 43 } // namespace
28 44
29 namespace content { 45 namespace content {
30 46
31 const gpu::GpuPreferences GetGpuPreferencesFromCommandLine() { 47 const gpu::GpuPreferences GetGpuPreferencesFromCommandLine() {
32 DCHECK(base::CommandLine::InitializedForCurrentProcess()); 48 DCHECK(base::CommandLine::InitializedForCurrentProcess());
33 const base::CommandLine* command_line = 49 const base::CommandLine* command_line =
34 base::CommandLine::ForCurrentProcess(); 50 base::CommandLine::ForCurrentProcess();
35 gpu::GpuPreferences gpu_preferences; 51 gpu::GpuPreferences gpu_preferences;
36 gpu_preferences.single_process = 52 gpu_preferences.single_process =
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 command_line->HasSwitch(switches::kEnableGPUServiceLogging); 125 command_line->HasSwitch(switches::kEnableGPUServiceLogging);
110 gpu_preferences.enable_gpu_service_tracing = 126 gpu_preferences.enable_gpu_service_tracing =
111 command_line->HasSwitch(switches::kEnableGPUServiceTracing); 127 command_line->HasSwitch(switches::kEnableGPUServiceTracing);
112 gpu_preferences.use_passthrough_cmd_decoder = 128 gpu_preferences.use_passthrough_cmd_decoder =
113 command_line->HasSwitch(switches::kUsePassthroughCmdDecoder); 129 command_line->HasSwitch(switches::kUsePassthroughCmdDecoder);
114 // Some of these preferences are set or adjusted in 130 // Some of these preferences are set or adjusted in
115 // GpuDataManagerImplPrivate::AppendGpuCommandLine. 131 // GpuDataManagerImplPrivate::AppendGpuCommandLine.
116 return gpu_preferences; 132 return gpu_preferences;
117 } 133 }
118 134
135 void StopGpuProcess(const base::Closure& callback) {
136 content::GpuProcessHost::CallOnIO(
137 content::GpuProcessHost::GPU_PROCESS_KIND_SANDBOXED,
138 false /* force_create */,
139 base::Bind(&StopGpuProcessImpl,
140 base::Bind(RunTaskOnTaskRunner,
141 base::ThreadTaskRunnerHandle::Get(), callback)));
142 }
143
119 } // namespace content 144 } // namespace content
OLDNEW
« no previous file with comments | « content/public/browser/gpu_utils.h ('k') | services/ui/gpu/gpu_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698