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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h

Issue 2807923002: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in platform/graphics (Closed)
Patch Set: rebase and fix Created 3 years, 8 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 #ifndef DisplayItem_h 5 #ifndef DisplayItem_h
6 #define DisplayItem_h 6 #define DisplayItem_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "platform/graphics/ContiguousContainer.h" 9 #include "platform/graphics/ContiguousContainer.h"
10 #include "platform/graphics/paint/DisplayItemClient.h" 10 #include "platform/graphics/paint/DisplayItemClient.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 225
226 const DisplayItemClient& client; 226 const DisplayItemClient& client;
227 const Type type; 227 const Type type;
228 }; 228 };
229 229
230 Id GetId() const { return Id(*client_, type_); } 230 Id GetId() const { return Id(*client_, type_); }
231 231
232 virtual void Replay(GraphicsContext&) const {} 232 virtual void Replay(GraphicsContext&) const {}
233 233
234 const DisplayItemClient& Client() const { 234 const DisplayItemClient& Client() const {
235 ASSERT(client_); 235 DCHECK(client_);
236 return *client_; 236 return *client_;
237 } 237 }
238 Type GetType() const { return type_; } 238 Type GetType() const { return type_; }
239 239
240 // Size of this object in memory, used to move it with memcpy. 240 // Size of this object in memory, used to move it with memcpy.
241 // This is not sizeof(*this), because it needs to account for the size of 241 // This is not sizeof(*this), because it needs to account for the size of
242 // the derived class (i.e. runtime type). Derived classes are expected to 242 // the derived class (i.e. runtime type). Derived classes are expected to
243 // supply this to the DisplayItem constructor. 243 // supply this to the DisplayItem constructor.
244 size_t DerivedSize() const { return derived_size_; } 244 size_t DerivedSize() const { return derived_size_; }
245 245
(...skipping 14 matching lines...) Expand all
260 } \ 260 } \
261 bool Is##Category() const { return Is##Category##Type(GetType()); } 261 bool Is##Category() const { return Is##Category##Type(GetType()); }
262 262
263 #define DEFINE_CONVERSION_METHODS(Category1, category1, Category2, category2) \ 263 #define DEFINE_CONVERSION_METHODS(Category1, category1, Category2, category2) \
264 static Type Category1##TypeTo##Category2##Type(Type type) { \ 264 static Type Category1##TypeTo##Category2##Type(Type type) { \
265 static_assert(k##Category1##Last - k##Category1##First == \ 265 static_assert(k##Category1##Last - k##Category1##First == \
266 k##Category2##Last - k##Category2##First, \ 266 k##Category2##Last - k##Category2##First, \
267 "Categories " #Category1 " and " #Category2 \ 267 "Categories " #Category1 " and " #Category2 \
268 " should have same number of enum values. See comments of " \ 268 " should have same number of enum values. See comments of " \
269 "DisplayItem::Type"); \ 269 "DisplayItem::Type"); \
270 ASSERT(Is##Category1##Type(type)); \ 270 DCHECK(Is##Category1##Type(type)); \
271 return static_cast<Type>(type - k##Category1##First + \ 271 return static_cast<Type>(type - k##Category1##First + \
272 k##Category2##First); \ 272 k##Category2##First); \
273 } \ 273 } \
274 static Type category2##TypeTo##Category1##Type(Type type) { \ 274 static Type category2##TypeTo##Category1##Type(Type type) { \
275 ASSERT(Is##Category2##Type(type)); \ 275 DCHECK(Is##Category2##Type(type)); \
276 return static_cast<Type>(type - k##Category2##First + \ 276 return static_cast<Type>(type - k##Category2##First + \
277 k##Category1##First); \ 277 k##Category1##First); \
278 } 278 }
279 279
280 #define DEFINE_PAIRED_CATEGORY_METHODS(Category, category) \ 280 #define DEFINE_PAIRED_CATEGORY_METHODS(Category, category) \
281 DEFINE_CATEGORY_METHODS(Category) \ 281 DEFINE_CATEGORY_METHODS(Category) \
282 DEFINE_CATEGORY_METHODS(End##Category) \ 282 DEFINE_CATEGORY_METHODS(End##Category) \
283 DEFINE_CONVERSION_METHODS(Category, category, End##Category, end##Category) 283 DEFINE_CONVERSION_METHODS(Category, category, End##Category, end##Category)
284 284
285 #define DEFINE_PAINT_PHASE_CONVERSION_METHOD(Category) \ 285 #define DEFINE_PAINT_PHASE_CONVERSION_METHOD(Category) \
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 bool IsEndAndPairedWith(DisplayItem::Type other_type) const override = 0; 402 bool IsEndAndPairedWith(DisplayItem::Type other_type) const override = 0;
403 #endif 403 #endif
404 404
405 private: 405 private:
406 bool IsEnd() const final { return true; } 406 bool IsEnd() const final { return true; }
407 }; 407 };
408 408
409 } // namespace blink 409 } // namespace blink
410 410
411 #endif // DisplayItem_h 411 #endif // DisplayItem_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698