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

Side by Side Diff: gin/converter.cc

Issue 1112923003: Replace Handle<> with Local in remaining gin/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « gin/converter.h ('k') | gin/converter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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::ArrayBuffer; 9 using v8::ArrayBuffer;
10 using v8::Boolean; 10 using v8::Boolean;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 *out = Handle<ArrayBuffer>::Cast(val); 159 *out = Handle<ArrayBuffer>::Cast(val);
160 return true; 160 return true;
161 } 161 }
162 162
163 Handle<Value> Converter<Handle<External> >::ToV8(Isolate* isolate, 163 Handle<Value> Converter<Handle<External> >::ToV8(Isolate* isolate,
164 Handle<External> val) { 164 Handle<External> val) {
165 return val.As<Value>(); 165 return val.As<Value>();
166 } 166 }
167 167
168 bool Converter<Handle<External> >::FromV8(Isolate* isolate, 168 bool Converter<Handle<External> >::FromV8(Isolate* isolate,
169 v8::Handle<Value> val, 169 v8::Local<Value> val,
170 Handle<External>* out) { 170 Handle<External>* out) {
171 if (!val->IsExternal()) 171 if (!val->IsExternal())
172 return false; 172 return false;
173 *out = Handle<External>::Cast(val); 173 *out = Handle<External>::Cast(val);
174 return true; 174 return true;
175 } 175 }
176 176
177 Handle<Value> Converter<Handle<Value> >::ToV8(Isolate* isolate, 177 Handle<Value> Converter<Handle<Value> >::ToV8(Isolate* isolate,
178 Handle<Value> val) { 178 Handle<Value> val) {
179 return val; 179 return val;
180 } 180 }
181 181
182 bool Converter<Handle<Value> >::FromV8(Isolate* isolate, Handle<Value> val, 182 bool Converter<Handle<Value> >::FromV8(Isolate* isolate, Handle<Value> val,
183 Handle<Value>* out) { 183 Handle<Value>* out) {
184 *out = val; 184 *out = val;
185 return true; 185 return true;
186 } 186 }
187 187
188 v8::Handle<v8::String> StringToSymbol(v8::Isolate* isolate, 188 v8::Local<v8::String> StringToSymbol(v8::Isolate* isolate,
189 const base::StringPiece& val) { 189 const base::StringPiece& val) {
190 return String::NewFromUtf8(isolate, 190 return String::NewFromUtf8(isolate,
191 val.data(), 191 val.data(),
192 String::kInternalizedString, 192 String::kInternalizedString,
193 static_cast<uint32_t>(val.length())); 193 static_cast<uint32_t>(val.length()));
194 } 194 }
195 195
196 std::string V8ToString(v8::Handle<v8::Value> value) { 196 std::string V8ToString(v8::Local<v8::Value> value) {
197 if (value.IsEmpty()) 197 if (value.IsEmpty())
198 return std::string(); 198 return std::string();
199 std::string result; 199 std::string result;
200 if (!ConvertFromV8(NULL, value, &result)) 200 if (!ConvertFromV8(NULL, value, &result))
201 return std::string(); 201 return std::string();
202 return result; 202 return result;
203 } 203 }
204 204
205 } // namespace gin 205 } // namespace gin
OLDNEW
« no previous file with comments | « gin/converter.h ('k') | gin/converter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698