Send reply for sync messages when event.returnValue is set.

This commit is contained in:
Cheng Zhao 2013-09-22 09:52:58 +08:00
parent ef4b36d621
commit d443b36446
6 changed files with 70 additions and 16 deletions

View file

@ -9,6 +9,11 @@
#include "base/string16.h"
#include "vendor/node/src/node_object_wrap.h"
namespace IPC {
class Message;
class Sender;
}
namespace atom {
namespace api {
@ -23,6 +28,9 @@ class Event : public node::ObjectWrap {
// Get JSON string of the event.returnValue from a Event object.
static string16 GetReturnValue(v8::Handle<v8::Object> event);
// Pass the sender and message to be replied.
void SetSenderAndMessage(IPC::Sender* sender, IPC::Message* message);
// Accessor to return handle_, this follows Google C++ Style.
v8::Persistent<v8::Object>& handle() { return handle_; }
@ -33,11 +41,17 @@ class Event : public node::ObjectWrap {
Event();
private:
static v8::Handle<v8::Value> New(const v8::Arguments &args);
static v8::Handle<v8::Value> PreventDefault(const v8::Arguments &args);
static v8::Handle<v8::Value> New(const v8::Arguments& args);
static v8::Handle<v8::Value> PreventDefault(const v8::Arguments& args);
static v8::Handle<v8::Value> SendReply(const v8::Arguments& args);
static v8::Persistent<v8::FunctionTemplate> constructor_template_;
// Replyer for the synchronous messages.
IPC::Sender* sender_;
IPC::Message* message_;
bool prevent_default_;
DISALLOW_COPY_AND_ASSIGN(Event);