OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 #include "bindings/core/v8/PropertyBag.h" |
| 7 |
| 8 namespace blink { |
| 9 |
| 10 bool PropertyBag::getInternal(v8::Handle<v8::Value>& v8Value, String& value) |
| 11 { |
| 12 TOSTRING_DEFAULT(V8StringResource<>, stringValue, v8Value, false); |
| 13 value = stringValue; |
| 14 return true; |
| 15 } |
| 16 |
| 17 bool PropertyBag::getInternal(v8::Handle<v8::Value>& v8Value, int& value) |
| 18 { |
| 19 v8::Local<v8::Int32> v8Int32 = v8Value->ToInt32(); |
| 20 if (v8Int32.IsEmpty()) |
| 21 return false; |
| 22 value = toInt32(v8Int32); |
| 23 return true; |
| 24 } |
| 25 |
| 26 bool PropertyBag::getInternal(v8::Handle<v8::Value>& v8Value, bool& value) |
| 27 { |
| 28 v8::Local<v8::Boolean> v8Boolean = v8Value->ToBoolean(); |
| 29 if (v8Boolean.IsEmpty()) |
| 30 return false; |
| 31 value = v8Boolean->Value(); |
| 32 return true; |
| 33 } |
| 34 |
| 35 bool PropertyBag::getInternal(v8::Handle<v8::Value>& v8Value, double& value) |
| 36 { |
| 37 v8::Local<v8::Number> v8Number = v8Value->ToNumber(); |
| 38 if (v8Number.IsEmpty()) |
| 39 return false; |
| 40 value = v8Number->Value(); |
| 41 return true; |
| 42 } |
| 43 |
| 44 } // namespace blink |
OLD | NEW |