Chromium Code Reviews| 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 #include "config.h" | 5 #include "config.h" |
| 6 #include "platform/graphics/paint/DisplayItem.h" | 6 #include "platform/graphics/paint/DisplayItem.h" |
| 7 | 7 |
| 8 namespace blink { | 8 namespace blink { |
| 9 | 9 |
| 10 struct SameSizeAsDisplayItem { | 10 struct SameSizeAsDisplayItem { |
| 11 virtual ~SameSizeAsDisplayItem() { } // Allocate vtable pointer. | 11 virtual ~SameSizeAsDisplayItem() { } // Allocate vtable pointer. |
| 12 void* pointers[2]; | 12 void* pointers[2]; |
| 13 int m_int; // Make sure m_int and m_type are next to each other so they are packed on 64-bit. | 13 int ints[2]; // Make sure other fields are packed into two ints. |
|
chrishtr
2015/06/02 20:40:18
So DisplayItem has not gotten bigger due to this p
Xianzhu
2015/06/02 20:52:24
Right.
| |
| 14 DisplayItem::Type m_type; | |
| 15 #ifndef NDEBUG | 14 #ifndef NDEBUG |
| 16 WTF::String m_debugString; | 15 WTF::String m_debugString; |
| 17 #endif | 16 #endif |
| 18 }; | 17 }; |
| 19 | 18 |
| 20 static_assert(sizeof(DisplayItem) == sizeof(SameSizeAsDisplayItem), "DisplayItem should stay small"); | 19 static_assert(sizeof(DisplayItem) == sizeof(SameSizeAsDisplayItem), "DisplayItem should stay small"); |
| 21 static_assert(sizeof(DisplayItem::Type) <= sizeof(int), "DisplayItem::Type shoul d stay small"); | |
| 22 | 20 |
| 23 #ifndef NDEBUG | 21 #ifndef NDEBUG |
| 24 | 22 |
| 25 static WTF::String paintPhaseAsDebugString(int paintPhase) | 23 static WTF::String paintPhaseAsDebugString(int paintPhase) |
| 26 { | 24 { |
| 27 // Must be kept in sync with PaintPhase. | 25 // Must be kept in sync with PaintPhase. |
| 28 switch (paintPhase) { | 26 switch (paintPhase) { |
| 29 case 0: return "PaintPhaseBlockBackground"; | 27 case 0: return "PaintPhaseBlockBackground"; |
| 30 case 1: return "PaintPhaseChildBlockBackground"; | 28 case 1: return "PaintPhaseChildBlockBackground"; |
| 31 case 2: return "PaintPhaseChildBlockBackgrounds"; | 29 case 2: return "PaintPhaseChildBlockBackgrounds"; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 void DisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& stringBuilder) const | 205 void DisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& stringBuilder) const |
| 208 { | 206 { |
| 209 stringBuilder.append(String::format("client: \"%p", client())); | 207 stringBuilder.append(String::format("client: \"%p", client())); |
| 210 if (!clientDebugString().isEmpty()) { | 208 if (!clientDebugString().isEmpty()) { |
| 211 stringBuilder.append(' '); | 209 stringBuilder.append(' '); |
| 212 stringBuilder.append(clientDebugString()); | 210 stringBuilder.append(clientDebugString()); |
| 213 } | 211 } |
| 214 stringBuilder.append("\", type: \""); | 212 stringBuilder.append("\", type: \""); |
| 215 stringBuilder.append(typeAsDebugString(type())); | 213 stringBuilder.append(typeAsDebugString(type())); |
| 216 stringBuilder.append('"'); | 214 stringBuilder.append('"'); |
| 217 if (m_id.scopeContainer) | 215 if (m_skippedCache) |
| 218 stringBuilder.append(String::format(", scope: \"%p,%d\"", m_id.scopeCont ainer, m_id.scopeId)); | 216 stringBuilder.append(", skippedCache: true"); |
| 217 if (m_scopeContainer) | |
| 218 stringBuilder.append(String::format(", scope: \"%p,%d\"", m_scopeContain er, m_scopeId)); | |
| 219 } | 219 } |
| 220 | 220 |
| 221 #endif | 221 #endif |
| 222 | 222 |
| 223 } // namespace blink | 223 } // namespace blink |
| OLD | NEW |