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

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

Issue 2302733003: [wip] Kill GPU if the memory buffer cannot be used as advertised.
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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_memory_buffer_manager.h" 5 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 HandleCreateGpuMemoryBufferFromHandleOnIO, 250 HandleCreateGpuMemoryBufferFromHandleOnIO,
251 base::Unretained(this), // Safe as we wait for result below. 251 base::Unretained(this), // Safe as we wait for result below.
252 base::Unretained(&request))); 252 base::Unretained(&request)));
253 253
254 // We're blocking the UI thread, which is generally undesirable. 254 // We're blocking the UI thread, which is generally undesirable.
255 TRACE_EVENT0( 255 TRACE_EVENT0(
256 "browser", 256 "browser",
257 "BrowserGpuMemoryBufferManager::CreateGpuMemoryBufferFromHandle"); 257 "BrowserGpuMemoryBufferManager::CreateGpuMemoryBufferFromHandle");
258 base::ThreadRestrictions::ScopedAllowWait allow_wait; 258 base::ThreadRestrictions::ScopedAllowWait allow_wait;
259 request.event.Wait(); 259 request.event.Wait();
260 if (!request.result) {
261 GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_);
262 if (host)
263 host->ForceShutdown();
264 }
260 return std::move(request.result); 265 return std::move(request.result);
261 } 266 }
262 267
263 void BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferForChildProcess( 268 void BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferForChildProcess(
264 gfx::GpuMemoryBufferId id, 269 gfx::GpuMemoryBufferId id,
265 const gfx::Size& size, 270 const gfx::Size& size,
266 gfx::BufferFormat format, 271 gfx::BufferFormat format,
267 gfx::BufferUsage usage, 272 gfx::BufferUsage usage,
268 base::ProcessHandle child_process_handle, 273 base::ProcessHandle child_process_handle,
269 int child_client_id, 274 int child_client_id,
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 &BrowserGpuMemoryBufferManager::HandleCreateGpuMemoryBufferOnIO, 420 &BrowserGpuMemoryBufferManager::HandleCreateGpuMemoryBufferOnIO,
416 base::Unretained(this), // Safe as we wait for result below. 421 base::Unretained(this), // Safe as we wait for result below.
417 base::Unretained(&request))); 422 base::Unretained(&request)));
418 423
419 // We're blocking the UI thread, which is generally undesirable. 424 // We're blocking the UI thread, which is generally undesirable.
420 TRACE_EVENT0( 425 TRACE_EVENT0(
421 "browser", 426 "browser",
422 "BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferForSurface"); 427 "BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferForSurface");
423 base::ThreadRestrictions::ScopedAllowWait allow_wait; 428 base::ThreadRestrictions::ScopedAllowWait allow_wait;
424 request.event.Wait(); 429 request.event.Wait();
430 if (!request.result) {
431 GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_);
432 if (host)
433 host->ForceShutdown();
434 }
425 return std::move(request.result); 435 return std::move(request.result);
426 } 436 }
427 437
428 void BrowserGpuMemoryBufferManager::HandleCreateGpuMemoryBufferOnIO( 438 void BrowserGpuMemoryBufferManager::HandleCreateGpuMemoryBufferOnIO(
429 CreateGpuMemoryBufferRequest* request) { 439 CreateGpuMemoryBufferRequest* request) {
430 DCHECK_CURRENTLY_ON(BrowserThread::IO); 440 DCHECK_CURRENTLY_ON(BrowserThread::IO);
431 441
432 gfx::GpuMemoryBufferId new_id = content::GetNextGenericSharedMemoryId(); 442 gfx::GpuMemoryBufferId new_id = content::GetNextGenericSharedMemoryId();
433 443
434 // Use service side allocation for native configurations. 444 // Use service side allocation for native configurations.
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 format(format), 706 format(format),
697 usage(usage), 707 usage(usage),
698 gpu_host_id(gpu_host_id) {} 708 gpu_host_id(gpu_host_id) {}
699 709
700 BrowserGpuMemoryBufferManager::BufferInfo::BufferInfo(const BufferInfo& other) = 710 BrowserGpuMemoryBufferManager::BufferInfo::BufferInfo(const BufferInfo& other) =
701 default; 711 default;
702 712
703 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {} 713 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {}
704 714
705 } // namespace content 715 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698