| 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 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 resource_converter_->Flush(base::Bind(callback, result.var)); | 443 resource_converter_->Flush(base::Bind(callback, result.var)); |
| 444 | 444 |
| 445 return result; | 445 return result; |
| 446 } | 446 } |
| 447 | 447 |
| 448 bool V8VarConverter::FromV8ValueSync( | 448 bool V8VarConverter::FromV8ValueSync( |
| 449 v8::Handle<v8::Value> val, | 449 v8::Handle<v8::Value> val, |
| 450 v8::Handle<v8::Context> context, | 450 v8::Handle<v8::Context> context, |
| 451 ppapi::ScopedPPVar* result_var) { | 451 ppapi::ScopedPPVar* result_var) { |
| 452 bool success = FromV8ValueInternal(val, context, result_var); | 452 bool success = FromV8ValueInternal(val, context, result_var); |
| 453 if (!success || resource_converter_->NeedsFlush()) { | 453 if (!success) { |
| 454 resource_converter_->Reset(); | 454 resource_converter_->Reset(); |
| 455 return false; | 455 return false; |
| 456 } | 456 } |
| 457 if (resource_converter_->NeedsFlush()) { |
| 458 resource_converter_->FlushSync(); |
| 459 } |
| 457 return true; | 460 return true; |
| 458 } | 461 } |
| 459 | 462 |
| 460 bool V8VarConverter::FromV8ValueInternal( | 463 bool V8VarConverter::FromV8ValueInternal( |
| 461 v8::Handle<v8::Value> val, | 464 v8::Handle<v8::Value> val, |
| 462 v8::Handle<v8::Context> context, | 465 v8::Handle<v8::Context> context, |
| 463 ppapi::ScopedPPVar* result_var) { | 466 ppapi::ScopedPPVar* result_var) { |
| 464 v8::Context::Scope context_scope(context); | 467 v8::Context::Scope context_scope(context); |
| 465 v8::HandleScope handle_scope(context->GetIsolate()); | 468 v8::HandleScope handle_scope(context->GetIsolate()); |
| 466 | 469 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 std::string(*name_utf8, name_utf8.length()), child_var); | 598 std::string(*name_utf8, name_utf8.length()), child_var); |
| 596 DCHECK(success); | 599 DCHECK(success); |
| 597 } | 600 } |
| 598 } | 601 } |
| 599 } | 602 } |
| 600 *result_var = root; | 603 *result_var = root; |
| 601 return true; | 604 return true; |
| 602 } | 605 } |
| 603 | 606 |
| 604 } // namespace content | 607 } // namespace content |
| OLD | NEW |