SyncPointManager never returns 0.

When the next sync point overflow occurs, it returns 1, not 0.

BUG=365904, 373452

Review URL: https://codereview.chromium.org/288153004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270997 0039d316-1c4b-4281-b951-d872f2087c98
parent a1031cb3
......@@ -26,6 +26,9 @@ SyncPointManager::~SyncPointManager() {
uint32 SyncPointManager::GenerateSyncPoint() {
base::AutoLock lock(lock_);
uint32 sync_point = next_sync_point_++;
// When an integer overflow occurs, don't return 0.
if (!sync_point)
sync_point = next_sync_point_++;
// Note: wrapping would take days for a buggy/compromized renderer that would
// insert sync points in a loop, but if that were to happen, better explicitly
......
......@@ -22,7 +22,7 @@ class SyncPointManager : public base::RefCountedThreadSafe<SyncPointManager> {
SyncPointManager();
// Generates a sync point, returning its ID. This can me called on any thread.
// IDs start at 1.
// IDs start at a random number. Never return 0.
uint32 GenerateSyncPoint();
// Retires a sync point. This will call all the registered callbacks for this
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment