Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: Source/platform/graphics/paint/DisplayItem.cpp

Issue 1323263002: Show debug information for invalid display items (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
OLDNEW
« no previous file with comments | « Source/platform/graphics/paint/DisplayItem.h ('k') | Source/platform/graphics/paint/DisplayItemList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698