| 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 { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 DEBUG_STRING_CASE(BeginSubsequence); | 196 DEBUG_STRING_CASE(BeginSubsequence); |
| 197 DEBUG_STRING_CASE(EndSubsequence); | 197 DEBUG_STRING_CASE(EndSubsequence); |
| 198 DEBUG_STRING_CASE(CachedSubsequence); | 198 DEBUG_STRING_CASE(CachedSubsequence); |
| 199 DEBUG_STRING_CASE(UninitializedType); | 199 DEBUG_STRING_CASE(UninitializedType); |
| 200 DEFAULT_CASE; | 200 DEFAULT_CASE; |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 | 203 |
| 204 WTF::String DisplayItem::asDebugString() const | 204 WTF::String DisplayItem::asDebugString() const |
| 205 { | 205 { |
| 206 if (!isValid()) | |
| 207 return "null"; | |
| 208 WTF::StringBuilder stringBuilder; | 206 WTF::StringBuilder stringBuilder; |
| 209 stringBuilder.append('{'); | 207 stringBuilder.append('{'); |
| 210 dumpPropertiesAsDebugString(stringBuilder); | 208 dumpPropertiesAsDebugString(stringBuilder); |
| 211 stringBuilder.append('}'); | 209 stringBuilder.append('}'); |
| 212 return stringBuilder.toString(); | 210 return stringBuilder.toString(); |
| 213 } | 211 } |
| 214 | 212 |
| 215 void DisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& stringBuilder)
const | 213 void DisplayItem::dumpPropertiesAsDebugString(WTF::StringBuilder& stringBuilder)
const |
| 216 { | 214 { |
| 217 ASSERT(isValid()); | 215 if (!isValid()) { |
| 216 stringBuilder.append("valid: false, originalDebugString: "); |
| 217 // This is the original debug string which is in json format. |
| 218 stringBuilder.append(clientDebugString()); |
| 219 return; |
| 220 } |
| 221 |
| 218 stringBuilder.append(String::format("client: \"%p", client())); | 222 stringBuilder.append(String::format("client: \"%p", client())); |
| 219 if (!clientDebugString().isEmpty()) { | 223 if (!clientDebugString().isEmpty()) { |
| 220 stringBuilder.append(' '); | 224 stringBuilder.append(' '); |
| 221 stringBuilder.append(clientDebugString()); | 225 stringBuilder.append(clientDebugString()); |
| 222 } | 226 } |
| 223 stringBuilder.append("\", type: \""); | 227 stringBuilder.append("\", type: \""); |
| 224 stringBuilder.append(typeAsDebugString(type())); | 228 stringBuilder.append(typeAsDebugString(type())); |
| 225 stringBuilder.append('"'); | 229 stringBuilder.append('"'); |
| 226 if (m_skippedCache) | 230 if (m_skippedCache) |
| 227 stringBuilder.append(", skippedCache: true"); | 231 stringBuilder.append(", skippedCache: true"); |
| 228 if (m_scope) | 232 if (m_scope) |
| 229 stringBuilder.append(String::format(", scope: %d", m_scope)); | 233 stringBuilder.append(String::format(", scope: %d", m_scope)); |
| 230 } | 234 } |
| 231 | 235 |
| 232 #endif | 236 #endif |
| 233 | 237 |
| 234 } // namespace blink | 238 } // namespace blink |
| OLD | NEW |