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

Unified Diff: ppapi/cpp/instance.h

Issue 16140011: Don't send PP_Vars/V8 values with cycles across PostMessage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « ppapi/c/ppp_messaging.h ('k') | ppapi/proxy/handle_converter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/instance.h
diff --git a/ppapi/cpp/instance.h b/ppapi/cpp/instance.h
index 48bca905c90c6d1c29660c0fdc273e300a48b4b4..6bf4e839381c3d371f0af86f88effabb37b31f21 100644
--- a/ppapi/cpp/instance.h
+++ b/ppapi/cpp/instance.h
@@ -244,6 +244,12 @@ class Instance {
/// JavaScript execution will not be blocked while HandleMessage() is
/// processing the message.
///
+ /// When converting JavaScript arrays, any object properties whose name
+ /// is not an array index are ignored. When passing arrays and objects, the
+ /// entire reference graph will be converted and transferred. If the reference
+ /// graph has cycles, the message will not be sent and an error will be logged
+ /// to the console.
+ ///
/// <strong>Example:</strong>
///
/// The following JavaScript code invokes <code>HandleMessage</code>, passing
@@ -264,9 +270,10 @@ class Instance {
///
/// Refer to PostMessage() for sending messages to JavaScript.
///
- /// @param[in] message A <code>Var</code> containing the data sent from
- /// JavaScript. Message can have an int32_t, double, bool, or string value
- /// (objects are not supported).
+ /// @param[in] message A <code>Var</code> which has been converted from a
+ /// JavaScript value. JavaScript array/object types are supported from Chrome
+ /// M29 onward. All JavaScript values are copied when passing them to the
+ /// plugin.
virtual void HandleMessage(const Var& message);
/// @}
@@ -453,6 +460,11 @@ class Instance {
///
/// The browser will pop-up an alert saying "Hello world!"
///
+ /// When passing array or dictionary <code>PP_Var</code>s, the entire
+ /// reference graph will be converted and transferred. If the reference graph
+ /// has cycles, the message will not be sent and an error will be logged to
+ /// the console.
+ ///
/// Listeners for message events in JavaScript code will receive an object
/// conforming to the HTML 5 <code>MessageEvent</code> interface.
/// Specifically, the value of message will be contained as a property called
@@ -466,9 +478,9 @@ class Instance {
/// Refer to HandleMessage() for receiving events from JavaScript.
///
/// @param[in] message A <code>Var</code> containing the data to be sent to
- /// JavaScript. Message can have a numeric, boolean, or string value; arrays
- /// and dictionaries are not yet supported. Ref-counted var types are copied,
- /// and are therefore not shared between the instance and the browser.
+ /// JavaScript. Message can have a numeric, boolean, or string value.
+ /// Array/Dictionary types are supported from Chrome M29 onward.
+ /// All var types are copied when passing them to JavaScript.
void PostMessage(const Var& message);
/// @}
« no previous file with comments | « ppapi/c/ppp_messaging.h ('k') | ppapi/proxy/handle_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698