| OLD | NEW |
| 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 Loading... |
| 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(*m_client, m_type); } | 230 Id getId() const { return Id(*m_client, m_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(m_client); | 235 DCHECK(m_client); |
| 236 return *m_client; | 236 return *m_client; |
| 237 } | 237 } |
| 238 Type getType() const { return m_type; } | 238 Type getType() const { return m_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 m_derivedSize; } | 244 size_t derivedSize() const { return m_derivedSize; } |
| 245 | 245 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0; | 404 bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0; |
| 405 #endif | 405 #endif |
| 406 | 406 |
| 407 private: | 407 private: |
| 408 bool isEnd() const final { return true; } | 408 bool isEnd() const final { return true; } |
| 409 }; | 409 }; |
| 410 | 410 |
| 411 } // namespace blink | 411 } // namespace blink |
| 412 | 412 |
| 413 #endif // DisplayItem_h | 413 #endif // DisplayItem_h |
| OLD | NEW |