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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 String16::fromInteger(stackTrace->topLineNumber()); | 359 String16::fromInteger(stackTrace->topLineNumber()); |
360 } | 360 } |
361 } else { | 361 } else { |
362 identifier = title + "@"; | 362 identifier = title + "@"; |
363 } | 363 } |
364 | 364 |
365 v8::Local<v8::Map> countMap; | 365 v8::Local<v8::Map> countMap; |
366 if (!helper.privateMap("V8Console#countMap").ToLocal(&countMap)) return; | 366 if (!helper.privateMap("V8Console#countMap").ToLocal(&countMap)) return; |
367 int32_t count = helper.getIntFromMap(countMap, identifier, 0) + 1; | 367 int32_t count = helper.getIntFromMap(countMap, identifier, 0) + 1; |
368 helper.setIntOnMap(countMap, identifier, count); | 368 helper.setIntOnMap(countMap, identifier, count); |
369 helper.reportCallWithArgument(ConsoleAPIType::kCount, | 369 String16 countString = String16::fromInteger(count); |
370 title + ": " + String16::fromInteger(count)); | 370 helper.reportCallWithArgument( |
| 371 ConsoleAPIType::kCount, |
| 372 title.isEmpty() ? countString : (title + ": " + countString)); |
371 } | 373 } |
372 | 374 |
373 void V8Console::assertCallback( | 375 void V8Console::assertCallback( |
374 const v8::FunctionCallbackInfo<v8::Value>& info) { | 376 const v8::FunctionCallbackInfo<v8::Value>& info) { |
375 ConsoleHelper helper(info); | 377 ConsoleHelper helper(info); |
376 if (helper.firstArgToBoolean(false)) return; | 378 if (helper.firstArgToBoolean(false)) return; |
377 | 379 |
378 std::vector<v8::Local<v8::Value>> arguments; | 380 std::vector<v8::Local<v8::Value>> arguments; |
379 for (int i = 1; i < info.Length(); ++i) arguments.push_back(info[i]); | 381 for (int i = 1; i < info.Length(); ++i) arguments.push_back(info[i]); |
380 if (info.Length() < 2) | 382 if (info.Length() < 2) |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 ->GetOwnPropertyDescriptor( | 943 ->GetOwnPropertyDescriptor( |
942 m_context, v8::Local<v8::String>::Cast(name)) | 944 m_context, v8::Local<v8::String>::Cast(name)) |
943 .ToLocal(&descriptor); | 945 .ToLocal(&descriptor); |
944 DCHECK(success); | 946 DCHECK(success); |
945 USE(success); | 947 USE(success); |
946 } | 948 } |
947 } | 949 } |
948 } | 950 } |
949 | 951 |
950 } // namespace v8_inspector | 952 } // namespace v8_inspector |
OLD | NEW |