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

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

Issue 2155413002: [DevTools] Node.js compatibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « third_party/WebKit/Source/platform/inspector_protocol/CodeGenerator.py ('k') | 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/V8Console.h" 5 #include "platform/v8_inspector/V8Console.h"
6 6
7 #include "platform/inspector_protocol/Platform.h" 7 #include "platform/inspector_protocol/Platform.h"
8 #include "platform/inspector_protocol/String16.h" 8 #include "platform/inspector_protocol/String16.h"
9 #include "platform/v8_inspector/InjectedScript.h" 9 #include "platform/v8_inspector/InjectedScript.h"
10 #include "platform/v8_inspector/InspectedContext.h" 10 #include "platform/v8_inspector/InspectedContext.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 std::vector<v8::Local<v8::Value>> arguments; 91 std::vector<v8::Local<v8::Value>> arguments;
92 for (int i = 0; i < m_info.Length(); ++i) 92 for (int i = 0; i < m_info.Length(); ++i)
93 arguments.push_back(m_info[i]); 93 arguments.push_back(m_info[i]);
94 if (!m_info.Length()) 94 if (!m_info.Length())
95 arguments.push_back(toV8String(m_isolate, message)); 95 arguments.push_back(toV8String(m_isolate, message));
96 reportCall(type, arguments); 96 reportCall(type, arguments);
97 } 97 }
98 98
99 void reportCallWithArgument(ConsoleAPIType type, const String16& message) 99 void reportCallWithArgument(ConsoleAPIType type, const String16& message)
100 { 100 {
101 std::vector<v8::Local<v8::Value>> arguments = { toV8String(m_isolate, me ssage) }; 101 std::vector<v8::Local<v8::Value>> arguments(1, toV8String(m_isolate, mes sage));
102 reportCall(type, arguments); 102 reportCall(type, arguments);
103 } 103 }
104 104
105 void reportCall(ConsoleAPIType type, const std::vector<v8::Local<v8::Value>> & arguments) 105 void reportCall(ConsoleAPIType type, const std::vector<v8::Local<v8::Value>> & arguments)
106 { 106 {
107 InspectedContext* inspectedContext = ensureInspectedContext(); 107 InspectedContext* inspectedContext = ensureInspectedContext();
108 if (!inspectedContext) 108 if (!inspectedContext)
109 return; 109 return;
110 V8DebuggerImpl* debugger = inspectedContext->debugger(); 110 V8DebuggerImpl* debugger = inspectedContext->debugger();
111 std::unique_ptr<V8ConsoleMessage> message = V8ConsoleMessage::createForC onsoleAPI(debugger->client()->currentTimeMS(), type, arguments, debugger->captur eStackTrace(false), inspectedContext); 111 std::unique_ptr<V8ConsoleMessage> message = V8ConsoleMessage::createForC onsoleAPI(debugger->client()->currentTimeMS(), type, arguments, debugger->captur eStackTrace(false), inspectedContext);
112 debugger->ensureConsoleMessageStorage(inspectedContext->contextGroupId() )->addMessage(std::move(message)); 112 debugger->ensureConsoleMessageStorage(inspectedContext->contextGroupId() )->addMessage(std::move(message));
113 } 113 }
114 114
115 void reportDeprecatedCall(const char* id, const String16& message) 115 void reportDeprecatedCall(const char* id, const String16& message)
116 { 116 {
117 if (checkAndSetPrivateFlagOnConsole(id, false)) 117 if (checkAndSetPrivateFlagOnConsole(id, false))
118 return; 118 return;
119 std::vector<v8::Local<v8::Value>> arguments = { toV8String(m_isolate, me ssage) }; 119 std::vector<v8::Local<v8::Value>> arguments(1, toV8String(m_isolate, mes sage));
120 reportCall(ConsoleAPIType::kWarning, arguments); 120 reportCall(ConsoleAPIType::kWarning, arguments);
121 } 121 }
122 122
123 bool firstArgToBoolean(bool defaultValue) 123 bool firstArgToBoolean(bool defaultValue)
124 { 124 {
125 if (m_info.Length() < 1) 125 if (m_info.Length() < 1)
126 return defaultValue; 126 return defaultValue;
127 if (m_info[0]->IsBoolean()) 127 if (m_info[0]->IsBoolean())
128 return m_info[0].As<v8::Boolean>()->Value(); 128 return m_info[0].As<v8::Boolean>()->Value();
129 return m_info[0]->BooleanValue(m_context).FromMaybe(defaultValue); 129 return m_info[0]->BooleanValue(m_context).FromMaybe(defaultValue);
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 continue; 822 continue;
823 if (name->IsString()) { 823 if (name->IsString()) {
824 v8::Local<v8::Value> descriptor; 824 v8::Local<v8::Value> descriptor;
825 bool success = m_global->GetOwnPropertyDescriptor(m_context, v8::Loc al<v8::String>::Cast(name)).ToLocal(&descriptor); 825 bool success = m_global->GetOwnPropertyDescriptor(m_context, v8::Loc al<v8::String>::Cast(name)).ToLocal(&descriptor);
826 DCHECK(success); 826 DCHECK(success);
827 } 827 }
828 } 828 }
829 } 829 }
830 830
831 } // namespace blink 831 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/inspector_protocol/CodeGenerator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698