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

Side by Side Diff: Source/core/inspector/InspectorConsoleAgent.cpp

Issue 185713007: DevTools: Add timestamp support in the console (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Up for review Created 6 years, 9 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 /* 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 message.append(error.localizedDescription()); 295 message.append(error.localizedDescription());
296 } 296 }
297 addMessageToConsole(NetworkMessageSource, LogMessageType, ErrorMessageLevel, message.toString(), error.failingURL(), 0, 0, 0, requestIdentifier); 297 addMessageToConsole(NetworkMessageSource, LogMessageType, ErrorMessageLevel, message.toString(), error.failingURL(), 0, 0, 0, requestIdentifier);
298 } 298 }
299 299
300 void InspectorConsoleAgent::setMonitoringXHREnabled(ErrorString*, bool enabled) 300 void InspectorConsoleAgent::setMonitoringXHREnabled(ErrorString*, bool enabled)
301 { 301 {
302 m_state->setBoolean(ConsoleAgentState::monitoringXHR, enabled); 302 m_state->setBoolean(ConsoleAgentState::monitoringXHR, enabled);
303 } 303 }
304 304
305 static bool isGroupMessage(MessageType type)
306 {
307 return type == StartGroupMessageType
308 || type == StartGroupCollapsedMessageType
309 || type == EndGroupMessageType;
310 }
311
312 void InspectorConsoleAgent::addConsoleMessage(PassOwnPtr<ConsoleMessage> console Message) 305 void InspectorConsoleAgent::addConsoleMessage(PassOwnPtr<ConsoleMessage> console Message)
313 { 306 {
314 ASSERT_ARG(consoleMessage, consoleMessage); 307 ASSERT_ARG(consoleMessage, consoleMessage);
315 308
316 if (m_previousMessage && !isGroupMessage(m_previousMessage->type()) && m_pre viousMessage->isEqual(consoleMessage.get())) { 309 m_previousMessage = consoleMessage.get();
apavlov 2014/03/21 09:30:46 Is m_previousMessage used anywhere at all?
317 m_previousMessage->incrementCount(); 310 m_consoleMessages.append(consoleMessage);
318 if (m_frontend && m_enabled) 311 if (m_frontend && m_enabled)
319 m_previousMessage->updateRepeatCountInConsole(m_frontend); 312 m_previousMessage->addToFrontend(m_frontend, m_injectedScriptManager, tr ue);
320 } else {
321 m_previousMessage = consoleMessage.get();
322 m_consoleMessages.append(consoleMessage);
323 if (m_frontend && m_enabled)
324 m_previousMessage->addToFrontend(m_frontend, m_injectedScriptManager , true);
325 }
326 313
327 if (!m_frontend && m_consoleMessages.size() >= maximumConsoleMessages) { 314 if (!m_frontend && m_consoleMessages.size() >= maximumConsoleMessages) {
328 m_expiredConsoleMessageCount += expireConsoleMessagesStep; 315 m_expiredConsoleMessageCount += expireConsoleMessagesStep;
329 m_consoleMessages.remove(0, expireConsoleMessagesStep); 316 m_consoleMessages.remove(0, expireConsoleMessagesStep);
330 } 317 }
331 } 318 }
332 319
333 class InspectableHeapObject FINAL : public InjectedScriptHost::InspectableObject { 320 class InspectableHeapObject FINAL : public InjectedScriptHost::InspectableObject {
334 public: 321 public:
335 explicit InspectableHeapObject(int heapObjectId) : m_heapObjectId(heapObject Id) { } 322 explicit InspectableHeapObject(int heapObjectId) : m_heapObjectId(heapObject Id) { }
336 virtual ScriptValue get(ScriptState*) OVERRIDE 323 virtual ScriptValue get(ScriptState*) OVERRIDE
337 { 324 {
338 return ScriptProfiler::objectByHeapObjectId(m_heapObjectId); 325 return ScriptProfiler::objectByHeapObjectId(m_heapObjectId);
339 } 326 }
340 private: 327 private:
341 int m_heapObjectId; 328 int m_heapObjectId;
342 }; 329 };
343 330
344 void InspectorConsoleAgent::addInspectedHeapObject(ErrorString*, int inspectedHe apObjectId) 331 void InspectorConsoleAgent::addInspectedHeapObject(ErrorString*, int inspectedHe apObjectId)
345 { 332 {
346 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(adoptPtr(n ew InspectableHeapObject(inspectedHeapObjectId))); 333 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(adoptPtr(n ew InspectableHeapObject(inspectedHeapObjectId)));
347 } 334 }
348 335
349 } // namespace WebCore 336 } // namespace WebCore
350 337
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698