Roll src/buildtools ea47835:451dcd0
[chromium-blink-merge.git] / cc / surfaces / surface_id_allocator.cc
blobaf9e91bd5c217b2c529c2b98f97ade153c15abae
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
3 // found in the LICENSE file.
5 #include "cc/surfaces/surface_id_allocator.h"
7 namespace cc {
9 SurfaceIdAllocator::SurfaceIdAllocator(uint32_t id_namespace)
10 : id_namespace_(id_namespace), next_id_(1u) {
13 SurfaceId SurfaceIdAllocator::GenerateId() {
14 SurfaceId id(static_cast<uint64_t>(id_namespace_) << 32 | next_id_);
15 next_id_++;
16 return id;
19 // static
20 uint32_t SurfaceIdAllocator::NamespaceForId(SurfaceId id) {
21 return id.id >> 32;
24 } // namespace cc