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

Unified Diff: content/browser/gpu/gpu_process_host.cc

Issue 2878573002: gpu: guarantee to match pending GBM buffer request to actual GBM handle (Closed)
Patch Set: errata: GBM -> GpuMemoryBuffer Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/gpu_process_host.cc
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
index c809a615c61e0efbdae86a852b11951aab86c417..e8a2fe135af523c26a4640f1a1d2b471e2bd7dfb 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -736,7 +736,9 @@ void GpuProcessHost::CreateGpuMemoryBuffer(
TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer");
DCHECK(CalledOnValidThread());
- create_gpu_memory_buffer_requests_.push(callback);
+ DCHECK(create_gpu_memory_buffer_requests_.find(id) ==
Daniele Castagna 2017/05/12 19:19:15 DS, do you know if this is the DCHECK that was goi
dshwang 2017/05/12 21:35:57 I'm surprising the DCHECK fails. I tested just CHE
+ create_gpu_memory_buffer_requests_.end());
+ create_gpu_memory_buffer_requests_[id] = callback;
gpu_service_ptr_->CreateGpuMemoryBuffer(
id, size, format, usage, client_id, surface_handle,
base::Bind(&GpuProcessHost::OnGpuMemoryBufferCreated,
@@ -792,9 +794,14 @@ void GpuProcessHost::OnGpuMemoryBufferCreated(
const gfx::GpuMemoryBufferHandle& handle) {
TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated");
- DCHECK(!create_gpu_memory_buffer_requests_.empty());
- auto callback = create_gpu_memory_buffer_requests_.front();
- create_gpu_memory_buffer_requests_.pop();
+ if (create_gpu_memory_buffer_requests_.find(handle.id) ==
+ create_gpu_memory_buffer_requests_.end()) {
+ DVLOG(1) << "GpuMemoryBuffer creation fails due to missing callback.";
+ return;
+ }
+
+ auto callback = create_gpu_memory_buffer_requests_[handle.id];
+ create_gpu_memory_buffer_requests_.erase(handle.id);
callback.Run(handle, BufferCreationStatus::SUCCESS);
}
@@ -1077,12 +1084,12 @@ void GpuProcessHost::SendOutstandingReplies() {
EstablishChannelStatus::GPU_HOST_INVALID);
}
- while (!create_gpu_memory_buffer_requests_.empty()) {
- auto callback = create_gpu_memory_buffer_requests_.front();
- create_gpu_memory_buffer_requests_.pop();
+ for (auto& pair : create_gpu_memory_buffer_requests_) {
+ auto callback = pair.second;
callback.Run(gfx::GpuMemoryBufferHandle(),
BufferCreationStatus::GPU_HOST_INVALID);
}
+ create_gpu_memory_buffer_requests_.clear();
if (!send_destroying_video_surface_done_cb_.is_null())
base::ResetAndReturn(&send_destroying_video_surface_done_cb_).Run();
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698