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

Side by Side Diff: Source/bindings/v8/V8Binding.h

Issue 313993002: Bindings: Add ScalarValueString support (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move out of Source/wtf Created 6 years, 6 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 | Annotate | Revision Log
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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 521
522 // Convert a value to a single precision float assuming the conversion cannot fa il. 522 // Convert a value to a single precision float assuming the conversion cannot fa il.
523 inline float toFloat(v8::Local<v8::Value> value) 523 inline float toFloat(v8::Local<v8::Value> value)
524 { 524 {
525 return static_cast<float>(value->NumberValue()); 525 return static_cast<float>(value->NumberValue());
526 } 526 }
527 527
528 // Converts a value to a String, throwing if any code unit is outside 0-255. 528 // Converts a value to a String, throwing if any code unit is outside 0-255.
529 String toByteString(v8::Handle<v8::Value>, ExceptionState&); 529 String toByteString(v8::Handle<v8::Value>, ExceptionState&);
530 530
531 // Converts a value to a String, replacing unmatched UTF-16 surrogates with repl acement characters.
532 String toScalarValueString(v8::Handle<v8::Value>, ExceptionState&);
533
531 inline v8::Handle<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate) 534 inline v8::Handle<v8::Boolean> v8Boolean(bool value, v8::Isolate* isolate)
532 { 535 {
533 return value ? v8::True(isolate) : v8::False(isolate); 536 return value ? v8::True(isolate) : v8::False(isolate);
534 } 537 }
535 538
536 inline double toCoreDate(v8::Handle<v8::Value> object) 539 inline double toCoreDate(v8::Handle<v8::Value> object)
537 { 540 {
538 if (object->IsDate()) 541 if (object->IsDate())
539 return v8::Handle<v8::Date>::Cast(object)->ValueOf(); 542 return v8::Handle<v8::Date>::Cast(object)->ValueOf();
540 if (object->IsNumber()) 543 if (object->IsNumber())
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 m_block.Reset(); 966 m_block.Reset();
964 } 967 }
965 968
966 private: 969 private:
967 v8::TryCatch& m_block; 970 v8::TryCatch& m_block;
968 }; 971 };
969 972
970 } // namespace WebCore 973 } // namespace WebCore
971 974
972 #endif // V8Binding_h 975 #endif // V8Binding_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698