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

Side by Side Diff: Source/bindings/core/v8/V8Binding.cpp

Issue 967293002: [bindings] Make toFloat inline (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed stale code Created 5 years, 9 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 | « Source/bindings/core/v8/V8Binding.h ('k') | Source/bindings/core/v8/V8BindingTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 doubleToInteger(numberValue, integer); 498 doubleToInteger(numberValue, integer);
499 return integer; 499 return integer;
500 } 500 }
501 501
502 uint64_t toUInt64(v8::Handle<v8::Value> value) 502 uint64_t toUInt64(v8::Handle<v8::Value> value)
503 { 503 {
504 NonThrowableExceptionState exceptionState; 504 NonThrowableExceptionState exceptionState;
505 return toUInt64(value, NormalConversion, exceptionState); 505 return toUInt64(value, NormalConversion, exceptionState);
506 } 506 }
507 507
508 float toFloat(v8::Handle<v8::Value> value, ExceptionState& exceptionState)
509 {
510 return static_cast<float>(toDouble(value, exceptionState));
511 }
512
513 float toRestrictedFloat(v8::Handle<v8::Value> value, ExceptionState& exceptionSt ate) 508 float toRestrictedFloat(v8::Handle<v8::Value> value, ExceptionState& exceptionSt ate)
514 { 509 {
515 float numberValue = toFloat(value, exceptionState); 510 float numberValue = toFloat(value, exceptionState);
516 if (exceptionState.hadException()) 511 if (exceptionState.hadException())
517 return 0; 512 return 0;
518 if (!std::isfinite(numberValue)) { 513 if (!std::isfinite(numberValue)) {
519 exceptionState.throwTypeError("The provided float value is non-finite.") ; 514 exceptionState.throwTypeError("The provided float value is non-finite.") ;
520 return 0; 515 return 0;
521 } 516 }
522 return numberValue; 517 return numberValue;
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 return m_resourceName; 1034 return m_resourceName;
1040 } 1035 }
1041 1036
1042 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate* isolate, ExecutionContext* context, v8::Handle<v8::Function> function) 1037 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate* isolate, ExecutionContext* context, v8::Handle<v8::Function> function)
1043 { 1038 {
1044 DevToolsFunctionInfo info(function); 1039 DevToolsFunctionInfo info(function);
1045 return InspectorFunctionCallEvent::data(context, info.scriptId(), info.resou rceName(), info.lineNumber()); 1040 return InspectorFunctionCallEvent::data(context, info.scriptId(), info.resou rceName(), info.lineNumber());
1046 } 1041 }
1047 1042
1048 } // namespace blink 1043 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/V8Binding.h ('k') | Source/bindings/core/v8/V8BindingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698