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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8Binding.h

Issue 2602723002: binding: Simplify v8DateOrNaN(). (Closed)
Patch Set: Created 3 years, 12 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 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Ericsson AB. All rights reserved. 3 * Copyright (C) 2012 Ericsson AB. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 if (!object->IsDate()) { 651 if (!object->IsDate()) {
652 exceptionState.throwTypeError("The provided value is not a Date."); 652 exceptionState.throwTypeError("The provided value is not a Date.");
653 return 0; 653 return 0;
654 } 654 }
655 return object.As<v8::Date>()->ValueOf(); 655 return object.As<v8::Date>()->ValueOf();
656 } 656 }
657 657
658 inline v8::MaybeLocal<v8::Value> v8DateOrNaN(v8::Isolate* isolate, 658 inline v8::MaybeLocal<v8::Value> v8DateOrNaN(v8::Isolate* isolate,
659 double value) { 659 double value) {
660 ASSERT(isolate); 660 ASSERT(isolate);
661 return v8::Date::New( 661 return v8::Date::New(isolate->GetCurrentContext(), value);
662 isolate->GetCurrentContext(),
663 std::isfinite(value) ? value : std::numeric_limits<double>::quiet_NaN());
664 } 662 }
665 663
666 // FIXME: Remove the special casing for NodeFilter and XPathNSResolver. 664 // FIXME: Remove the special casing for NodeFilter and XPathNSResolver.
667 NodeFilter* toNodeFilter(v8::Local<v8::Value>, 665 NodeFilter* toNodeFilter(v8::Local<v8::Value>,
668 v8::Local<v8::Object>, 666 v8::Local<v8::Object>,
669 ScriptState*); 667 ScriptState*);
670 XPathNSResolver* toXPathNSResolver(ScriptState*, v8::Local<v8::Value>); 668 XPathNSResolver* toXPathNSResolver(ScriptState*, v8::Local<v8::Value>);
671 669
672 bool toV8Sequence(v8::Local<v8::Value>, 670 bool toV8Sequence(v8::Local<v8::Value>,
673 uint32_t& length, 671 uint32_t& length,
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 // If the argument isn't an object, this will crash. 1165 // If the argument isn't an object, this will crash.
1168 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>, 1166 CORE_EXPORT v8::Local<v8::Value> freezeV8Object(v8::Local<v8::Value>,
1169 v8::Isolate*); 1167 v8::Isolate*);
1170 1168
1171 CORE_EXPORT v8::Local<v8::Value> fromJSONString(v8::Isolate*, 1169 CORE_EXPORT v8::Local<v8::Value> fromJSONString(v8::Isolate*,
1172 const String& stringifiedJSON, 1170 const String& stringifiedJSON,
1173 ExceptionState&); 1171 ExceptionState&);
1174 } // namespace blink 1172 } // namespace blink
1175 1173
1176 #endif // V8Binding_h 1174 #endif // V8Binding_h
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