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

Unified Diff: sky/compositor/surface_allocator.cc

Issue 807733002: Split surface id and simplify connecting to surfaces service (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: sky/compositor/surface_allocator.cc
diff --git a/sky/compositor/surface_allocator.cc b/sky/compositor/surface_allocator.cc
index 80cc7a1e1d04ef582537508bc7fd6d673a20cb1e..7b3d381b4110c6ad00dc90dadef421a0a243100f 100644
--- a/sky/compositor/surface_allocator.cc
+++ b/sky/compositor/surface_allocator.cc
@@ -16,13 +16,11 @@ SurfaceAllocator::SurfaceAllocator(uint32_t id_namespace)
SurfaceAllocator::~SurfaceAllocator() {
}
-uint64_t SurfaceAllocator::CreateSurfaceId() {
- // Surface IDs are 64 integers. The high 32 bits are the namespace of the ID,
- // which is assigned to us by the surfaces service. The lower 32 bits are ours
- // to allocate as we see fit. For simplicity, we just allocate them
- // sequentially. In principle, we could run out, but at 60 Hz, it takes
- // several years to run out.
- return static_cast<uint64_t>(id_namespace_) << 32 | next_id_++;
+mojo::SurfaceIdPtr SurfaceAllocator::CreateSurfaceId() {
+ auto id = mojo::SurfaceId::New();
+ id->local = next_id_++;
+ id->id_namespace = id_namespace_;
+ return id.Pass();
}
} // namespace sky

Powered by Google App Engine
This is Rietveld 408576698