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

Unified Diff: content/common/gpu/gpu_channel_manager.cc

Issue 1429213002: Converted video frame and image callbacks to use new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed content_unittests Created 5 years, 1 month 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
Index: content/common/gpu/gpu_channel_manager.cc
diff --git a/content/common/gpu/gpu_channel_manager.cc b/content/common/gpu/gpu_channel_manager.cc
index 4d9c43510fa8e8c76f45e98630e6ff273006d6f1..3f603a61a03248132ba69c0b7eb9a535032439d6 100644
--- a/content/common/gpu/gpu_channel_manager.cc
+++ b/content/common/gpu/gpu_channel_manager.cc
@@ -60,6 +60,7 @@ GpuChannelManager::GpuChannelManager(
this,
GpuMemoryManager::kDefaultMaxSurfacesWithFrontbufferSoftLimit),
sync_point_manager_(sync_point_manager),
+ sync_point_client_waiter_(new gpu::SyncPointClientWaiter),
gpu_memory_buffer_factory_(gpu_memory_buffer_factory),
weak_factory_(this) {
DCHECK(task_runner);
@@ -227,17 +228,22 @@ void GpuChannelManager::DestroyGpuMemoryBufferOnIO(
void GpuChannelManager::OnDestroyGpuMemoryBuffer(
gfx::GpuMemoryBufferId id,
int client_id,
- int32 sync_point) {
- if (!sync_point) {
- DestroyGpuMemoryBuffer(id, client_id);
- } else {
- sync_point_manager()->AddSyncPointCallback(
- sync_point,
- base::Bind(&GpuChannelManager::DestroyGpuMemoryBuffer,
- base::Unretained(this),
- id,
- client_id));
+ const gpu::SyncToken& sync_token) {
+ if (sync_token.HasData()) {
+ scoped_refptr<gpu::SyncPointClientState> release_state =
+ sync_point_manager()->GetSyncPointClientState(
+ sync_token.namespace_id(), sync_token.command_buffer_id());
+ if (release_state) {
+ sync_point_client_waiter_->Wait(
+ release_state.get(), sync_token.release_count(),
+ base::Bind(&GpuChannelManager::DestroyGpuMemoryBuffer,
+ base::Unretained(this), id, client_id));
+ return;
+ }
}
+
+ // No sync token or invalid sync token, destroy immediately.
+ DestroyGpuMemoryBuffer(id, client_id);
}
void GpuChannelManager::OnUpdateValueState(

Powered by Google App Engine
This is Rietveld 408576698