| 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" |
| 11 #include "wtf/Allocator.h" |
| 11 #include "wtf/Assertions.h" | 12 #include "wtf/Assertions.h" |
| 13 #include "wtf/Noncopyable.h" |
| 12 #include "wtf/PassOwnPtr.h" | 14 #include "wtf/PassOwnPtr.h" |
| 13 | 15 |
| 14 #ifndef NDEBUG | 16 #ifndef NDEBUG |
| 15 #include "wtf/text/StringBuilder.h" | 17 #include "wtf/text/StringBuilder.h" |
| 16 #include "wtf/text/WTFString.h" | 18 #include "wtf/text/WTFString.h" |
| 17 #endif | 19 #endif |
| 18 | 20 |
| 19 | 21 |
| 20 namespace blink { | 22 namespace blink { |
| 21 | 23 |
| 22 class GraphicsContext; | 24 class GraphicsContext; |
| 23 class IntRect; | 25 class IntRect; |
| 24 class WebDisplayItemList; | 26 class WebDisplayItemList; |
| 25 | 27 |
| 26 class PLATFORM_EXPORT DisplayItem { | 28 class PLATFORM_EXPORT DisplayItem { |
| 29 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 27 public: | 30 public: |
| 28 enum { | 31 enum { |
| 29 // Must be kept in sync with core/paint/PaintPhase.h. | 32 // Must be kept in sync with core/paint/PaintPhase.h. |
| 30 PaintPhaseMax = 11, | 33 PaintPhaseMax = 11, |
| 31 }; | 34 }; |
| 32 | 35 |
| 33 // A display item type uniquely identifies a display item of a client. | 36 // A display item type uniquely identifies a display item of a client. |
| 34 // Some display item types can be categorized using the following directives
: | 37 // Some display item types can be categorized using the following directives
: |
| 35 // - In enum Type: | 38 // - In enum Type: |
| 36 // - enum value <Category>First; | 39 // - enum value <Category>First; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // derivedSize must fit in m_derivedSize. | 205 // derivedSize must fit in m_derivedSize. |
| 203 // If it doesn't, enlarge m_derivedSize and fix this assert. | 206 // If it doesn't, enlarge m_derivedSize and fix this assert. |
| 204 ASSERT_WITH_SECURITY_IMPLICATION(derivedSize < (1 << 8)); | 207 ASSERT_WITH_SECURITY_IMPLICATION(derivedSize < (1 << 8)); |
| 205 ASSERT_WITH_SECURITY_IMPLICATION(derivedSize >= sizeof(*this)); | 208 ASSERT_WITH_SECURITY_IMPLICATION(derivedSize >= sizeof(*this)); |
| 206 } | 209 } |
| 207 | 210 |
| 208 virtual ~DisplayItem() { } | 211 virtual ~DisplayItem() { } |
| 209 | 212 |
| 210 // Ids are for matching new DisplayItems with existing DisplayItems. | 213 // Ids are for matching new DisplayItems with existing DisplayItems. |
| 211 struct Id { | 214 struct Id { |
| 215 STACK_ALLOCATED(); |
| 212 Id(const DisplayItemClient client, const Type type, const unsigned scope
) | 216 Id(const DisplayItemClient client, const Type type, const unsigned scope
) |
| 213 : client(client) | 217 : client(client) |
| 214 , type(type) | 218 , type(type) |
| 215 , scope(scope) { } | 219 , scope(scope) { } |
| 216 | 220 |
| 217 bool matches(const DisplayItem& item) const | 221 bool matches(const DisplayItem& item) const |
| 218 { | 222 { |
| 219 // We should always convert to non-cached types before matching. | 223 // We should always convert to non-cached types before matching. |
| 220 ASSERT(!isCachedType(item.m_type)); | 224 ASSERT(!isCachedType(item.m_type)); |
| 221 ASSERT(!isCachedType(type)); | 225 ASSERT(!isCachedType(type)); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0; | 393 bool isEndAndPairedWith(DisplayItem::Type otherType) const override = 0; |
| 390 #endif | 394 #endif |
| 391 | 395 |
| 392 private: | 396 private: |
| 393 bool isEnd() const final { return true; } | 397 bool isEnd() const final { return true; } |
| 394 }; | 398 }; |
| 395 | 399 |
| 396 } // namespace blink | 400 } // namespace blink |
| 397 | 401 |
| 398 #endif // DisplayItem_h | 402 #endif // DisplayItem_h |
| OLD | NEW |