Index: cc/surfaces/surface_id.h |
diff --git a/cc/surfaces/surface_id.h b/cc/surfaces/surface_id.h |
index 48a434affe1309ba155534537d63b381d938bff8..8e76aa96bca50538f7fd9c4f3e9b75ad389fa07a 100644 |
--- a/cc/surfaces/surface_id.h |
+++ b/cc/surfaces/surface_id.h |
@@ -13,15 +13,16 @@ |
#include "base/format_macros.h" |
#include "base/hash.h" |
#include "base/strings/stringprintf.h" |
+#include "cc/surfaces/frame_sink_id.h" |
namespace cc { |
class SurfaceId { |
public: |
- SurfaceId() : client_id_(0), local_id_(0), nonce_(0) {} |
+ SurfaceId() : local_id_(0), nonce_(0) {} |
SurfaceId(const SurfaceId& other) |
- : client_id_(other.client_id_), |
+ : frame_sink_id_(other.frame_sink_id_), |
local_id_(other.local_id_), |
nonce_(other.nonce_) {} |
@@ -32,43 +33,49 @@ class SurfaceId { |
// compositor client that uniquely identifies a surface. |
// A |nonce| is a cryptographically secure random int that makes a SurfaceId |
// unguessable by other clients. |
- SurfaceId(uint32_t client_id, uint32_t local_id, uint64_t nonce) |
- : client_id_(client_id), local_id_(local_id), nonce_(nonce) {} |
+ SurfaceId(const FrameSinkId& frame_sink_id, uint32_t local_id, uint64_t nonce) |
+ : frame_sink_id_(frame_sink_id), local_id_(local_id), nonce_(nonce) {} |
bool is_null() const { |
- return client_id_ == 0 && nonce_ == 0 && local_id_ == 0; |
+ return frame_sink_id_.is_null() && nonce_ == 0 && local_id_ == 0; |
} |
size_t hash() const { |
- size_t interim = base::HashInts(client_id_, local_id_); |
- return base::HashInts(static_cast<uint64_t>(interim), nonce_); |
+ size_t interim = base::HashInts(local_id_, nonce_); |
+ return base::HashInts(frame_sink_id_.hash(), interim); |
} |
- uint32_t client_id() const { return client_id_; } |
+ uint32_t client_id() const { return frame_sink_id_.client_id(); } |
+ |
+ uint32_t sink_id() const { return frame_sink_id_.sink_id(); } |
+ |
+ const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } |
uint32_t local_id() const { return local_id_; } |
uint64_t nonce() const { return nonce_; } |
std::string ToString() const { |
- return base::StringPrintf("%d:%d:%" PRIu64, client_id_, local_id_, nonce_); |
+ return base::StringPrintf("%s:LocalId(%d, %lu)" PRIu64, |
+ frame_sink_id_.ToString().c_str(), local_id_, |
+ nonce_); |
} |
bool operator==(const SurfaceId& other) const { |
- return client_id_ == other.client_id_ && local_id_ == other.local_id_ && |
- nonce_ == other.nonce_; |
+ return frame_sink_id_ == other.frame_sink_id_ && |
+ local_id_ == other.local_id_ && nonce_ == other.nonce_; |
} |
bool operator!=(const SurfaceId& other) const { return !(*this == other); } |
bool operator<(const SurfaceId& other) const { |
- return std::tie(client_id_, local_id_, nonce_) < |
- std::tie(other.client_id_, other.local_id_, other.nonce_); |
+ return std::tie(frame_sink_id_, local_id_, nonce_) < |
+ std::tie(frame_sink_id_, other.local_id_, other.nonce_); |
} |
private: |
// See SurfaceIdAllocator::GenerateId. |
- uint32_t client_id_; |
+ FrameSinkId frame_sink_id_; |
uint32_t local_id_; |
uint64_t nonce_; |
}; |