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