| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 } | 337 } |
| 338 | 338 |
| 339 void V8Console::countCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { | 339 void V8Console::countCallback(const v8::FunctionCallbackInfo<v8::Value>& info) { |
| 340 ConsoleHelper helper(info); | 340 ConsoleHelper helper(info); |
| 341 | 341 |
| 342 String16 title = helper.firstArgToString(String16()); | 342 String16 title = helper.firstArgToString(String16()); |
| 343 String16 identifier; | 343 String16 identifier; |
| 344 if (title.isEmpty()) { | 344 if (title.isEmpty()) { |
| 345 std::unique_ptr<V8StackTraceImpl> stackTrace = | 345 std::unique_ptr<V8StackTraceImpl> stackTrace = |
| 346 V8StackTraceImpl::capture(nullptr, 0, 1); | 346 V8StackTraceImpl::capture(nullptr, 0, 1); |
| 347 if (stackTrace) | 347 if (stackTrace && !stackTrace->isEmpty()) { |
| 348 identifier = toString16(stackTrace->topSourceURL()) + ":" + | 348 identifier = toString16(stackTrace->topSourceURL()) + ":" + |
| 349 String16::fromInteger(stackTrace->topLineNumber()); | 349 String16::fromInteger(stackTrace->topLineNumber()); |
| 350 } |
| 350 } else { | 351 } else { |
| 351 identifier = title + "@"; | 352 identifier = title + "@"; |
| 352 } | 353 } |
| 353 | 354 |
| 354 v8::Local<v8::Map> countMap; | 355 v8::Local<v8::Map> countMap; |
| 355 if (!helper.privateMap("V8Console#countMap").ToLocal(&countMap)) return; | 356 if (!helper.privateMap("V8Console#countMap").ToLocal(&countMap)) return; |
| 356 int32_t count = helper.getIntFromMap(countMap, identifier, 0) + 1; | 357 int32_t count = helper.getIntFromMap(countMap, identifier, 0) + 1; |
| 357 helper.setIntOnMap(countMap, identifier, count); | 358 helper.setIntOnMap(countMap, identifier, count); |
| 358 helper.reportCallWithArgument(ConsoleAPIType::kCount, | 359 helper.reportCallWithArgument(ConsoleAPIType::kCount, |
| 359 title + ": " + String16::fromInteger(count)); | 360 title + ": " + String16::fromInteger(count)); |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 ->GetOwnPropertyDescriptor( | 909 ->GetOwnPropertyDescriptor( |
| 909 m_context, v8::Local<v8::String>::Cast(name)) | 910 m_context, v8::Local<v8::String>::Cast(name)) |
| 910 .ToLocal(&descriptor); | 911 .ToLocal(&descriptor); |
| 911 DCHECK(success); | 912 DCHECK(success); |
| 912 USE(success); | 913 USE(success); |
| 913 } | 914 } |
| 914 } | 915 } |
| 915 } | 916 } |
| 916 | 917 |
| 917 } // namespace v8_inspector | 918 } // namespace v8_inspector |
| OLD | NEW |