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

Side by Side Diff: gpu/command_buffer/service/sync_point_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 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 "gpu/command_buffer/service/sync_point_manager.h" 5 #include "gpu/command_buffer/service/sync_point_manager.h"
6 6
7 #include <climits> 7 #include <climits>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 SyncPointClient::SyncPointClient(SyncPointManager* sync_point_manager, 276 SyncPointClient::SyncPointClient(SyncPointManager* sync_point_manager,
277 scoped_refptr<SyncPointOrderData> order_data, 277 scoped_refptr<SyncPointOrderData> order_data,
278 CommandBufferNamespace namespace_id, 278 CommandBufferNamespace namespace_id,
279 uint64_t client_id) 279 uint64_t client_id)
280 : sync_point_manager_(sync_point_manager), 280 : sync_point_manager_(sync_point_manager),
281 client_state_(new SyncPointClientState(order_data)), 281 client_state_(new SyncPointClientState(order_data)),
282 namespace_id_(namespace_id), 282 namespace_id_(namespace_id),
283 client_id_(client_id) {} 283 client_id_(client_id) {}
284 284
285 SyncPointClientWaiter::SyncPointClientWaiter() {}
286
287 SyncPointClientWaiter::~SyncPointClientWaiter() {}
288
289 bool SyncPointClientWaiter::Wait(SyncPointClientState* release_state,
290 uint64_t release_count,
291 const base::Closure& wait_complete_callback) {
292 // No order number associated with the current execution context, using
293 // UINT32_MAX will just assume the release is in the SyncPointClientState's
294 // order numbers to be executed.
295 if (!release_state->WaitForRelease(UINT32_MAX, release_count,
296 wait_complete_callback)) {
297 wait_complete_callback.Run();
298 return false;
299 }
300 return true;
301 }
302
303 bool SyncPointClientWaiter::WaitNonThreadSafe(
304 SyncPointClientState* release_state,
305 uint64_t release_count,
306 scoped_refptr<base::SingleThreadTaskRunner> runner,
307 const base::Closure& wait_complete_callback) {
308 return Wait(release_state, release_count,
309 base::Bind(&RunOnThread, runner, wait_complete_callback));
310 }
311
285 SyncPointManager::SyncPointManager(bool allow_threaded_wait) 312 SyncPointManager::SyncPointManager(bool allow_threaded_wait)
286 : allow_threaded_wait_(allow_threaded_wait), 313 : allow_threaded_wait_(allow_threaded_wait),
287 // To reduce the risk that a sync point created in a previous GPU process 314 // To reduce the risk that a sync point created in a previous GPU process
288 // will be in flight in the next GPU process, randomize the starting sync 315 // will be in flight in the next GPU process, randomize the starting sync
289 // point number. http://crbug.com/373452 316 // point number. http://crbug.com/373452
290 next_sync_point_(base::RandInt(1, kMaxSyncBase)), 317 next_sync_point_(base::RandInt(1, kMaxSyncBase)),
291 retire_cond_var_(&lock_) { 318 retire_cond_var_(&lock_) {
292 global_order_num_.GetNext(); 319 global_order_num_.GetNext();
293 } 320 }
294 321
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 DCHECK_LT(static_cast<size_t>(namespace_id), arraysize(client_maps_)); 437 DCHECK_LT(static_cast<size_t>(namespace_id), arraysize(client_maps_));
411 438
412 base::AutoLock auto_lock(client_maps_lock_); 439 base::AutoLock auto_lock(client_maps_lock_);
413 ClientMap& client_map = client_maps_[namespace_id]; 440 ClientMap& client_map = client_maps_[namespace_id];
414 ClientMap::iterator it = client_map.find(client_id); 441 ClientMap::iterator it = client_map.find(client_id);
415 DCHECK(it != client_map.end()); 442 DCHECK(it != client_map.end());
416 client_map.erase(it); 443 client_map.erase(it);
417 } 444 }
418 445
419 } // namespace gpu 446 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698