Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: cc/surfaces/surface_id_allocator.cc

Issue 2136413002: Update Surface ID Terminology (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed webkit_unit_tests Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 9 #include "base/rand_util.h"
10 #include "cc/surfaces/surface_manager.h" 10 #include "cc/surfaces/surface_manager.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 SurfaceIdAllocator::SurfaceIdAllocator(uint32_t id_namespace) 14 SurfaceIdAllocator::SurfaceIdAllocator(uint32_t client_id)
15 : id_namespace_(id_namespace), next_id_(1u), manager_(nullptr) { 15 : client_id_(client_id), next_id_(1u), manager_(nullptr) {}
16 }
17 16
18 void SurfaceIdAllocator::RegisterSurfaceIdNamespace(SurfaceManager* manager) { 17 void SurfaceIdAllocator::RegisterSurfaceClientId(SurfaceManager* manager) {
19 DCHECK(!manager_); 18 DCHECK(!manager_);
20 manager_ = manager; 19 manager_ = manager;
21 manager_->RegisterSurfaceIdNamespace(id_namespace_); 20 manager_->RegisterSurfaceClientId(client_id_);
22 } 21 }
23 22
24 SurfaceIdAllocator::~SurfaceIdAllocator() { 23 SurfaceIdAllocator::~SurfaceIdAllocator() {
25 if (manager_) 24 if (manager_)
26 manager_->InvalidateSurfaceIdNamespace(id_namespace_); 25 manager_->InvalidateSurfaceClientId(client_id_);
27 } 26 }
28 27
29 SurfaceId SurfaceIdAllocator::GenerateId() { 28 SurfaceId SurfaceIdAllocator::GenerateId() {
30 uint64_t nonce = base::RandUint64(); 29 uint64_t nonce = base::RandUint64();
31 SurfaceId id(id_namespace_, next_id_, nonce); 30 SurfaceId id(client_id_, next_id_, nonce);
32 next_id_++; 31 next_id_++;
33 return id; 32 return id;
34 } 33 }
35 34
36 } // namespace cc 35 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698