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

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

Issue 466753002: DevTools: Do not push to frontend messages from worker while it is alive (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address vsevik's comments Created 6 years, 4 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 26 matching lines...) Expand all
37 #include "core/inspector/InspectorConsoleMessage.h" 37 #include "core/inspector/InspectorConsoleMessage.h"
38 #include "core/inspector/InspectorState.h" 38 #include "core/inspector/InspectorState.h"
39 #include "core/inspector/InspectorTimelineAgent.h" 39 #include "core/inspector/InspectorTimelineAgent.h"
40 #include "core/inspector/InspectorTracingAgent.h" 40 #include "core/inspector/InspectorTracingAgent.h"
41 #include "core/inspector/InstrumentingAgents.h" 41 #include "core/inspector/InstrumentingAgents.h"
42 #include "core/inspector/ScriptArguments.h" 42 #include "core/inspector/ScriptArguments.h"
43 #include "core/inspector/ScriptCallFrame.h" 43 #include "core/inspector/ScriptCallFrame.h"
44 #include "core/inspector/ScriptCallStack.h" 44 #include "core/inspector/ScriptCallStack.h"
45 #include "core/loader/DocumentLoader.h" 45 #include "core/loader/DocumentLoader.h"
46 #include "core/page/Page.h" 46 #include "core/page/Page.h"
47 #include "core/workers/WorkerGlobalScopeProxy.h"
47 #include "platform/network/ResourceError.h" 48 #include "platform/network/ResourceError.h"
48 #include "platform/network/ResourceResponse.h" 49 #include "platform/network/ResourceResponse.h"
49 #include "wtf/CurrentTime.h" 50 #include "wtf/CurrentTime.h"
50 #include "wtf/OwnPtr.h" 51 #include "wtf/OwnPtr.h"
51 #include "wtf/PassOwnPtr.h" 52 #include "wtf/PassOwnPtr.h"
52 #include "wtf/text/StringBuilder.h" 53 #include "wtf/text/StringBuilder.h"
53 #include "wtf/text/WTFString.h" 54 #include "wtf/text/WTFString.h"
54 55
55 namespace blink { 56 namespace blink {
56 57
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 163
163 void InspectorConsoleAgent::clearFrontend() 164 void InspectorConsoleAgent::clearFrontend()
164 { 165 {
165 m_frontend = 0; 166 m_frontend = 0;
166 String errorString; 167 String errorString;
167 disable(&errorString); 168 disable(&errorString);
168 } 169 }
169 170
170 void InspectorConsoleAgent::addMessageToConsole(ConsoleMessage* consoleMessage) 171 void InspectorConsoleAgent::addMessageToConsole(ConsoleMessage* consoleMessage)
171 { 172 {
173 InspectorConsoleMessage* message;
172 if (consoleMessage->callStack()) { 174 if (consoleMessage->callStack()) {
173 addConsoleMessage(adoptPtr(new InspectorConsoleMessage(consoleMessage->s ource(), LogMessageType, consoleMessage->level(), consoleMessage->message(), con soleMessage->callStack(), consoleMessage->requestIdentifier()))); 175 message = new InspectorConsoleMessage(consoleMessage->source(), LogMessa geType, consoleMessage->level(), consoleMessage->message(), consoleMessage->call Stack(), consoleMessage->requestIdentifier());
174 } else { 176 } else {
175 bool canGenerateCallStack = !isWorkerAgent() && m_frontend; 177 bool canGenerateCallStack = !isWorkerAgent() && m_frontend;
176 addConsoleMessage(adoptPtr(new InspectorConsoleMessage(canGenerateCallSt ack, consoleMessage->source(), LogMessageType, consoleMessage->level(), consoleM essage->message(), consoleMessage->url(), consoleMessage->lineNumber(), consoleM essage->columnNumber(), consoleMessage->scriptState(), consoleMessage->requestId entifier()))); 178 message = new InspectorConsoleMessage(canGenerateCallStack, consoleMessa ge->source(), LogMessageType, consoleMessage->level(), consoleMessage->message() , consoleMessage->url(), consoleMessage->lineNumber(), consoleMessage->columnNum ber(), consoleMessage->scriptState(), consoleMessage->requestIdentifier());
179 }
180 message->setWorkerGlobalScopeProxy(consoleMessage->getWorkerId());
181 addConsoleMessage(adoptPtr(message));
182 }
183
184 void InspectorConsoleAgent::notifyWorkerGlobalScopeTerminated(WorkerGlobalScopeP roxy* proxy)
185 {
186 for (size_t i = 0; i < m_consoleMessages.size(); i++) {
187 if (m_consoleMessages[i]->getWorkerGlobalScopeProxy() == proxy)
188 m_consoleMessages[i]->setWorkerGlobalScopeProxy(nullptr);
177 } 189 }
178 } 190 }
179 191
180 void InspectorConsoleAgent::addConsoleAPIMessageToConsole(MessageType type, Mess ageLevel level, const String& message, ScriptState* scriptState, PassRefPtrWillB eRawPtr<ScriptArguments> arguments, unsigned long requestIdentifier) 192 void InspectorConsoleAgent::addConsoleAPIMessageToConsole(MessageType type, Mess ageLevel level, const String& message, ScriptState* scriptState, PassRefPtrWillB eRawPtr<ScriptArguments> arguments, unsigned long requestIdentifier)
181 { 193 {
182 if (type == ClearMessageType) { 194 if (type == ClearMessageType) {
183 ErrorString error; 195 ErrorString error;
184 clearMessages(&error); 196 clearMessages(&error);
185 } 197 }
186 198
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 private: 356 private:
345 int m_heapObjectId; 357 int m_heapObjectId;
346 }; 358 };
347 359
348 void InspectorConsoleAgent::addInspectedHeapObject(ErrorString*, int inspectedHe apObjectId) 360 void InspectorConsoleAgent::addInspectedHeapObject(ErrorString*, int inspectedHe apObjectId)
349 { 361 {
350 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(adoptPtr(n ew InspectableHeapObject(inspectedHeapObjectId))); 362 m_injectedScriptManager->injectedScriptHost()->addInspectedObject(adoptPtr(n ew InspectableHeapObject(inspectedHeapObjectId)));
351 } 363 }
352 364
353 } // namespace blink 365 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698