Pass synchronous messages by JSON string.

We are going to use IPC_MESSAGE_HANDLER_DELAY_REPLY to handle
synchronous messages but DictionaryValue is not copyable, so we pass the
JSON string instead.
This commit is contained in:
Cheng Zhao 2013-09-20 22:32:59 +08:00
parent 07b5039c64
commit ef5a4b5fe0
10 changed files with 44 additions and 20 deletions

View file

@ -97,12 +97,12 @@ v8::Handle<v8::Value> RendererIPC::SendSync(const v8::Arguments &args) {
RenderView* render_view = GetCurrentRenderView();
base::DictionaryValue result;
std::string json;
IPC::SyncMessage* message = new AtomViewHostMsg_Message_Sync(
render_view->GetRoutingID(),
channel,
*static_cast<base::ListValue*>(arguments.get()),
&result);
&json);
// Enable the UI thread in browser to receive messages.
message->EnableMessagePumping();
bool success = render_view->Send(message);
@ -110,7 +110,7 @@ v8::Handle<v8::Value> RendererIPC::SendSync(const v8::Arguments &args) {
if (!success)
return node::ThrowError("Unable to send AtomViewHostMsg_Message_Sync");
return scope.Close(converter->ToV8Value(&result, context));
return scope.Close(v8::String::New(json.data(), json.size()));
}
// static