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

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

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/resource_converter.cc ('k') | content/renderer/pepper/v8_var_converter.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.h
diff --git a/content/renderer/pepper/v8_var_converter.h b/content/renderer/pepper/v8_var_converter.h
index 34230235aeaf870d37a6b30e813f899839e20e0a..97adc33616425d9c1d11f968cbbc3a5a88672da8 100644
--- a/content/renderer/pepper/v8_var_converter.h
+++ b/content/renderer/pepper/v8_var_converter.h
@@ -11,13 +11,10 @@
#include "base/message_loop/message_loop_proxy.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/scoped_pp_var.h"
#include "v8/include/v8.h"
#include "content/common/content_export.h"
-namespace ppapi {
-class ScopedPPVar;
-}
-
namespace content {
class ResourceConverter;
@@ -35,14 +32,33 @@ class CONTENT_EXPORT V8VarConverter {
v8::Handle<v8::Context> context,
v8::Handle<v8::Value>* result);
+ struct VarResult {
+ public:
+ VarResult() : completed_synchronously(false), success(false) {}
+
+ // True if the conversion completed synchronously and the callback will not
+ // be called.
+ bool completed_synchronously;
+
+ // True if the conversion was successful. Only valid if
+ // |completed_synchronously| is true.
+ bool success;
+
+ // The result if the conversion was successful. Only valid if
+ // |completed_synchronously| and |success| are true.
+ ppapi::ScopedPPVar var;
+ };
+
// Converts the given v8::Value to a PP_Var. Every PP_Var in the reference
// graph in the result will have a refcount equal to the number of references
// to it in the graph. The root of the result will have one additional
// reference. The callback is run when conversion is complete with the
- // resulting var and a bool indicating success or failure. Conversion is
+ // resulting var and a bool indicating success or failure. Conversion may be
// asynchronous because converting some resources may result in communication
- // across IPC. |context| is guaranteed to only be used synchronously.
- void FromV8Value(
+ // across IPC. |context| is guaranteed to only be used synchronously. If
+ // the conversion can occur synchronously, |callback| will not be run,
+ // otherwise it will be run.
+ VarResult FromV8Value(
v8::Handle<v8::Value> val,
v8::Handle<v8::Context> context,
const base::Callback<void(const ppapi::ScopedPPVar&, bool)>& callback);
« no previous file with comments | « content/renderer/pepper/resource_converter.cc ('k') | content/renderer/pepper/v8_var_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698