OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gin/converter.h" | 5 #include "gin/converter.h" |
6 | 6 |
7 #include "v8/include/v8.h" | 7 #include "v8/include/v8.h" |
8 | 8 |
9 using v8::Boolean; | 9 using v8::Boolean; |
10 using v8::Function; | 10 using v8::Function; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 | 118 |
119 bool Converter<Handle<Object> >::FromV8(Handle<Value> val, | 119 bool Converter<Handle<Object> >::FromV8(Handle<Value> val, |
120 Handle<Object>* out) { | 120 Handle<Object>* out) { |
121 if (!val->IsObject()) | 121 if (!val->IsObject()) |
122 return false; | 122 return false; |
123 *out = Handle<Object>::Cast(val); | 123 *out = Handle<Object>::Cast(val); |
124 return true; | 124 return true; |
125 } | 125 } |
126 | 126 |
| 127 Handle<Value> Converter<Handle<Value> >::ToV8(v8::Isolate* isolate, |
| 128 Handle<Value> val) { |
| 129 return val; |
| 130 } |
| 131 |
| 132 bool Converter<Handle<Value> >::FromV8(Handle<Value> val, |
| 133 Handle<Value>* out) { |
| 134 *out = val; |
| 135 return true; |
| 136 } |
| 137 |
127 v8::Handle<v8::String> StringToSymbol(v8::Isolate* isolate, | 138 v8::Handle<v8::String> StringToSymbol(v8::Isolate* isolate, |
128 const std::string& val) { | 139 const std::string& val) { |
129 return String::NewFromUtf8(isolate, | 140 return String::NewFromUtf8(isolate, |
130 val.data(), | 141 val.data(), |
131 String::kInternalizedString, | 142 String::kInternalizedString, |
132 static_cast<uint32_t>(val.length())); | 143 static_cast<uint32_t>(val.length())); |
133 } | 144 } |
134 | 145 |
135 | 146 |
136 } // namespace gin | 147 } // namespace gin |
OLD | NEW |