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

Unified Diff: cc/surfaces/surface_info.h

Issue 2720503008: Add cc::SurfaceInfo::is_valid() (Closed)
Patch Set: Check is_valid() during deserialization Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: cc/surfaces/surface_info.h
diff --git a/cc/surfaces/surface_info.h b/cc/surfaces/surface_info.h
index 1c77d98976fc0ab291d449a462f4322bad8330ae..14cfab554b360cb443be4bd50b018277743b040b 100644
--- a/cc/surfaces/surface_info.h
+++ b/cc/surfaces/surface_info.h
@@ -29,6 +29,11 @@ class SurfaceInfo {
device_scale_factor_(device_scale_factor),
size_in_pixels_(size_in_pixels) {}
+ bool is_valid() const {
+ return id_.is_valid() && device_scale_factor_ != 0 &&
+ !size_in_pixels_.IsEmpty();
+ }
+
bool operator==(const SurfaceInfo& info) const {
return id_ == info.id() &&
device_scale_factor_ == info.device_scale_factor() &&

Powered by Google App Engine
This is Rietveld 408576698