OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 "src/inspector/v8-console.h" | 5 #include "src/inspector/v8-console.h" |
6 | 6 |
7 #include "src/base/macros.h" | 7 #include "src/base/macros.h" |
8 #include "src/inspector/injected-script.h" | 8 #include "src/inspector/injected-script.h" |
9 #include "src/inspector/inspected-context.h" | 9 #include "src/inspector/inspected-context.h" |
10 #include "src/inspector/string-util.h" | 10 #include "src/inspector/string-util.h" |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 ConsoleAPIType::kStartGroupCollapsed, String16("console.groupCollapsed")); | 329 ConsoleAPIType::kStartGroupCollapsed, String16("console.groupCollapsed")); |
330 } | 330 } |
331 | 331 |
332 void V8Console::groupEndCallback( | 332 void V8Console::groupEndCallback( |
333 const v8::FunctionCallbackInfo<v8::Value>& info) { | 333 const v8::FunctionCallbackInfo<v8::Value>& info) { |
334 ConsoleHelper(info).reportCallWithDefaultArgument( | 334 ConsoleHelper(info).reportCallWithDefaultArgument( |
335 ConsoleAPIType::kEndGroup, String16("console.groupEnd")); | 335 ConsoleAPIType::kEndGroup, String16("console.groupEnd")); |
336 } | 336 } |
337 | 337 |
338 void V8Console::clearCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { | 338 void V8Console::clearCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
339 ConsoleHelper(info).reportCallWithDefaultArgument(ConsoleAPIType::kClear, | 339 ConsoleHelper helper(info); |
340 String16("console.clear")); | 340 InspectedContext* context = helper.ensureInspectedContext(); |
| 341 if (!context) return; |
| 342 int contextGroupId = context->contextGroupId(); |
| 343 if (V8InspectorClient* client = helper.ensureDebuggerClient()) |
| 344 client->consoleClear(contextGroupId); |
| 345 helper.reportCallWithDefaultArgument(ConsoleAPIType::kClear, |
| 346 String16("console.clear")); |
341 } | 347 } |
342 | 348 |
343 void V8Console::countCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { | 349 void V8Console::countCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
344 ConsoleHelper helper(info); | 350 ConsoleHelper helper(info); |
345 | 351 |
346 String16 title = helper.firstArgToString(String16()); | 352 String16 title = helper.firstArgToString(String16()); |
347 String16 identifier; | 353 String16 identifier; |
348 if (title.isEmpty()) { | 354 if (title.isEmpty()) { |
349 std::unique_ptr<V8StackTraceImpl> stackTrace = | 355 std::unique_ptr<V8StackTraceImpl> stackTrace = |
350 V8StackTraceImpl::capture(nullptr, 0, 1); | 356 V8StackTraceImpl::capture(nullptr, 0, 1); |
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 ->GetOwnPropertyDescriptor( | 941 ->GetOwnPropertyDescriptor( |
936 m_context, v8::Local<v8::String>::Cast(name)) | 942 m_context, v8::Local<v8::String>::Cast(name)) |
937 .ToLocal(&descriptor); | 943 .ToLocal(&descriptor); |
938 DCHECK(success); | 944 DCHECK(success); |
939 USE(success); | 945 USE(success); |
940 } | 946 } |
941 } | 947 } |
942 } | 948 } |
943 | 949 |
944 } // namespace v8_inspector | 950 } // namespace v8_inspector |
OLD | NEW |