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

Side by Side Diff: content/gpu/gpu_child_thread.cc

Issue 2322893002: gpu: Remove unused GpuChildThread::gpu_preferences_. (Closed)
Patch Set: . Created 4 years, 3 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/gpu/gpu_child_thread.h ('k') | content/gpu/in_process_gpu_thread.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gpu/gpu_child_thread.h" 5 #include "content/gpu/gpu_child_thread.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 in_browser_process_(false), 155 in_browser_process_(false),
156 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { 156 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) {
157 watchdog_thread_ = watchdog_thread; 157 watchdog_thread_ = watchdog_thread;
158 #if defined(OS_WIN) 158 #if defined(OS_WIN)
159 target_services_ = NULL; 159 target_services_ = NULL;
160 #endif 160 #endif
161 g_thread_safe_sender.Get() = thread_safe_sender(); 161 g_thread_safe_sender.Get() = thread_safe_sender();
162 } 162 }
163 163
164 GpuChildThread::GpuChildThread( 164 GpuChildThread::GpuChildThread(
165 const gpu::GpuPreferences& gpu_preferences,
166 const InProcessChildThreadParams& params, 165 const InProcessChildThreadParams& params,
167 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory) 166 gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory)
168 : ChildThreadImpl(ChildThreadImpl::Options::Builder() 167 : ChildThreadImpl(ChildThreadImpl::Options::Builder()
169 .InBrowserProcess(params) 168 .InBrowserProcess(params)
170 .UseMojoChannel(true) 169 .UseMojoChannel(true)
171 .AddStartupFilter(new GpuMemoryBufferMessageFilter( 170 .AddStartupFilter(new GpuMemoryBufferMessageFilter(
172 gpu_memory_buffer_factory)) 171 gpu_memory_buffer_factory))
173 .ConnectToBrowser(true) 172 .ConnectToBrowser(true)
174 .Build()), 173 .Build()),
175 gpu_preferences_(gpu_preferences),
176 dead_on_arrival_(false), 174 dead_on_arrival_(false),
177 in_browser_process_(true), 175 in_browser_process_(true),
178 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) { 176 gpu_memory_buffer_factory_(gpu_memory_buffer_factory) {
179 #if defined(OS_WIN) 177 #if defined(OS_WIN)
180 target_services_ = NULL; 178 target_services_ = NULL;
181 #endif 179 #endif
182 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( 180 DCHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
183 switches::kSingleProcess) || 181 switches::kSingleProcess) ||
184 base::CommandLine::ForCurrentProcess()->HasSwitch( 182 base::CommandLine::ForCurrentProcess()->HasSwitch(
185 switches::kInProcessGPU)); 183 switches::kInProcessGPU));
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 } 308 }
311 #endif 309 #endif
312 310
313 void GpuChildThread::StoreShaderToDisk(int32_t client_id, 311 void GpuChildThread::StoreShaderToDisk(int32_t client_id,
314 const std::string& key, 312 const std::string& key,
315 const std::string& shader) { 313 const std::string& shader) {
316 Send(new GpuHostMsg_CacheShader(client_id, key, shader)); 314 Send(new GpuHostMsg_CacheShader(client_id, key, shader));
317 } 315 }
318 316
319 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) { 317 void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) {
320 gpu_preferences_ = gpu_preferences;
321
322 gpu_info_.video_decode_accelerator_capabilities = 318 gpu_info_.video_decode_accelerator_capabilities =
323 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_); 319 media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences);
324 gpu_info_.video_encode_accelerator_supported_profiles = 320 gpu_info_.video_encode_accelerator_supported_profiles =
325 media::GpuVideoEncodeAccelerator::GetSupportedProfiles( 321 media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences);
326 gpu_preferences_);
327 gpu_info_.jpeg_decode_accelerator_supported = 322 gpu_info_.jpeg_decode_accelerator_supported =
328 media::GpuJpegDecodeAccelerator::IsSupported(); 323 media::GpuJpegDecodeAccelerator::IsSupported();
329 324
330 // Record initialization only after collecting the GPU info because that can 325 // Record initialization only after collecting the GPU info because that can
331 // take a significant amount of time. 326 // take a significant amount of time.
332 gpu_info_.initialization_time = base::Time::Now() - process_start_time_; 327 gpu_info_.initialization_time = base::Time::Now() - process_start_time_;
333 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_)); 328 Send(new GpuHostMsg_Initialized(!dead_on_arrival_, gpu_info_));
334 while (!deferred_messages_.empty()) { 329 while (!deferred_messages_.empty()) {
335 Send(deferred_messages_.front()); 330 Send(deferred_messages_.front());
336 deferred_messages_.pop(); 331 deferred_messages_.pop();
(...skipping 17 matching lines...) Expand all
354 if (!sync_point_manager) { 349 if (!sync_point_manager) {
355 if (!owned_sync_point_manager_) { 350 if (!owned_sync_point_manager_) {
356 owned_sync_point_manager_.reset(new gpu::SyncPointManager(false)); 351 owned_sync_point_manager_.reset(new gpu::SyncPointManager(false));
357 } 352 }
358 sync_point_manager = owned_sync_point_manager_.get(); 353 sync_point_manager = owned_sync_point_manager_.get();
359 } 354 }
360 355
361 // Defer creation of the render thread. This is to prevent it from handling 356 // Defer creation of the render thread. This is to prevent it from handling
362 // IPC messages before the sandbox has been enabled and all other necessary 357 // IPC messages before the sandbox has been enabled and all other necessary
363 // initialization has succeeded. 358 // initialization has succeeded.
364 gpu_channel_manager_.reset( 359 gpu_channel_manager_.reset(new gpu::GpuChannelManager(
365 new gpu::GpuChannelManager(gpu_preferences_, this, watchdog_thread_.get(), 360 gpu_preferences, this, watchdog_thread_.get(),
366 base::ThreadTaskRunnerHandle::Get().get(), 361 base::ThreadTaskRunnerHandle::Get().get(),
367 ChildProcess::current()->io_task_runner(), 362 ChildProcess::current()->io_task_runner(),
368 ChildProcess::current()->GetShutDownEvent(), 363 ChildProcess::current()->GetShutDownEvent(), sync_point_manager,
369 sync_point_manager, gpu_memory_buffer_factory_)); 364 gpu_memory_buffer_factory_));
370 365
371 media_service_.reset(new media::MediaService(gpu_channel_manager_.get())); 366 media_service_.reset(new media::MediaService(gpu_channel_manager_.get()));
372 367
373 // Only set once per process instance. 368 // Only set once per process instance.
374 service_factory_.reset(new GpuServiceFactory); 369 service_factory_.reset(new GpuServiceFactory);
375 370
376 GetInterfaceRegistry()->AddInterface(base::Bind( 371 GetInterfaceRegistry()->AddInterface(base::Bind(
377 &GpuChildThread::BindServiceFactoryRequest, base::Unretained(this))); 372 &GpuChildThread::BindServiceFactoryRequest, base::Unretained(this)));
378 373
379 if (GetContentClient()->gpu()) { // NULL in tests. 374 if (GetContentClient()->gpu()) { // NULL in tests.
380 GetContentClient()->gpu()->ExposeInterfacesToBrowser( 375 GetContentClient()->gpu()->ExposeInterfacesToBrowser(GetInterfaceRegistry(),
381 GetInterfaceRegistry(), gpu_preferences_); 376 gpu_preferences);
382 GetContentClient()->gpu()->ConsumeInterfacesFromBrowser( 377 GetContentClient()->gpu()->ConsumeInterfacesFromBrowser(
383 GetRemoteInterfaces()); 378 GetRemoteInterfaces());
384 } 379 }
385 380
386 GetInterfaceRegistry()->ResumeBinding(); 381 GetInterfaceRegistry()->ResumeBinding();
387 } 382 }
388 383
389 void GpuChildThread::OnFinalize() { 384 void GpuChildThread::OnFinalize() {
390 // Quit the GPU process 385 // Quit the GPU process
391 base::MessageLoop::current()->QuitWhenIdle(); 386 base::MessageLoop::current()->QuitWhenIdle();
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 548
554 void GpuChildThread::BindServiceFactoryRequest( 549 void GpuChildThread::BindServiceFactoryRequest(
555 shell::mojom::ServiceFactoryRequest request) { 550 shell::mojom::ServiceFactoryRequest request) {
556 DVLOG(1) << "GPU: Binding shell::mojom::ServiceFactoryRequest"; 551 DVLOG(1) << "GPU: Binding shell::mojom::ServiceFactoryRequest";
557 DCHECK(service_factory_); 552 DCHECK(service_factory_);
558 service_factory_bindings_.AddBinding(service_factory_.get(), 553 service_factory_bindings_.AddBinding(service_factory_.get(),
559 std::move(request)); 554 std::move(request));
560 } 555 }
561 556
562 } // namespace content 557 } // namespace content
OLDNEW
« no previous file with comments | « content/gpu/gpu_child_thread.h ('k') | content/gpu/in_process_gpu_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698