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

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

Issue 2151083002: DevTools: explicitly differentiate ints vs doubles in the protocol bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lcean Created 4 years, 5 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/inspector_protocol/Platform.h" 7 #include "platform/inspector_protocol/Platform.h"
8 #include "platform/inspector_protocol/String16.h" 8 #include "platform/inspector_protocol/String16.h"
9 #include "platform/v8_inspector/InjectedScript.h" 9 #include "platform/v8_inspector/InjectedScript.h"
10 #include "platform/v8_inspector/InspectedContext.h" 10 #include "platform/v8_inspector/InspectedContext.h"
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 347
348 void V8Console::countCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 348 void V8Console::countCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
349 { 349 {
350 ConsoleHelper helper(info); 350 ConsoleHelper helper(info);
351 351
352 String16 title = helper.firstArgToString(String16()); 352 String16 title = helper.firstArgToString(String16());
353 String16 identifier; 353 String16 identifier;
354 if (title.isEmpty()) { 354 if (title.isEmpty()) {
355 std::unique_ptr<V8StackTraceImpl> stackTrace = V8StackTraceImpl::capture (nullptr, 0, 1); 355 std::unique_ptr<V8StackTraceImpl> stackTrace = V8StackTraceImpl::capture (nullptr, 0, 1);
356 if (stackTrace) 356 if (stackTrace)
357 identifier = stackTrace->topSourceURL() + ":" + String16::number(sta ckTrace->topLineNumber()); 357 identifier = stackTrace->topSourceURL() + ":" + String16::fromIntege r(stackTrace->topLineNumber());
358 } else { 358 } else {
359 identifier = title + "@"; 359 identifier = title + "@";
360 } 360 }
361 361
362 v8::Local<v8::Map> countMap; 362 v8::Local<v8::Map> countMap;
363 if (!helper.privateMap("V8Console#countMap").ToLocal(&countMap)) 363 if (!helper.privateMap("V8Console#countMap").ToLocal(&countMap))
364 return; 364 return;
365 int64_t count = helper.getIntFromMap(countMap, identifier, 0) + 1; 365 int64_t count = helper.getIntFromMap(countMap, identifier, 0) + 1;
366 helper.setIntOnMap(countMap, identifier, count); 366 helper.setIntOnMap(countMap, identifier, count);
367 helper.addMessage(ConsoleAPIType::kCount, DebugMessageLevel, title + ": " + String16::number(count)); 367 helper.addMessage(ConsoleAPIType::kCount, DebugMessageLevel, title + ": " + String16::fromInteger(count));
368 } 368 }
369 369
370 void V8Console::assertCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 370 void V8Console::assertCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
371 { 371 {
372 ConsoleHelper helper(info); 372 ConsoleHelper helper(info);
373 if (helper.firstArgToBoolean(false)) 373 if (helper.firstArgToBoolean(false))
374 return; 374 return;
375 helper.addMessage(ConsoleAPIType::kAssert, ErrorMessageLevel, String16("cons ole.assert"), 1); 375 helper.addMessage(ConsoleAPIType::kAssert, ErrorMessageLevel, String16("cons ole.assert"), 1);
376 if (V8DebuggerAgentImpl* debuggerAgent = helper.debuggerAgent()) 376 if (V8DebuggerAgentImpl* debuggerAgent = helper.debuggerAgent())
377 debuggerAgent->breakProgramOnException(protocol::Debugger::Paused::Reaso nEnum::Assert, nullptr); 377 debuggerAgent->breakProgramOnException(protocol::Debugger::Paused::Reaso nEnum::Assert, nullptr);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 continue; 515 continue;
516 } 516 }
517 info.GetReturnValue().Set(values); 517 info.GetReturnValue().Set(values);
518 } 518 }
519 519
520 static void setFunctionBreakpoint(ConsoleHelper& helper, v8::Local<v8::Function> function, V8DebuggerAgentImpl::BreakpointSource source, const String16& conditi on, bool enable) 520 static void setFunctionBreakpoint(ConsoleHelper& helper, v8::Local<v8::Function> function, V8DebuggerAgentImpl::BreakpointSource source, const String16& conditi on, bool enable)
521 { 521 {
522 V8DebuggerAgentImpl* debuggerAgent = helper.debuggerAgent(); 522 V8DebuggerAgentImpl* debuggerAgent = helper.debuggerAgent();
523 if (!debuggerAgent) 523 if (!debuggerAgent)
524 return; 524 return;
525 String16 scriptId = String16::number(function->ScriptId()); 525 String16 scriptId = String16::fromInteger(function->ScriptId());
526 int lineNumber = function->GetScriptLineNumber(); 526 int lineNumber = function->GetScriptLineNumber();
527 int columnNumber = function->GetScriptColumnNumber(); 527 int columnNumber = function->GetScriptColumnNumber();
528 if (lineNumber == v8::Function::kLineOffsetNotFound || columnNumber == v8::F unction::kLineOffsetNotFound) 528 if (lineNumber == v8::Function::kLineOffsetNotFound || columnNumber == v8::F unction::kLineOffsetNotFound)
529 return; 529 return;
530 if (enable) 530 if (enable)
531 debuggerAgent->setBreakpointAt(scriptId, lineNumber, columnNumber, sourc e, condition); 531 debuggerAgent->setBreakpointAt(scriptId, lineNumber, columnNumber, sourc e, condition);
532 else 532 else
533 debuggerAgent->removeBreakpointAt(scriptId, lineNumber, columnNumber, so urce); 533 debuggerAgent->removeBreakpointAt(scriptId, lineNumber, columnNumber, so urce);
534 } 534 }
535 535
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 continue; 809 continue;
810 if (name->IsString()) { 810 if (name->IsString()) {
811 v8::Local<v8::Value> descriptor; 811 v8::Local<v8::Value> descriptor;
812 bool success = m_global->GetOwnPropertyDescriptor(m_context, v8::Loc al<v8::String>::Cast(name)).ToLocal(&descriptor); 812 bool success = m_global->GetOwnPropertyDescriptor(m_context, v8::Loc al<v8::String>::Cast(name)).ToLocal(&descriptor);
813 DCHECK(success); 813 DCHECK(success);
814 } 814 }
815 } 815 }
816 } 816 }
817 817
818 } // namespace blink 818 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698