Chromium Code Reviews| Index: cc/surfaces/frame_sink_id_allocator.h |
| diff --git a/cc/surfaces/frame_sink_id_allocator.h b/cc/surfaces/frame_sink_id_allocator.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..db9ac7f804690616ecdb99a35ac47e25d4eb2c96 |
| --- /dev/null |
| +++ b/cc/surfaces/frame_sink_id_allocator.h |
| @@ -0,0 +1,31 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CC_SURFACES_FRAME_SINK_ID_ALLOCATOR_H_ |
| +#define CC_SURFACES_FRAME_SINK_ID_ALLOCATOR_H_ |
| + |
| +#include "cc/surfaces/frame_sink_id.h" |
| + |
| +namespace cc { |
| + |
| +// This class generates FrameSinkId with a fixed client_id and an incrementally |
| +// -increasing sink_id. |
|
Fady Samuel
2017/02/17 14:01:52
nit: put the hyphen (the -) on the previous line o
xlai (Olivia)
2017/02/17 15:55:11
Done.
|
| +class FrameSinkIdAllocator { |
| + public: |
| + constexpr FrameSinkIdAllocator(uint32_t client_id) |
| + : client_id_(client_id), next_sink_id_(1u) {} |
|
Fady Samuel
2017/02/17 14:01:52
nit: New line after this.
xlai (Olivia)
2017/02/17 15:55:11
Done.
|
| + FrameSinkId NextFrameSinkId() { |
| + return FrameSinkId(client_id_, next_sink_id_++); |
| + } |
| + |
| + private: |
| + const uint32_t client_id_; |
| + uint32_t next_sink_id_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FrameSinkIdAllocator); |
| +}; |
| + |
| +} // namespace cc |
| + |
| +#endif // CC_SURFACES_FRAME_SINK_ID_ALLOCATOR_H_ |