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

Unified Diff: content/renderer/pepper/v8_var_converter.cc

Issue 331593002: Change V8VarConverter::FromV8Value to complete synchronously if possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/pepper/v8_var_converter.h ('k') | content/renderer/pepper/v8_var_converter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/v8_var_converter.cc
diff --git a/content/renderer/pepper/v8_var_converter.cc b/content/renderer/pepper/v8_var_converter.cc
index bc1a25347aac0c4cdaef8a09a101afe8adb2090c..b1eb2ac439852716a4ed72bbd2be5d8404d951f0 100644
--- a/content/renderer/pepper/v8_var_converter.cc
+++ b/content/renderer/pepper/v8_var_converter.cc
@@ -395,18 +395,19 @@ bool V8VarConverter::ToV8Value(const PP_Var& var,
return true;
}
-void V8VarConverter::FromV8Value(
+V8VarConverter::VarResult V8VarConverter::FromV8Value(
v8::Handle<v8::Value> val,
v8::Handle<v8::Context> context,
const base::Callback<void(const ScopedPPVar&, bool)>& callback) {
- ScopedPPVar result_var;
- if (FromV8ValueInternal(val, context, &result_var)) {
- resource_converter_->Flush(base::Bind(callback, result_var));
- } else {
- message_loop_proxy_->PostTask(
- FROM_HERE,
- base::Bind(callback, result_var, false));
- }
+ VarResult result;
+ result.success = FromV8ValueInternal(val, context, &result.var);
+ if (!result.success)
+ resource_converter_->Reset();
+ result.completed_synchronously = !resource_converter_->NeedsFlush();
+ if (!result.completed_synchronously)
+ resource_converter_->Flush(base::Bind(callback, result.var));
+
+ return result;
}
bool V8VarConverter::FromV8ValueInternal(
« no previous file with comments | « content/renderer/pepper/v8_var_converter.h ('k') | content/renderer/pepper/v8_var_converter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698