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

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

Issue 1051753003: bindings: Add toBoolean() to V8Binding.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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 /* 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 return v8::Handle<v8::Value>(); 380 return v8::Handle<v8::Value>();
381 } 381 }
382 382
383 // Conversion flags, used in toIntXX/toUIntXX. 383 // Conversion flags, used in toIntXX/toUIntXX.
384 enum IntegerConversionConfiguration { 384 enum IntegerConversionConfiguration {
385 NormalConversion, 385 NormalConversion,
386 EnforceRange, 386 EnforceRange,
387 Clamp 387 Clamp
388 }; 388 };
389 389
390 // Convert a value to a boolean.
391 bool toBooleanSlow(v8::Isolate*, v8::Local<v8::Value>, ExceptionState&);
vivekg 2015/04/10 07:17:30 Should we export this symbol using CORE_EXPORT?
bashi 2015/04/10 07:25:20 Done.
392 inline bool toBoolean(v8::Isolate* isolate, v8::Local<v8::Value> value, Exceptio nState& exceptionState)
393 {
394 if (LIKELY(value->IsBoolean()))
395 return value.As<v8::Boolean>()->Value();
396 return toBooleanSlow(isolate, value, exceptionState);
397 }
398
390 // Convert a value to a 8-bit signed integer. The conversion fails if the 399 // Convert a value to a 8-bit signed integer. The conversion fails if the
391 // value cannot be converted to a number or the range violated per WebIDL: 400 // value cannot be converted to a number or the range violated per WebIDL:
392 // http://www.w3.org/TR/WebIDL/#es-byte 401 // http://www.w3.org/TR/WebIDL/#es-byte
393 int8_t toInt8(v8::Isolate*, v8::Handle<v8::Value>, IntegerConversionConfiguratio n, ExceptionState&); 402 int8_t toInt8(v8::Isolate*, v8::Handle<v8::Value>, IntegerConversionConfiguratio n, ExceptionState&);
394 403
395 // Convert a value to a 8-bit unsigned integer. The conversion fails if the 404 // Convert a value to a 8-bit unsigned integer. The conversion fails if the
396 // value cannot be converted to a number or the range violated per WebIDL: 405 // value cannot be converted to a number or the range violated per WebIDL:
397 // http://www.w3.org/TR/WebIDL/#es-octet 406 // http://www.w3.org/TR/WebIDL/#es-octet
398 uint8_t toUInt8(v8::Isolate*, v8::Handle<v8::Value>, IntegerConversionConfigurat ion, ExceptionState&); 407 uint8_t toUInt8(v8::Isolate*, v8::Handle<v8::Value>, IntegerConversionConfigurat ion, ExceptionState&);
399 408
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate*, ExecutionContext*, v8::Handle<v8::Function>); 999 PassRefPtr<TraceEvent::ConvertableToTraceFormat> devToolsTraceEventData(v8::Isol ate*, ExecutionContext*, v8::Handle<v8::Function>);
991 1000
992 // Callback functions used by generated code. 1001 // Callback functions used by generated code.
993 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName, const v8::PropertyCallbackInfo<v8::Value>&); 1002 CORE_EXPORT void v8ConstructorAttributeGetter(v8::Local<v8::Name> propertyName, const v8::PropertyCallbackInfo<v8::Value>&);
994 1003
995 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); 1004 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*);
996 1005
997 } // namespace blink 1006 } // namespace blink
998 1007
999 #endif // V8Binding_h 1008 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8Binding.cpp » ('j') | Source/bindings/tests/results/core/V8TestDictionary.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698