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

Side by Side Diff: third_party/WebKit/Source/platform/inspector_protocol/Parser.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/inspector_protocol/Parser.h" 5 #include "platform/inspector_protocol/Parser.h"
6 6
7 #include "platform/inspector_protocol/String16.h" 7 #include "platform/inspector_protocol/String16.h"
8 #include "platform/inspector_protocol/Values.h" 8 #include "platform/inspector_protocol/Values.h"
9 9
10 namespace blink { 10 namespace blink {
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 result = FundamentalValue::create(true); 375 result = FundamentalValue::create(true);
376 break; 376 break;
377 case BoolFalse: 377 case BoolFalse:
378 result = FundamentalValue::create(false); 378 result = FundamentalValue::create(false);
379 break; 379 break;
380 case Number: { 380 case Number: {
381 bool ok; 381 bool ok;
382 double value = String16::charactersToDouble(tokenStart, tokenEnd - token Start, &ok); 382 double value = String16::charactersToDouble(tokenStart, tokenEnd - token Start, &ok);
383 if (!ok) 383 if (!ok)
384 return nullptr; 384 return nullptr;
385 result = FundamentalValue::create(value); 385 int number = static_cast<int>(value);
386 if (number == value)
387 result = FundamentalValue::create(number);
388 else
389 result = FundamentalValue::create(value);
386 break; 390 break;
387 } 391 }
388 case StringLiteral: { 392 case StringLiteral: {
389 String16 value; 393 String16 value;
390 bool ok = decodeString(tokenStart + 1, tokenEnd - 1, &value); 394 bool ok = decodeString(tokenStart + 1, tokenEnd - 1, &value);
391 if (!ok) 395 if (!ok)
392 return nullptr; 396 return nullptr;
393 result = StringValue::create(value); 397 result = StringValue::create(value);
394 break; 398 break;
395 } 399 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 490
487 std::unique_ptr<Value> parseJSON(const String16& json) 491 std::unique_ptr<Value> parseJSON(const String16& json)
488 { 492 {
489 if (json.isEmpty()) 493 if (json.isEmpty())
490 return nullptr; 494 return nullptr;
491 return parseJSONInternal(json.characters16(), json.length()); 495 return parseJSONInternal(json.characters16(), json.length());
492 } 496 }
493 497
494 } // namespace protocol 498 } // namespace protocol
495 } // namespace blink 499 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698