OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CC_SURFACES_FRAME_SINK_ID_ALLOCATOR_H_ | |
6 #define CC_SURFACES_FRAME_SINK_ID_ALLOCATOR_H_ | |
7 | |
8 #include "cc/surfaces/frame_sink_id.h" | |
9 | |
10 namespace cc { | |
11 | |
12 // This class generates FrameSinkId with a fixed client_id and an | |
13 // incrementally-increasing sink_id. | |
14 class FrameSinkIdAllocator { | |
15 public: | |
16 constexpr FrameSinkIdAllocator(uint32_t client_id) | |
Fady Samuel
2017/02/17 16:00:30
Another nit, just noticed. This needs explicit.
danakj
2017/02/21 22:56:56
Presubmit should warn about this I thought? Does t
xlai (Olivia)
2017/02/22 16:24:07
Done, added explicit. I don't think constexpr and
| |
17 : client_id_(client_id), next_sink_id_(1u) {} | |
18 | |
19 FrameSinkId NextFrameSinkId() { | |
20 return FrameSinkId(client_id_, next_sink_id_++); | |
21 } | |
22 | |
23 private: | |
24 const uint32_t client_id_; | |
25 uint32_t next_sink_id_; | |
26 | |
27 DISALLOW_COPY_AND_ASSIGN(FrameSinkIdAllocator); | |
28 }; | |
29 | |
30 } // namespace cc | |
31 | |
32 #endif // CC_SURFACES_FRAME_SINK_ID_ALLOCATOR_H_ | |
OLD | NEW |