Index: Source/bindings/core/v8/PropertyBag.cpp |
diff --git a/Source/bindings/core/v8/PropertyBag.cpp b/Source/bindings/core/v8/PropertyBag.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ccc465556dd00ac094f09240ce2c3ec1a3d813c2 |
--- /dev/null |
+++ b/Source/bindings/core/v8/PropertyBag.cpp |
@@ -0,0 +1,44 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "config.h" |
+#include "bindings/core/v8/PropertyBag.h" |
+ |
+namespace blink { |
+ |
+bool PropertyBag::getInternal(v8::Handle<v8::Value>& v8Value, String& value) |
+{ |
+ TOSTRING_DEFAULT(V8StringResource<>, stringValue, v8Value, false); |
+ value = stringValue; |
+ return true; |
+} |
+ |
+bool PropertyBag::getInternal(v8::Handle<v8::Value>& v8Value, int& value) |
+{ |
+ v8::Local<v8::Int32> v8Int32 = v8Value->ToInt32(); |
+ if (v8Int32.IsEmpty()) |
+ return false; |
+ value = toInt32(v8Int32); |
+ return true; |
+} |
+ |
+bool PropertyBag::getInternal(v8::Handle<v8::Value>& v8Value, bool& value) |
+{ |
+ v8::Local<v8::Boolean> v8Boolean = v8Value->ToBoolean(); |
+ if (v8Boolean.IsEmpty()) |
+ return false; |
+ value = v8Boolean->Value(); |
+ return true; |
+} |
+ |
+bool PropertyBag::getInternal(v8::Handle<v8::Value>& v8Value, double& value) |
+{ |
+ v8::Local<v8::Number> v8Number = v8Value->ToNumber(); |
+ if (v8Number.IsEmpty()) |
+ return false; |
+ value = v8Number->Value(); |
+ return true; |
+} |
+ |
+} // namespace blink |