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

Side by Side Diff: Source/core/inspector/InspectorConsoleMessage.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: Remove unneeded changes 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) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 : m_source(source) 49 : m_source(source)
50 , m_type(type) 50 , m_type(type)
51 , m_level(level) 51 , m_level(level)
52 , m_message(message) 52 , m_message(message)
53 , m_scriptState(0) 53 , m_scriptState(0)
54 , m_url() 54 , m_url()
55 , m_line(0) 55 , m_line(0)
56 , m_column(0) 56 , m_column(0)
57 , m_requestId(IdentifiersFactory::requestId(0)) 57 , m_requestId(IdentifiersFactory::requestId(0))
58 , m_timestamp(WTF::currentTime()) 58 , m_timestamp(WTF::currentTime())
59 , m_workerProxy(nullptr)
59 { 60 {
60 autogenerateMetadata(canGenerateCallStack); 61 autogenerateMetadata(canGenerateCallStack);
61 } 62 }
62 63
63 InspectorConsoleMessage::InspectorConsoleMessage(bool canGenerateCallStack, Mess ageSource source, MessageType type, MessageLevel level, const String& message, c onst String& url, unsigned line, unsigned column, ScriptState* scriptState, unsi gned long requestIdentifier) 64 InspectorConsoleMessage::InspectorConsoleMessage(bool canGenerateCallStack, Mess ageSource source, MessageType type, MessageLevel level, const String& message, c onst String& url, unsigned line, unsigned column, ScriptState* scriptState, unsi gned long requestIdentifier)
64 : m_source(source) 65 : m_source(source)
65 , m_type(type) 66 , m_type(type)
66 , m_level(level) 67 , m_level(level)
67 , m_message(message) 68 , m_message(message)
68 , m_scriptState(scriptState) 69 , m_scriptState(scriptState)
69 , m_url(url) 70 , m_url(url)
70 , m_line(line) 71 , m_line(line)
71 , m_column(column) 72 , m_column(column)
72 , m_requestId(IdentifiersFactory::requestId(requestIdentifier)) 73 , m_requestId(IdentifiersFactory::requestId(requestIdentifier))
73 , m_timestamp(WTF::currentTime()) 74 , m_timestamp(WTF::currentTime())
75 , m_workerProxy(nullptr)
74 { 76 {
75 autogenerateMetadata(canGenerateCallStack, scriptState); 77 autogenerateMetadata(canGenerateCallStack, scriptState);
76 } 78 }
77 79
78 InspectorConsoleMessage::InspectorConsoleMessage(MessageSource source, MessageTy pe type, MessageLevel level, const String& message, PassRefPtrWillBeRawPtr<Scrip tCallStack> callStack, unsigned long requestIdentifier) 80 InspectorConsoleMessage::InspectorConsoleMessage(MessageSource source, MessageTy pe type, MessageLevel level, const String& message, PassRefPtrWillBeRawPtr<Scrip tCallStack> callStack, unsigned long requestIdentifier)
79 : m_source(source) 81 : m_source(source)
80 , m_type(type) 82 , m_type(type)
81 , m_level(level) 83 , m_level(level)
82 , m_message(message) 84 , m_message(message)
83 , m_scriptState(0) 85 , m_scriptState(0)
84 , m_arguments(nullptr) 86 , m_arguments(nullptr)
85 , m_line(0) 87 , m_line(0)
86 , m_column(0) 88 , m_column(0)
87 , m_requestId(IdentifiersFactory::requestId(requestIdentifier)) 89 , m_requestId(IdentifiersFactory::requestId(requestIdentifier))
88 , m_timestamp(WTF::currentTime()) 90 , m_timestamp(WTF::currentTime())
91 , m_workerProxy(nullptr)
89 { 92 {
90 if (callStack && callStack->size()) { 93 if (callStack && callStack->size()) {
91 const ScriptCallFrame& frame = callStack->at(0); 94 const ScriptCallFrame& frame = callStack->at(0);
92 m_url = frame.sourceURL(); 95 m_url = frame.sourceURL();
93 m_line = frame.lineNumber(); 96 m_line = frame.lineNumber();
94 m_column = frame.columnNumber(); 97 m_column = frame.columnNumber();
95 } 98 }
96 m_callStack = callStack; 99 m_callStack = callStack;
97 } 100 }
98 101
99 InspectorConsoleMessage::InspectorConsoleMessage(bool canGenerateCallStack, Mess ageSource source, MessageType type, MessageLevel level, const String& message, P assRefPtrWillBeRawPtr<ScriptArguments> arguments, ScriptState* scriptState, unsi gned long requestIdentifier) 102 InspectorConsoleMessage::InspectorConsoleMessage(bool canGenerateCallStack, Mess ageSource source, MessageType type, MessageLevel level, const String& message, P assRefPtrWillBeRawPtr<ScriptArguments> arguments, ScriptState* scriptState, unsi gned long requestIdentifier)
100 : m_source(source) 103 : m_source(source)
101 , m_type(type) 104 , m_type(type)
102 , m_level(level) 105 , m_level(level)
103 , m_message(message) 106 , m_message(message)
104 , m_scriptState(scriptState) 107 , m_scriptState(scriptState)
105 , m_arguments(arguments) 108 , m_arguments(arguments)
106 , m_url() 109 , m_url()
107 , m_line(0) 110 , m_line(0)
108 , m_column(0) 111 , m_column(0)
109 , m_requestId(IdentifiersFactory::requestId(requestIdentifier)) 112 , m_requestId(IdentifiersFactory::requestId(requestIdentifier))
110 , m_timestamp(WTF::currentTime()) 113 , m_timestamp(WTF::currentTime())
114 , m_workerProxy(nullptr)
111 { 115 {
112 autogenerateMetadata(canGenerateCallStack, scriptState); 116 autogenerateMetadata(canGenerateCallStack, scriptState);
113 } 117 }
114 118
115 InspectorConsoleMessage::~InspectorConsoleMessage() 119 InspectorConsoleMessage::~InspectorConsoleMessage()
116 { 120 {
117 } 121 }
118 122
119 void InspectorConsoleMessage::autogenerateMetadata(bool canGenerateCallStack, Sc riptState* scriptState) 123 void InspectorConsoleMessage::autogenerateMetadata(bool canGenerateCallStack, Sc riptState* scriptState)
120 { 124 {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 case LogMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::Lo g; 185 case LogMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::Lo g;
182 case WarningMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level ::Warning; 186 case WarningMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level ::Warning;
183 case ErrorMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level:: Error; 187 case ErrorMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level:: Error;
184 case InfoMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::I nfo; 188 case InfoMessageLevel: return TypeBuilder::Console::ConsoleMessage::Level::I nfo;
185 } 189 }
186 return TypeBuilder::Console::ConsoleMessage::Level::Log; 190 return TypeBuilder::Console::ConsoleMessage::Level::Log;
187 } 191 }
188 192
189 void InspectorConsoleMessage::addToFrontend(InspectorFrontend::Console* frontend , InjectedScriptManager* injectedScriptManager, bool generatePreview) 193 void InspectorConsoleMessage::addToFrontend(InspectorFrontend::Console* frontend , InjectedScriptManager* injectedScriptManager, bool generatePreview)
190 { 194 {
195 if (m_workerProxy)
196 return;
197
191 RefPtr<TypeBuilder::Console::ConsoleMessage> jsonObj = TypeBuilder::Console: :ConsoleMessage::create() 198 RefPtr<TypeBuilder::Console::ConsoleMessage> jsonObj = TypeBuilder::Console: :ConsoleMessage::create()
192 .setSource(messageSourceValue(m_source)) 199 .setSource(messageSourceValue(m_source))
193 .setLevel(messageLevelValue(m_level)) 200 .setLevel(messageLevelValue(m_level))
194 .setText(m_message) 201 .setText(m_message)
195 .setTimestamp(m_timestamp); 202 .setTimestamp(m_timestamp);
196 // FIXME: only send out type for ConsoleAPI source messages. 203 // FIXME: only send out type for ConsoleAPI source messages.
197 jsonObj->setType(messageTypeValue(m_type)); 204 jsonObj->setType(messageTypeValue(m_type));
198 jsonObj->setLine(static_cast<int>(m_line)); 205 jsonObj->setLine(static_cast<int>(m_line));
199 jsonObj->setColumn(static_cast<int>(m_column)); 206 jsonObj->setColumn(static_cast<int>(m_column));
200 jsonObj->setUrl(m_url); 207 jsonObj->setUrl(m_url);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 261 }
255 262
256 unsigned InspectorConsoleMessage::argumentCount() 263 unsigned InspectorConsoleMessage::argumentCount()
257 { 264 {
258 if (m_arguments) 265 if (m_arguments)
259 return m_arguments->argumentCount(); 266 return m_arguments->argumentCount();
260 return 0; 267 return 0;
261 } 268 }
262 269
263 } // namespace blink 270 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698