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

Side by Side Diff: src/inspector/v8-console.cc

Issue 2372093002: [inspector] fixed console.count with empty stack (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | 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 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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698