| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 ScopedPPVar result_var; | 402 ScopedPPVar result_var; |
| 403 if (FromV8ValueInternal(val, context, &result_var)) { | 403 if (FromV8ValueInternal(val, context, &result_var)) { |
| 404 resource_converter_->Flush(base::Bind(callback, result_var)); | 404 resource_converter_->Flush(base::Bind(callback, result_var)); |
| 405 } else { | 405 } else { |
| 406 message_loop_proxy_->PostTask( | 406 message_loop_proxy_->PostTask( |
| 407 FROM_HERE, | 407 FROM_HERE, |
| 408 base::Bind(callback, result_var, false)); | 408 base::Bind(callback, result_var, false)); |
| 409 } | 409 } |
| 410 } | 410 } |
| 411 | 411 |
| 412 bool V8VarConverter::FromV8ValueSync( |
| 413 v8::Handle<v8::Value> val, |
| 414 v8::Handle<v8::Context> context, |
| 415 ppapi::ScopedPPVar* result_var) { |
| 416 if (!FromV8ValueInternal(val, context, result_var)) |
| 417 return false; |
| 418 return resource_converter_->FlushSync(); |
| 419 } |
| 420 |
| 412 bool V8VarConverter::FromV8ValueInternal( | 421 bool V8VarConverter::FromV8ValueInternal( |
| 413 v8::Handle<v8::Value> val, | 422 v8::Handle<v8::Value> val, |
| 414 v8::Handle<v8::Context> context, | 423 v8::Handle<v8::Context> context, |
| 415 ppapi::ScopedPPVar* result_var) { | 424 ppapi::ScopedPPVar* result_var) { |
| 416 v8::Context::Scope context_scope(context); | 425 v8::Context::Scope context_scope(context); |
| 417 v8::HandleScope handle_scope(context->GetIsolate()); | 426 v8::HandleScope handle_scope(context->GetIsolate()); |
| 418 | 427 |
| 419 HandleVarMap visited_handles; | 428 HandleVarMap visited_handles; |
| 420 ParentHandleSet parent_handles; | 429 ParentHandleSet parent_handles; |
| 421 | 430 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 std::string(*name_utf8, name_utf8.length()), child_var); | 550 std::string(*name_utf8, name_utf8.length()), child_var); |
| 542 DCHECK(success); | 551 DCHECK(success); |
| 543 } | 552 } |
| 544 } | 553 } |
| 545 } | 554 } |
| 546 *result_var = root; | 555 *result_var = root; |
| 547 return true; | 556 return true; |
| 548 } | 557 } |
| 549 | 558 |
| 550 } // namespace content | 559 } // namespace content |
| OLD | NEW |