| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 { | 236 { |
| 237 RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole()); | 237 RefPtr<ScriptCallStack> callStack(createScriptCallStackForConsole()); |
| 238 const ScriptCallFrame& lastCaller = callStack->at(0); | 238 const ScriptCallFrame& lastCaller = callStack->at(0); |
| 239 // Follow Firebug's behavior of counting with null and undefined title in | 239 // Follow Firebug's behavior of counting with null and undefined title in |
| 240 // the same bucket as no argument | 240 // the same bucket as no argument |
| 241 String title; | 241 String title; |
| 242 arguments->getFirstArgumentAsString(title); | 242 arguments->getFirstArgumentAsString(title); |
| 243 String identifier = title.isEmpty() ? String(lastCaller.sourceURL() + ':' +
String::number(lastCaller.lineNumber())) | 243 String identifier = title.isEmpty() ? String(lastCaller.sourceURL() + ':' +
String::number(lastCaller.lineNumber())) |
| 244 : String(title + '@'); | 244 : String(title + '@'); |
| 245 | 245 |
| 246 HashMap<String, unsigned>::iterator it = m_counts.find(identifier); | 246 HashCountedSet<String>::AddResult result = m_counts.add(identifier); |
| 247 int count; | 247 String message = title + ": " + String::number(result.iterator->value); |
| 248 if (it == m_counts.end()) | |
| 249 count = 1; | |
| 250 else { | |
| 251 count = it->value + 1; | |
| 252 m_counts.remove(it); | |
| 253 } | |
| 254 | |
| 255 m_counts.add(identifier, count); | |
| 256 | |
| 257 String message = title + ": " + String::number(count); | |
| 258 addMessageToConsole(ConsoleAPIMessageSource, LogMessageType, DebugMessageLev
el, message, callStack); | 248 addMessageToConsole(ConsoleAPIMessageSource, LogMessageType, DebugMessageLev
el, message, callStack); |
| 259 } | 249 } |
| 260 | 250 |
| 261 void InspectorConsoleAgent::frameWindowDiscarded(DOMWindow* window) | 251 void InspectorConsoleAgent::frameWindowDiscarded(DOMWindow* window) |
| 262 { | 252 { |
| 263 size_t messageCount = m_consoleMessages.size(); | 253 size_t messageCount = m_consoleMessages.size(); |
| 264 for (size_t i = 0; i < messageCount; ++i) | 254 for (size_t i = 0; i < messageCount; ++i) |
| 265 m_consoleMessages[i]->windowCleared(window); | 255 m_consoleMessages[i]->windowCleared(window); |
| 266 m_injectedScriptManager->discardInjectedScriptsFor(window); | 256 m_injectedScriptManager->discardInjectedScriptsFor(window); |
| 267 } | 257 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 int m_heapObjectId; | 338 int m_heapObjectId; |
| 349 }; | 339 }; |
| 350 | 340 |
| 351 void InspectorConsoleAgent::addInspectedHeapObject(ErrorString*, int inspectedHe
apObjectId) | 341 void InspectorConsoleAgent::addInspectedHeapObject(ErrorString*, int inspectedHe
apObjectId) |
| 352 { | 342 { |
| 353 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(adoptPtr(n
ew InspectableHeapObject(inspectedHeapObjectId))); | 343 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(adoptPtr(n
ew InspectableHeapObject(inspectedHeapObjectId))); |
| 354 } | 344 } |
| 355 | 345 |
| 356 } // namespace WebCore | 346 } // namespace WebCore |
| 357 | 347 |
| OLD | NEW |