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

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

Issue 2269843002: [DevTools] Improve ConsoleAPI functions string description (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reverted set console in InspectedContext Created 4 years, 3 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
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/v8_inspector/InjectedScript.h" 7 #include "platform/v8_inspector/InjectedScript.h"
8 #include "platform/v8_inspector/InspectedContext.h" 8 #include "platform/v8_inspector/InspectedContext.h"
9 #include "platform/v8_inspector/V8Compat.h" 9 #include "platform/v8_inspector/V8Compat.h"
10 #include "platform/v8_inspector/V8ConsoleMessage.h" 10 #include "platform/v8_inspector/V8ConsoleMessage.h"
11 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" 11 #include "platform/v8_inspector/V8DebuggerAgentImpl.h"
12 #include "platform/v8_inspector/V8InspectorImpl.h" 12 #include "platform/v8_inspector/V8InspectorImpl.h"
13 #include "platform/v8_inspector/V8InspectorSessionImpl.h" 13 #include "platform/v8_inspector/V8InspectorSessionImpl.h"
14 #include "platform/v8_inspector/V8ProfilerAgentImpl.h" 14 #include "platform/v8_inspector/V8ProfilerAgentImpl.h"
15 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" 15 #include "platform/v8_inspector/V8RuntimeAgentImpl.h"
16 #include "platform/v8_inspector/V8StackTraceImpl.h" 16 #include "platform/v8_inspector/V8StackTraceImpl.h"
17 #include "platform/v8_inspector/V8StringUtil.h" 17 #include "platform/v8_inspector/V8StringUtil.h"
18 #include "platform/v8_inspector/V8ValueCopier.h"
18 #include "platform/v8_inspector/public/V8InspectorClient.h" 19 #include "platform/v8_inspector/public/V8InspectorClient.h"
19 20
20 namespace v8_inspector { 21 namespace v8_inspector {
21 22
22 namespace { 23 namespace {
23 24
24 v8::Local<v8::Private> inspectedContextPrivateKey(v8::Isolate* isolate) 25 v8::Local<v8::Private> inspectedContextPrivateKey(v8::Isolate* isolate)
25 { 26 {
26 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Conso le#InspectedContext")); 27 return v8::Private::ForApi(isolate, toV8StringInternalized(isolate, "V8Conso le#InspectedContext"));
27 } 28 }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 { 270 {
270 v8::Local<v8::String> funcName = toV8StringInternalized(context->GetIsolate( ), name); 271 v8::Local<v8::String> funcName = toV8StringInternalized(context->GetIsolate( ), name);
271 v8::Local<v8::Function> func; 272 v8::Local<v8::Function> func;
272 if (!V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, callback, console, 0).ToLocal (&func)) 273 if (!V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, callback, console, 0).ToLocal (&func))
273 return; 274 return;
274 func->SetName(funcName); 275 func->SetName(funcName);
275 if (description) { 276 if (description) {
276 v8::Local<v8::String> returnValue = toV8String(context->GetIsolate(), de scription); 277 v8::Local<v8::String> returnValue = toV8String(context->GetIsolate(), de scription);
277 v8::Local<v8::Function> toStringFunction; 278 v8::Local<v8::Function> toStringFunction;
278 if (V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, returnDataCallback, return Value, 0).ToLocal(&toStringFunction)) 279 if (V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, returnDataCallback, return Value, 0).ToLocal(&toStringFunction))
279 func->Set(toV8StringInternalized(context->GetIsolate(), "toString"), toStringFunction); 280 createDataProperty(context, func, toV8StringInternalized(context->Ge tIsolate(), "toString"), toStringFunction);
280 } 281 }
281 if (!console->Set(context, funcName, func).FromMaybe(false)) 282 createDataProperty(context, console, funcName, func);
282 return;
283 } 283 }
284 284
285 } // namespace 285 } // namespace
286 286
287 void V8Console::debugCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 287 void V8Console::debugCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
288 { 288 {
289 ConsoleHelper(info).reportCall(ConsoleAPIType::kDebug); 289 ConsoleHelper(info).reportCall(ConsoleAPIType::kDebug);
290 } 290 }
291 291
292 void V8Console::errorCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 292 void V8Console::errorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 if (!obj->GetOwnPropertyNames(context).ToLocal(&names)) 515 if (!obj->GetOwnPropertyNames(context).ToLocal(&names))
516 return; 516 return;
517 v8::Local<v8::Array> values = v8::Array::New(isolate, names->Length()); 517 v8::Local<v8::Array> values = v8::Array::New(isolate, names->Length());
518 for (size_t i = 0; i < names->Length(); ++i) { 518 for (size_t i = 0; i < names->Length(); ++i) {
519 v8::Local<v8::Value> key; 519 v8::Local<v8::Value> key;
520 if (!names->Get(context, i).ToLocal(&key)) 520 if (!names->Get(context, i).ToLocal(&key))
521 continue; 521 continue;
522 v8::Local<v8::Value> value; 522 v8::Local<v8::Value> value;
523 if (!obj->Get(context, key).ToLocal(&value)) 523 if (!obj->Get(context, key).ToLocal(&value))
524 continue; 524 continue;
525 if (!values->Set(context, i, value).FromMaybe(false)) 525 createDataProperty(context, values, i, value);
526 continue;
527 } 526 }
528 info.GetReturnValue().Set(values); 527 info.GetReturnValue().Set(values);
529 } 528 }
530 529
531 static void setFunctionBreakpoint(ConsoleHelper& helper, v8::Local<v8::Function> function, V8DebuggerAgentImpl::BreakpointSource source, const String16& conditi on, bool enable) 530 static void setFunctionBreakpoint(ConsoleHelper& helper, v8::Local<v8::Function> function, V8DebuggerAgentImpl::BreakpointSource source, const String16& conditi on, bool enable)
532 { 531 {
533 V8DebuggerAgentImpl* debuggerAgent = helper.debuggerAgent(); 532 V8DebuggerAgentImpl* debuggerAgent = helper.debuggerAgent();
534 if (!debuggerAgent) 533 if (!debuggerAgent)
535 return; 534 return;
536 String16 scriptId = String16::fromInteger(function->ScriptId()); 535 String16 scriptId = String16::fromInteger(function->ScriptId());
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 continue; 821 continue;
823 if (name->IsString()) { 822 if (name->IsString()) {
824 v8::Local<v8::Value> descriptor; 823 v8::Local<v8::Value> descriptor;
825 bool success = m_global->GetOwnPropertyDescriptor(m_context, v8::Loc al<v8::String>::Cast(name)).ToLocal(&descriptor); 824 bool success = m_global->GetOwnPropertyDescriptor(m_context, v8::Loc al<v8::String>::Cast(name)).ToLocal(&descriptor);
826 DCHECK(success); 825 DCHECK(success);
827 } 826 }
828 } 827 }
829 } 828 }
830 829
831 } // namespace v8_inspector 830 } // namespace v8_inspector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698