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

Side by Side Diff: cc/surfaces/frame_sink_id.h

Issue 2425923003: Replaced is_null() with is_valid in SurfaceId and related classes. (Closed)
Patch Set: Removed added printf statements; LocalFrameId::is_valid() no longer checks if nonce is 0. Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CC_SURFACES_FRAME_SINK_ID_H_ 5 #ifndef CC_SURFACES_FRAME_SINK_ID_H_
6 #define CC_SURFACES_FRAME_SINK_ID_H_ 6 #define CC_SURFACES_FRAME_SINK_ID_H_
7 7
8 #include <tuple> 8 #include <tuple>
9 9
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
11 #include "base/hash.h" 11 #include "base/hash.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 class FrameSinkId { 16 class FrameSinkId {
17 public: 17 public:
18 constexpr FrameSinkId() : client_id_(0), sink_id_(0) {} 18 constexpr FrameSinkId() : client_id_(0), sink_id_(0) {}
19 19
20 constexpr FrameSinkId(const FrameSinkId& other) 20 constexpr FrameSinkId(const FrameSinkId& other)
21 : client_id_(other.client_id_), sink_id_(other.sink_id_) {} 21 : client_id_(other.client_id_), sink_id_(other.sink_id_) {}
22 22
23 constexpr FrameSinkId(uint32_t client_id, uint32_t sink_id) 23 constexpr FrameSinkId(uint32_t client_id, uint32_t sink_id)
24 : client_id_(client_id), sink_id_(sink_id) {} 24 : client_id_(client_id), sink_id_(sink_id) {}
25 25
26 constexpr bool is_valid() const { return client_id_ != 0 || sink_id_ != 0; }
27
26 constexpr bool is_null() const { return client_id_ == 0 && sink_id_ == 0; } 28 constexpr bool is_null() const { return client_id_ == 0 && sink_id_ == 0; }
27 29
28 constexpr uint32_t client_id() const { return client_id_; } 30 constexpr uint32_t client_id() const { return client_id_; }
29 31
30 constexpr uint32_t sink_id() const { return sink_id_; } 32 constexpr uint32_t sink_id() const { return sink_id_; }
31 33
32 bool operator==(const FrameSinkId& other) const { 34 bool operator==(const FrameSinkId& other) const {
33 return client_id_ == other.client_id_ && sink_id_ == other.sink_id_; 35 return client_id_ == other.client_id_ && sink_id_ == other.sink_id_;
34 } 36 }
35 37
(...skipping 15 matching lines...) Expand all
51 uint32_t sink_id_; 53 uint32_t sink_id_;
52 }; 54 };
53 55
54 struct FrameSinkIdHash { 56 struct FrameSinkIdHash {
55 size_t operator()(const FrameSinkId& key) const { return key.hash(); } 57 size_t operator()(const FrameSinkId& key) const { return key.hash(); }
56 }; 58 };
57 59
58 } // namespace cc 60 } // namespace cc
59 61
60 #endif // CC_SURFACES_FRAME_SINK_ID_H_ 62 #endif // CC_SURFACES_FRAME_SINK_ID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698