OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/surfaces/surface_id_allocator.h" | 5 #include "cc/surfaces/surface_id_allocator.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/rand_util.h" | |
10 | |
11 namespace cc { | 9 namespace cc { |
12 | 10 |
13 SurfaceIdAllocator::SurfaceIdAllocator(uint32_t client_id) | 11 SurfaceIdAllocator::SurfaceIdAllocator(uint32_t client_id) |
14 : client_id_(client_id), next_id_(1u) {} | 12 : client_id_(client_id), next_id_(1u) {} |
15 | 13 |
16 SurfaceIdAllocator::~SurfaceIdAllocator() { | 14 SurfaceIdAllocator::~SurfaceIdAllocator() { |
17 } | 15 } |
18 | 16 |
19 SurfaceId SurfaceIdAllocator::GenerateId() { | 17 SurfaceId SurfaceIdAllocator::GenerateId() { |
20 uint64_t nonce = base::RandUint64(); | 18 SurfaceId id(client_id_, next_id_); |
21 SurfaceId id(client_id_, next_id_, nonce); | |
22 next_id_++; | 19 next_id_++; |
23 return id; | 20 return id; |
24 } | 21 } |
25 | 22 |
26 } // namespace cc | 23 } // namespace cc |
OLD | NEW |