| 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. |
| 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 | |
| 20 static_assert(sizeof(DisplayItem) == sizeof(SameSizeAsDisplayItem), "DisplayItem
should stay small"); | 18 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 | 19 |
| 23 #ifndef NDEBUG | 20 #ifndef NDEBUG |
| 24 | 21 |
| 25 static WTF::String paintPhaseAsDebugString(int paintPhase) | 22 static WTF::String paintPhaseAsDebugString(int paintPhase) |
| 26 { | 23 { |
| 27 // Must be kept in sync with PaintPhase. | 24 // Must be kept in sync with PaintPhase. |
| 28 switch (paintPhase) { | 25 switch (paintPhase) { |
| 29 case 0: return "PaintPhaseBlockBackground"; | 26 case 0: return "PaintPhaseBlockBackground"; |
| 30 case 1: return "PaintPhaseChildBlockBackground"; | 27 case 1: return "PaintPhaseChildBlockBackground"; |
| 31 case 2: return "PaintPhaseChildBlockBackgrounds"; | 28 case 2: return "PaintPhaseChildBlockBackgrounds"; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 void DisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& stringBuilder)
const | 194 void DisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& stringBuilder)
const |
| 198 { | 195 { |
| 199 stringBuilder.append(String::format("client: \"%p", client())); | 196 stringBuilder.append(String::format("client: \"%p", client())); |
| 200 if (!clientDebugString().isEmpty()) { | 197 if (!clientDebugString().isEmpty()) { |
| 201 stringBuilder.append(' '); | 198 stringBuilder.append(' '); |
| 202 stringBuilder.append(clientDebugString()); | 199 stringBuilder.append(clientDebugString()); |
| 203 } | 200 } |
| 204 stringBuilder.append("\", type: \""); | 201 stringBuilder.append("\", type: \""); |
| 205 stringBuilder.append(typeAsDebugString(type())); | 202 stringBuilder.append(typeAsDebugString(type())); |
| 206 stringBuilder.append('"'); | 203 stringBuilder.append('"'); |
| 207 if (m_id.scopeContainer) | 204 if (m_skippedCache) |
| 208 stringBuilder.append(String::format(", scope: \"%p,%d\"", m_id.scopeCont
ainer, m_id.scopeId)); | 205 stringBuilder.append(", skippedCache: true"); |
| 206 if (m_scopeContainer) |
| 207 stringBuilder.append(String::format(", scope: \"%p,%d\"", m_scopeContain
er, m_scopeId)); |
| 209 } | 208 } |
| 210 | 209 |
| 211 #endif | 210 #endif |
| 212 | 211 |
| 213 } // namespace blink | 212 } // namespace blink |
| OLD | NEW |