DescriptionConverted PluginResource reply message handling to use base::Callback
Previously each PluginResource had to write a reply handler (|OnReplyReceived|) for any replies to resource messages. This approach had several problems including the fact that the PluginResource had to track the state of any outstanding calls.
This change allows you to register a base::Callback when calling CallToBrowser/CallToRenderer. The callback will be run when a reply message is received with a sequence number matching the call. The parameters of the reply will be passed to the callback. An example of usage:
CallBrowser<PpapiPluginMsg_MyResourceType_MyReplyMessage>(
PpapiHostMsg_MyResourceType_MyRequestMessage(),
base::Bind(&MyPluginResource::ReplyHandler, this));
If a reply message to this call is received whose type does not match the expected reply message (for example, in the case of an error), the callback will still be invoked but with the default values of the message parameters.
BUG=
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=160015
Patch Set 1 #Patch Set 2 : . #Patch Set 3 : . #Patch Set 4 : . #Patch Set 5 : . #
Total comments: 14
Patch Set 6 : . #
Total comments: 2
Patch Set 7 : . #Patch Set 8 : . #Patch Set 9 : . #Patch Set 10 : . #Patch Set 11 : . #
Messages
Total messages: 11 (0 generated)
|