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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8ConsoleMessage.cpp

Issue 2245283002: [DevTools] Send correct message level in deprecated Console domain. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "platform/v8_inspector/V8ConsoleMessage.h" 5 #include "platform/v8_inspector/V8ConsoleMessage.h"
6 6
7 #include "platform/v8_inspector/InspectedContext.h" 7 #include "platform/v8_inspector/InspectedContext.h"
8 #include "platform/v8_inspector/V8ConsoleAgentImpl.h" 8 #include "platform/v8_inspector/V8ConsoleAgentImpl.h"
9 #include "platform/v8_inspector/V8InspectorImpl.h" 9 #include "platform/v8_inspector/V8InspectorImpl.h"
10 #include "platform/v8_inspector/V8InspectorSessionImpl.h" 10 #include "platform/v8_inspector/V8InspectorSessionImpl.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 m_url = url; 196 m_url = url;
197 m_lineNumber = lineNumber; 197 m_lineNumber = lineNumber;
198 m_columnNumber = columnNumber; 198 m_columnNumber = columnNumber;
199 m_stackTrace = std::move(stackTrace); 199 m_stackTrace = std::move(stackTrace);
200 m_scriptId = scriptId; 200 m_scriptId = scriptId;
201 } 201 }
202 202
203 void V8ConsoleMessage::reportToFrontend(protocol::Console::Frontend* frontend) c onst 203 void V8ConsoleMessage::reportToFrontend(protocol::Console::Frontend* frontend) c onst
204 { 204 {
205 DCHECK(m_origin == V8MessageOrigin::kConsole); 205 DCHECK(m_origin == V8MessageOrigin::kConsole);
206 String16 level = protocol::Console::ConsoleMessage::LevelEnum::Log;
207 if (m_type == ConsoleAPIType::kDebug || m_type == ConsoleAPIType::kCount || m_type == ConsoleAPIType::kTimeEnd)
208 level = protocol::Console::ConsoleMessage::LevelEnum::Debug;
209 else if (m_type == ConsoleAPIType::kError || m_type == ConsoleAPIType::kAsse rt)
210 level = protocol::Console::ConsoleMessage::LevelEnum::Error;
211 else if (m_type == ConsoleAPIType::kWarning)
212 level = protocol::Console::ConsoleMessage::LevelEnum::Warning;
213 else if (m_type == ConsoleAPIType::kInfo)
214 level = protocol::Console::ConsoleMessage::LevelEnum::Info;
206 std::unique_ptr<protocol::Console::ConsoleMessage> result = 215 std::unique_ptr<protocol::Console::ConsoleMessage> result =
207 protocol::Console::ConsoleMessage::create() 216 protocol::Console::ConsoleMessage::create()
208 .setSource(protocol::Console::ConsoleMessage::SourceEnum::ConsoleApi) 217 .setSource(protocol::Console::ConsoleMessage::SourceEnum::ConsoleApi)
209 .setLevel(protocol::Console::ConsoleMessage::LevelEnum::Log) 218 .setLevel(level)
210 .setText(m_message) 219 .setText(m_message)
211 .build(); 220 .build();
212 result->setLine(static_cast<int>(m_lineNumber)); 221 result->setLine(static_cast<int>(m_lineNumber));
213 result->setColumn(static_cast<int>(m_columnNumber)); 222 result->setColumn(static_cast<int>(m_columnNumber));
214 result->setUrl(m_url); 223 result->setUrl(m_url);
215 frontend->messageAdded(std::move(result)); 224 frontend->messageAdded(std::move(result));
216 } 225 }
217 226
218 std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>> V8ConsoleMessa ge::wrapArguments(V8InspectorSessionImpl* session, bool generatePreview) const 227 std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>> V8ConsoleMessa ge::wrapArguments(V8InspectorSessionImpl* session, bool generatePreview) const
219 { 228 {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 session->releaseObjectGroup("console"); 433 session->releaseObjectGroup("console");
425 } 434 }
426 435
427 void V8ConsoleMessageStorage::contextDestroyed(int contextId) 436 void V8ConsoleMessageStorage::contextDestroyed(int contextId)
428 { 437 {
429 for (size_t i = 0; i < m_messages.size(); ++i) 438 for (size_t i = 0; i < m_messages.size(); ++i)
430 m_messages[i]->contextDestroyed(contextId); 439 m_messages[i]->contextDestroyed(contextId);
431 } 440 }
432 441
433 } // namespace blink 442 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698