OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "content/renderer/pepper/v8_var_converter.h" | 5 #include "content/renderer/pepper/v8_var_converter.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <stack> | 8 #include <stack> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 } else if (val->IsInt32()) { | 199 } else if (val->IsInt32()) { |
200 *result = PP_MakeInt32(val->ToInt32()->Value()); | 200 *result = PP_MakeInt32(val->ToInt32()->Value()); |
201 } else if (val->IsNumber() || val->IsNumberObject()) { | 201 } else if (val->IsNumber() || val->IsNumberObject()) { |
202 *result = PP_MakeDouble(val->ToNumber()->Value()); | 202 *result = PP_MakeDouble(val->ToNumber()->Value()); |
203 } else if (val->IsString() || val->IsStringObject()) { | 203 } else if (val->IsString() || val->IsStringObject()) { |
204 v8::String::Utf8Value utf8(val->ToString()); | 204 v8::String::Utf8Value utf8(val->ToString()); |
205 *result = StringVar::StringToPPVar(std::string(*utf8, utf8.length())); | 205 *result = StringVar::StringToPPVar(std::string(*utf8, utf8.length())); |
206 } else if (val->IsArray()) { | 206 } else if (val->IsArray()) { |
207 *result = (new ArrayVar())->GetPPVar(); | 207 *result = (new ArrayVar())->GetPPVar(); |
208 } else if (val->IsObject()) { | 208 } else if (val->IsObject()) { |
209 scoped_ptr<WebKit::WebArrayBuffer> web_array_buffer( | 209 scoped_ptr<blink::WebArrayBuffer> web_array_buffer( |
210 WebKit::WebArrayBuffer::createFromV8Value(val)); | 210 blink::WebArrayBuffer::createFromV8Value(val)); |
211 if (web_array_buffer.get()) { | 211 if (web_array_buffer.get()) { |
212 scoped_refptr<HostArrayBufferVar> buffer_var(new HostArrayBufferVar( | 212 scoped_refptr<HostArrayBufferVar> buffer_var(new HostArrayBufferVar( |
213 *web_array_buffer)); | 213 *web_array_buffer)); |
214 *result = buffer_var->GetPPVar(); | 214 *result = buffer_var->GetPPVar(); |
215 } else { | 215 } else { |
216 bool was_resource; | 216 bool was_resource; |
217 if (!resource_converter->FromV8Value(val->ToObject(), context, result, | 217 if (!resource_converter->FromV8Value(val->ToObject(), context, result, |
218 &was_resource)) | 218 &was_resource)) |
219 return false; | 219 return false; |
220 if (!was_resource) { | 220 if (!was_resource) { |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 bool success = dict_var->SetWithStringKey( | 507 bool success = dict_var->SetWithStringKey( |
508 std::string(*name_utf8, name_utf8.length()), child_var); | 508 std::string(*name_utf8, name_utf8.length()), child_var); |
509 DCHECK(success); | 509 DCHECK(success); |
510 } | 510 } |
511 } | 511 } |
512 } | 512 } |
513 resource_converter_->Flush(base::Bind(callback, root)); | 513 resource_converter_->Flush(base::Bind(callback, root)); |
514 } | 514 } |
515 | 515 |
516 } // namespace content | 516 } // namespace content |
OLD | NEW |