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

Unified Diff: gpu/command_buffer/service/sync_point_manager.cc

Issue 849103002: Share SyncPointManager implementation in in-process cmd buffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: blank lines Created 5 years, 11 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
Index: gpu/command_buffer/service/sync_point_manager.cc
diff --git a/gpu/command_buffer/service/sync_point_manager.cc b/gpu/command_buffer/service/sync_point_manager.cc
index cd8c49088b4e79405f3abe814db9b7da70525a9b..7e2f38ce8283b02d899d06c87f12d099ff8ef765 100644
--- a/gpu/command_buffer/service/sync_point_manager.cc
+++ b/gpu/command_buffer/service/sync_point_manager.cc
@@ -6,8 +6,11 @@
#include <climits>
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/rand_util.h"
+#include "base/sequence_checker.h"
+#include "gpu/command_buffer/service/gpu_switches.h"
namespace gpu {
@@ -18,6 +21,11 @@ SyncPointManager::SyncPointManager()
// To reduce the risk that a sync point created in a previous GPU process
// will be in flight in the next GPU process, randomize the starting sync
// point number. http://crbug.com/373452
+
no sievers 2015/02/05 21:55:04 nit: put a comment saying that this is because we'
boliu 2015/02/05 23:50:44 Done.
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableThreadedTextureMailboxes)) {
+ sequence_checker_.reset(new base::SequenceChecker);
+ }
}
SyncPointManager::~SyncPointManager() {
@@ -41,7 +49,7 @@ uint32 SyncPointManager::GenerateSyncPoint() {
}
void SyncPointManager::RetireSyncPoint(uint32 sync_point) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ CheckSequencedThread();
ClosureList list;
{
base::AutoLock lock(lock_);
@@ -60,7 +68,7 @@ void SyncPointManager::RetireSyncPoint(uint32 sync_point) {
void SyncPointManager::AddSyncPointCallback(uint32 sync_point,
const base::Closure& callback) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ CheckSequencedThread();
{
base::AutoLock lock(lock_);
SyncPointMap::iterator it = sync_point_map_.find(sync_point);
@@ -73,7 +81,7 @@ void SyncPointManager::AddSyncPointCallback(uint32 sync_point,
}
bool SyncPointManager::IsSyncPointRetired(uint32 sync_point) {
- DCHECK(thread_checker_.CalledOnValidThread());
+ CheckSequencedThread();
{
base::AutoLock lock(lock_);
SyncPointMap::iterator it = sync_point_map_.find(sync_point);
@@ -81,4 +89,9 @@ bool SyncPointManager::IsSyncPointRetired(uint32 sync_point) {
}
}
+void SyncPointManager::CheckSequencedThread() {
+ DCHECK(!sequence_checker_ ||
+ sequence_checker_->CalledOnValidSequencedThread());
+}
+
} // namespace gpu

Powered by Google App Engine
This is Rietveld 408576698