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

Side by Side Diff: content/browser/gpu/browser_gpu_channel_host_factory.cc

Issue 1827123002: Move content/common/gpu/client to gpu/ipc/client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 8 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 (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/browser/gpu/browser_gpu_channel_host_factory.h" 5 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 scoped_ptr<base::SharedMemory> shm(new base::SharedMemory()); 273 scoped_ptr<base::SharedMemory> shm(new base::SharedMemory());
274 if (!shm->CreateAnonymous(size)) 274 if (!shm->CreateAnonymous(size))
275 return scoped_ptr<base::SharedMemory>(); 275 return scoped_ptr<base::SharedMemory>();
276 return shm; 276 return shm;
277 } 277 }
278 278
279 // Blocking the UI thread to open a GPU channel is not supported on Android. 279 // Blocking the UI thread to open a GPU channel is not supported on Android.
280 // (Opening the initial channel to a child process involves handling a reply 280 // (Opening the initial channel to a child process involves handling a reply
281 // task on the UI thread first, so we cannot block here.) 281 // task on the UI thread first, so we cannot block here.)
282 #if !defined(OS_ANDROID) 282 #if !defined(OS_ANDROID)
283 GpuChannelHost* BrowserGpuChannelHostFactory::EstablishGpuChannelSync( 283 gpu::GpuChannelHost* BrowserGpuChannelHostFactory::EstablishGpuChannelSync(
284 CauseForGpuLaunch cause_for_gpu_launch) { 284 CauseForGpuLaunch cause_for_gpu_launch) {
285 EstablishGpuChannel(cause_for_gpu_launch, base::Closure()); 285 EstablishGpuChannel(cause_for_gpu_launch, base::Closure());
286 286
287 if (pending_request_.get()) 287 if (pending_request_.get())
288 pending_request_->Wait(); 288 pending_request_->Wait();
289 289
290 return gpu_channel_.get(); 290 return gpu_channel_.get();
291 } 291 }
292 #endif 292 #endif
293 293
(...skipping 16 matching lines...) Expand all
310 } 310 }
311 311
312 if (!callback.is_null()) { 312 if (!callback.is_null()) {
313 if (gpu_channel_.get()) 313 if (gpu_channel_.get())
314 callback.Run(); 314 callback.Run();
315 else 315 else
316 established_callbacks_.push_back(callback); 316 established_callbacks_.push_back(callback);
317 } 317 }
318 } 318 }
319 319
320 GpuChannelHost* BrowserGpuChannelHostFactory::GetGpuChannel() { 320 gpu::GpuChannelHost* BrowserGpuChannelHostFactory::GetGpuChannel() {
321 if (gpu_channel_.get() && !gpu_channel_->IsLost()) 321 if (gpu_channel_.get() && !gpu_channel_->IsLost())
322 return gpu_channel_.get(); 322 return gpu_channel_.get();
323 323
324 return NULL; 324 return NULL;
325 } 325 }
326 326
327 void BrowserGpuChannelHostFactory::GpuChannelEstablished() { 327 void BrowserGpuChannelHostFactory::GpuChannelEstablished() {
328 DCHECK(IsMainThread()); 328 DCHECK(IsMainThread());
329 DCHECK(pending_request_.get()); 329 DCHECK(pending_request_.get());
330 if (pending_request_->channel_handle().name.empty()) { 330 if (pending_request_->channel_handle().name.empty()) {
331 DCHECK(!gpu_channel_.get()); 331 DCHECK(!gpu_channel_.get());
332 } else { 332 } else {
333 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/466866 333 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/466866
334 // is fixed. 334 // is fixed.
335 tracked_objects::ScopedTracker tracking_profile1( 335 tracked_objects::ScopedTracker tracking_profile1(
336 FROM_HERE_WITH_EXPLICIT_FUNCTION( 336 FROM_HERE_WITH_EXPLICIT_FUNCTION(
337 "466866 BrowserGpuChannelHostFactory::GpuChannelEstablished1")); 337 "466866 BrowserGpuChannelHostFactory::GpuChannelEstablished1"));
338 GetContentClient()->SetGpuInfo(pending_request_->gpu_info()); 338 GetContentClient()->SetGpuInfo(pending_request_->gpu_info());
339 gpu_channel_ = GpuChannelHost::Create( 339 gpu_channel_ = gpu::GpuChannelHost::Create(
340 this, gpu_client_id_, pending_request_->gpu_info(), 340 this, gpu_client_id_, pending_request_->gpu_info(),
341 pending_request_->channel_handle(), shutdown_event_.get(), 341 pending_request_->channel_handle(), shutdown_event_.get(),
342 gpu_memory_buffer_manager_.get()); 342 gpu_memory_buffer_manager_.get());
343 } 343 }
344 gpu_host_id_ = pending_request_->gpu_host_id(); 344 gpu_host_id_ = pending_request_->gpu_host_id();
345 pending_request_ = NULL; 345 pending_request_ = NULL;
346 346
347 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/466866 is 347 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/466866 is
348 // fixed. 348 // fixed.
349 tracked_objects::ScopedTracker tracking_profile2( 349 tracked_objects::ScopedTracker tracking_profile2(
(...skipping 18 matching lines...) Expand all
368 } 368 }
369 369
370 // static 370 // static
371 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO( 371 void BrowserGpuChannelHostFactory::InitializeShaderDiskCacheOnIO(
372 int gpu_client_id, 372 int gpu_client_id,
373 const base::FilePath& cache_dir) { 373 const base::FilePath& cache_dir) {
374 ShaderCacheFactory::GetInstance()->SetCacheInfo(gpu_client_id, cache_dir); 374 ShaderCacheFactory::GetInstance()->SetCacheInfo(gpu_client_id, cache_dir);
375 } 375 }
376 376
377 } // namespace content 377 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/browser_gpu_channel_host_factory.h ('k') | content/browser/gpu/browser_gpu_memory_buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698