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

Side by Side Diff: content/common/gpu/gpu_channel_manager.cc

Issue 1414793018: Revert of Converted video frame and image callbacks to use new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « content/common/gpu/gpu_channel_manager.h ('k') | content/common/gpu/gpu_command_buffer_stub.h » ('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/common/gpu/gpu_channel_manager.h" 5 #include "content/common/gpu/gpu_channel_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 io_task_runner_(io_task_runner), 53 io_task_runner_(io_task_runner),
54 channel_(channel), 54 channel_(channel),
55 watchdog_(watchdog), 55 watchdog_(watchdog),
56 shutdown_event_(shutdown_event), 56 shutdown_event_(shutdown_event),
57 share_group_(new gfx::GLShareGroup), 57 share_group_(new gfx::GLShareGroup),
58 mailbox_manager_(gpu::gles2::MailboxManager::Create()), 58 mailbox_manager_(gpu::gles2::MailboxManager::Create()),
59 gpu_memory_manager_( 59 gpu_memory_manager_(
60 this, 60 this,
61 GpuMemoryManager::kDefaultMaxSurfacesWithFrontbufferSoftLimit), 61 GpuMemoryManager::kDefaultMaxSurfacesWithFrontbufferSoftLimit),
62 sync_point_manager_(sync_point_manager), 62 sync_point_manager_(sync_point_manager),
63 sync_point_client_waiter_(new gpu::SyncPointClientWaiter),
64 gpu_memory_buffer_factory_(gpu_memory_buffer_factory), 63 gpu_memory_buffer_factory_(gpu_memory_buffer_factory),
65 weak_factory_(this) { 64 weak_factory_(this) {
66 DCHECK(task_runner); 65 DCHECK(task_runner);
67 DCHECK(io_task_runner); 66 DCHECK(io_task_runner);
68 const base::CommandLine* command_line = 67 const base::CommandLine* command_line =
69 base::CommandLine::ForCurrentProcess(); 68 base::CommandLine::ForCurrentProcess();
70 if (command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess)) 69 if (command_line->HasSwitch(switches::kUIPrioritizeInGpuProcess))
71 preemption_flag_ = new gpu::PreemptionFlag; 70 preemption_flag_ = new gpu::PreemptionFlag;
72 } 71 }
73 72
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 220
222 void GpuChannelManager::DestroyGpuMemoryBufferOnIO( 221 void GpuChannelManager::DestroyGpuMemoryBufferOnIO(
223 gfx::GpuMemoryBufferId id, 222 gfx::GpuMemoryBufferId id,
224 int client_id) { 223 int client_id) {
225 gpu_memory_buffer_factory_->DestroyGpuMemoryBuffer(id, client_id); 224 gpu_memory_buffer_factory_->DestroyGpuMemoryBuffer(id, client_id);
226 } 225 }
227 226
228 void GpuChannelManager::OnDestroyGpuMemoryBuffer( 227 void GpuChannelManager::OnDestroyGpuMemoryBuffer(
229 gfx::GpuMemoryBufferId id, 228 gfx::GpuMemoryBufferId id,
230 int client_id, 229 int client_id,
231 const gpu::SyncToken& sync_token) { 230 int32 sync_point) {
232 if (sync_token.HasData()) { 231 if (!sync_point) {
233 scoped_refptr<gpu::SyncPointClientState> release_state = 232 DestroyGpuMemoryBuffer(id, client_id);
234 sync_point_manager()->GetSyncPointClientState( 233 } else {
235 sync_token.namespace_id(), sync_token.command_buffer_id()); 234 sync_point_manager()->AddSyncPointCallback(
236 if (release_state) { 235 sync_point,
237 sync_point_client_waiter_->Wait( 236 base::Bind(&GpuChannelManager::DestroyGpuMemoryBuffer,
238 release_state.get(), sync_token.release_count(), 237 base::Unretained(this),
239 base::Bind(&GpuChannelManager::DestroyGpuMemoryBuffer, 238 id,
240 base::Unretained(this), id, client_id)); 239 client_id));
241 return;
242 }
243 } 240 }
244
245 // No sync token or invalid sync token, destroy immediately.
246 DestroyGpuMemoryBuffer(id, client_id);
247 } 241 }
248 242
249 void GpuChannelManager::OnUpdateValueState( 243 void GpuChannelManager::OnUpdateValueState(
250 int client_id, unsigned int target, const gpu::ValueState& state) { 244 int client_id, unsigned int target, const gpu::ValueState& state) {
251 // Only pass updated state to the channel corresponding to the 245 // Only pass updated state to the channel corresponding to the
252 // render_widget_host where the event originated. 246 // render_widget_host where the event originated.
253 auto it = gpu_channels_.find(client_id); 247 auto it = gpu_channels_.find(client_id);
254 if (it != gpu_channels_.end()) 248 if (it != gpu_channels_.end())
255 it->second->HandleUpdateValueState(target, state); 249 it->second->HandleUpdateValueState(target, state);
256 } 250 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 334 }
341 } 335 }
342 if (!stub || !stub->decoder()->MakeCurrent()) 336 if (!stub || !stub->decoder()->MakeCurrent())
343 return; 337 return;
344 glFinish(); 338 glFinish();
345 DidAccessGpu(); 339 DidAccessGpu();
346 } 340 }
347 #endif 341 #endif
348 342
349 } // namespace content 343 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_channel_manager.h ('k') | content/common/gpu/gpu_command_buffer_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698