Commit 1d4ecf49 authored by darin@chromium.org's avatar darin@chromium.org

Add support for exporting IPC messages from component DLLs.

This removes MessageWithTuple and MessageWithReply since it
is not easy to export a class that inherits from a template
specialization.  The functionality of those classes are split
now between new classes, MessageSchema and SyncMessageSchema,
and being declared inline via macros.

The key point is that we want to avoid inlining the constructor
and Read functions for messages.  That avoids code bloat since
those functions contain all of the parameter serialization and
deserialization code.  Those are the functions that we really
want to have contained with component DLLs.

To export IPC messages from a DLL, it is necessary to #define
IPC_MESSAGE_EXPORT above message declarations.  You can see this
in action here:
http://codereview.chromium.org/7687005/diff/41012/ppapi/proxy/ppapi_messages.h
Review URL: http://codereview.chromium.org/7768001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98491 0039d316-1c4b-4281-b951-d872f2087c98
parent 80f6c726
......@@ -17,18 +17,20 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/render_messages.h"
#include "content/common/pepper_plugin_registry.h"
#include "remoting/client/plugin/pepper_entrypoints.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "webkit/glue/user_agent.h"
#if defined(OS_WIN)
#include "content/common/sandbox_policy.h"
#include "sandbox/src/sandbox.h"
#endif
#include "webkit/glue/user_agent.h"
#if !defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds.
#include "chrome/common/render_messages.h"
#endif
namespace {
......@@ -288,6 +290,7 @@ void ChromeContentClient::AddPepperPlugins(
}
bool ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) {
#if !defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds.
// Any Chrome-specific messages that must be allowed to be sent from swapped
// out renderers.
switch (msg->type()) {
......@@ -296,11 +299,13 @@ bool ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) {
default:
break;
}
#endif
return false;
}
bool ChromeContentClient::CanHandleWhileSwappedOut(
const IPC::Message& msg) {
#if !defined(NACL_WIN64) // The code this needs isn't linked on Win64 builds.
// Any Chrome-specific messages (apart from those listed in
// CanSendWhileSwappedOut) that must be handled by the browser when sent from
// swapped out renderers.
......@@ -310,6 +315,7 @@ bool ChromeContentClient::CanHandleWhileSwappedOut(
default:
break;
}
#endif
return false;
}
......
......@@ -27,6 +27,7 @@
#include "content/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_platform_file.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
#include "ui/gfx/rect.h"
......
......@@ -51,7 +51,7 @@ static const char* const kBlockedPluginDataURL = "chrome://blockedplugindata/";
static const unsigned kMenuActionLoad = 1;
static const unsigned kMenuActionRemove = 2;
static const BlockedPlugin* gLastActiveMenu;
static const BlockedPlugin* g_last_active_menu;
BlockedPlugin::BlockedPlugin(RenderView* render_view,
WebFrame* frame,
......@@ -139,7 +139,7 @@ void BlockedPlugin::ShowContextMenu(const WebKit::WebMouseEvent& event) {
menu_data.customItems.swap(custom_items);
menu_data.mousePosition = WebPoint(event.windowX, event.windowY);
render_view()->showContextMenu(NULL, menu_data);
gLastActiveMenu = this;
g_last_active_menu = this;
}
bool BlockedPlugin::OnMessageReceived(const IPC::Message& message) {
......@@ -147,17 +147,11 @@ bool BlockedPlugin::OnMessageReceived(const IPC::Message& message) {
// custom menu IDs, and not just our own. We don't swallow
// ViewMsg_LoadBlockedPlugins because multiple blocked plugins have an
// interest in it.
if (message.type() == ViewMsg_CustomContextMenuAction::ID &&
gLastActiveMenu == this) {
ViewMsg_CustomContextMenuAction::Dispatch(
&message, this, this, &BlockedPlugin::OnMenuItemSelected);
} else {
IPC_BEGIN_MESSAGE_MAP(BlockedPlugin, message)
IPC_MESSAGE_HANDLER(ChromeViewMsg_LoadBlockedPlugins,
OnLoadBlockedPlugins)
IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsPrerendering, OnSetIsPrerendering)
IPC_END_MESSAGE_MAP()
}
IPC_BEGIN_MESSAGE_MAP(BlockedPlugin, message)
IPC_MESSAGE_HANDLER(ViewMsg_CustomContextMenuAction, OnMenuItemSelected)
IPC_MESSAGE_HANDLER(ChromeViewMsg_LoadBlockedPlugins, OnLoadBlockedPlugins)
IPC_MESSAGE_HANDLER(ChromeViewMsg_SetIsPrerendering, OnSetIsPrerendering)
IPC_END_MESSAGE_MAP()
return false;
}
......@@ -165,6 +159,8 @@ bool BlockedPlugin::OnMessageReceived(const IPC::Message& message) {
void BlockedPlugin::OnMenuItemSelected(
const webkit_glue::CustomContextMenuContext& /* ignored */,
unsigned id) {
if (g_last_active_menu != this)
return;
if (id == kMenuActionLoad) {
Send(new ViewHostMsg_UserMetricsRecordAction("Plugin_Load_Menu"));
LoadPlugin();
......
......@@ -264,7 +264,7 @@ MATCHER_P(MatchPacketMessage, packet_content, "") {
if (arg->type() != P2PMsg_OnDataReceived::ID)
return false;
P2PMsg_OnDataReceived::Param params;
IPC::MessageWithTuple<P2PMsg_OnDataReceived::Param>::Read(arg, &params);
P2PMsg_OnDataReceived::Read(arg, &params);
return params.c == packet_content;
}
......@@ -272,7 +272,7 @@ MATCHER_P(MatchIncomingSocketMessage, address, "") {
if (arg->type() != P2PMsg_OnIncomingTcpConnection::ID)
return false;
P2PMsg_OnIncomingTcpConnection::Param params;
IPC::MessageWithTuple<P2PMsg_OnIncomingTcpConnection::Param>::Read(
P2PMsg_OnIncomingTcpConnection::Read(
arg, &params);
return params.b == address;
}
......
......@@ -6,6 +6,7 @@
// Multiply-included message file, hence no include guard.
#include "base/file_util_proxy.h"
#include "googleurl/src/gurl.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_platform_file.h"
#include "webkit/fileapi/file_system_types.h"
......
......@@ -5,6 +5,7 @@
// Multiply-included message file, hence no include guard.
#include "base/basictypes.h"
#include "googleurl/src/gurl.h"
#include "ipc/ipc_message_macros.h"
#include "webkit/quota/quota_types.h"
......
......@@ -16,10 +16,12 @@
#include "content/common/renderer_preferences.h"
#include "content/common/webkit_param_traits.h"
#include "content/common/window_container_type.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_platform_file.h"
#include "media/base/media_log_event.h"
#include "net/base/host_port_pair.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderline.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFindOptions.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.h"
......
......@@ -9,6 +9,7 @@
'type': 'static_library',
'dependencies': [
'../base/base.gyp:base',
'../gpu/gpu.gyp:gpu_ipc',
'../ipc/ipc.gyp:ipc',
'../media/media.gyp:media',
'../net/net.gyp:net',
......
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -11,12 +11,31 @@
#include "base/threading/platform_thread.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_message_utils.h"
#include "ipc/ipc_message_utils_impl.h"
#include "ipc/ipc_tests.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/multiprocess_func_list.h"
// IPC messages for testing ---------------------------------------------------
#define IPC_MESSAGE_IMPL
#include "ipc/ipc_message_macros.h"
#define IPC_MESSAGE_START TestMsgStart
// Generic message class that is an int followed by a wstring.
IPC_MESSAGE_CONTROL2(MsgClassIS, int, std::wstring)
// Generic message class that is a wstring followed by an int.
IPC_MESSAGE_CONTROL2(MsgClassSI, std::wstring, int)
// Message to create a mutex in the IPC server, using the received name.
IPC_MESSAGE_CONTROL2(MsgDoMutex, std::wstring, int)
// Used to generate an ID for a message that should not exist.
IPC_MESSAGE_CONTROL0(MsgUnhandled)
// ----------------------------------------------------------------------------
TEST(IPCMessageIntegrity, ReadBeyondBufferStr) {
//This was BUG 984408.
uint32 v1 = kuint32max - 1;
......@@ -96,46 +115,6 @@ TEST(IPCMessageIntegrity, ReadVectorTooLarge2) {
EXPECT_FALSE(ReadParam(&m, &iter, &vec));
}
// We don't actually use the messages defined in this file, but we do this
// to get to the IPC macros.
#include "ipc/ipc_sync_message_unittest.h"
enum IPCMessageIds {
UNUSED_IPC_TYPE,
SERVER_FIRST_IPC_TYPE, // 1st Test message tag.
SERVER_SECOND_IPC_TYPE, // 2nd Test message tag.
SERVER_THIRD_IPC_TYPE, // 3rd Test message tag.
CLIENT_MALFORMED_IPC, // Sent to client if server detects bad message.
CLIENT_UNHANDLED_IPC // Sent to client if server detects unhanded IPC.
};
// Generic message class that is an int followed by a wstring.
class MsgClassIS : public IPC::MessageWithTuple< Tuple2<int, std::wstring> > {
public:
enum { ID = SERVER_FIRST_IPC_TYPE };
MsgClassIS(const int& arg1, const std::wstring& arg2)
: IPC::MessageWithTuple< Tuple2<int, std::wstring> >(
MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1, arg2)) {}
};
// Generic message class that is a wstring followed by an int.
class MsgClassSI : public IPC::MessageWithTuple< Tuple2<std::wstring, int> > {
public:
enum { ID = SERVER_SECOND_IPC_TYPE };
MsgClassSI(const std::wstring& arg1, const int& arg2)
: IPC::MessageWithTuple< Tuple2<std::wstring, int> >(
MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1, arg2)) {}
};
// Message to create a mutex in the IPC server, using the received name.
class MsgDoMutex : public IPC::MessageWithTuple< Tuple2<std::wstring, int> > {
public:
enum { ID = SERVER_THIRD_IPC_TYPE };
MsgDoMutex(const std::wstring& mutex_name, const int& unused)
: IPC::MessageWithTuple< Tuple2<std::wstring, int> >(
MSG_ROUTING_CONTROL, ID, MakeRefTuple(mutex_name, unused)) {}
};
class SimpleListener : public IPC::Channel::Listener {
public:
SimpleListener() : other_(NULL) {
......@@ -202,7 +181,7 @@ class FuzzerServerListener : public SimpleListener {
}
void ReplyMsgNotHandled(uint32 type_id) {
RoundtripAckReply(FUZZER_ROUTING_ID, CLIENT_UNHANDLED_IPC, type_id);
RoundtripAckReply(FUZZER_ROUTING_ID, MsgUnhandled::ID, type_id);
Cleanup();
}
......@@ -249,7 +228,7 @@ class FuzzerClientListener : public SimpleListener {
}
bool ExpectMsgNotHandled(uint32 type_id) {
return ExpectMessage(type_id, CLIENT_UNHANDLED_IPC);
return ExpectMessage(type_id, MsgUnhandled::ID);
}
private:
......
This diff is collapsed.
......@@ -944,136 +944,13 @@ struct ParamTraits< Tuple5<A, B, C, D, E> > {
// Used for asynchronous messages.
template <class ParamType>
class MessageWithTuple : public Message {
class MessageSchema {
public:
typedef ParamType Param;
typedef typename TupleTypes<ParamType>::ParamTuple RefParam;
// The constructor and the Read() method's templated implementations are in
// ipc_message_utils_impl.h. The subclass constructor and Log() methods call
// the templated versions of these and make sure there are instantiations in
// those translation units.
MessageWithTuple(int32 routing_id, uint32 type, const RefParam& p);
static void Write(Message* msg, const RefParam& p) IPC_MSG_NOINLINE;
static bool Read(const Message* msg, Param* p) IPC_MSG_NOINLINE;
// Generic dispatcher. Should cover most cases.
template<class T, class S, class Method>
static bool Dispatch(const Message* msg, T* obj, S* sender, Method func) {
Param p;
if (Read(msg, &p)) {
DispatchToMethod(obj, func, p);
return true;
}
return false;
}
// The following dispatchers exist for the case where the callback function
// needs the message as well. They assume that "Param" is a type of Tuple
// (except the one arg case, as there is no Tuple1).
template<class T, class S, typename TA>
static bool Dispatch(const Message* msg, T* obj, S* sender,
void (T::*func)(const Message&, TA)) {
Param p;
if (Read(msg, &p)) {
(obj->*func)(*msg, p.a);
return true;
}
return false;
}
template<class T, class S, typename TA, typename TB>
static bool Dispatch(const Message* msg, T* obj, S* sender,
void (T::*func)(const Message&, TA, TB)) {
Param p;
if (Read(msg, &p)) {
(obj->*func)(*msg, p.a, p.b);
return true;
}
return false;
}
template<class T, class S, typename TA, typename TB, typename TC>
static bool Dispatch(const Message* msg, T* obj, S* sender,
void (T::*func)(const Message&, TA, TB, TC)) {
Param p;
if (Read(msg, &p)) {
(obj->*func)(*msg, p.a, p.b, p.c);
return true;
}
return false;
}
template<class T, class S, typename TA, typename TB, typename TC, typename TD>
static bool Dispatch(const Message* msg, T* obj, S* sender,
void (T::*func)(const Message&, TA, TB, TC, TD)) {
Param p;
if (Read(msg, &p)) {
(obj->*func)(*msg, p.a, p.b, p.c, p.d);
return true;
}
return false;
}
template<class T, class S, typename TA, typename TB, typename TC, typename TD,
typename TE>
static bool Dispatch(const Message* msg, T* obj, S* sender,
void (T::*func)(const Message&, TA, TB, TC, TD, TE)) {
Param p;
if (Read(msg, &p)) {
(obj->*func)(*msg, p.a, p.b, p.c, p.d, p.e);
return true;
}
return false;
}
// Functions used to do manual unpacking. Only used by the automation code,
// these should go away once that code uses SyncChannel.
template<typename TA, typename TB>
static bool Read(const IPC::Message* msg, TA* a, TB* b) {
ParamType params;
if (!Read(msg, &params))
return false;
*a = params.a;
*b = params.b;
return true;
}
template<typename TA, typename TB, typename TC>
static bool Read(const IPC::Message* msg, TA* a, TB* b, TC* c) {
ParamType params;
if (!Read(msg, &params))
return false;
*a = params.a;
*b = params.b;
*c = params.c;
return true;
}
template<typename TA, typename TB, typename TC, typename TD>
static bool Read(const IPC::Message* msg, TA* a, TB* b, TC* c, TD* d) {
ParamType params;
if (!Read(msg, &params))
return false;
*a = params.a;
*b = params.b;
*c = params.c;
*d = params.d;
return true;
}
template<typename TA, typename TB, typename TC, typename TD, typename TE>
static bool Read(const IPC::Message* msg, TA* a, TB* b, TC* c, TD* d, TE* e) {
ParamType params;
if (!Read(msg, &params))
return false;
*a = params.a;
*b = params.b;
*c = params.c;
*d = params.d;
*e = params.e;
return true;
}
};
// defined in ipc_logging.cc
......@@ -1139,57 +1016,52 @@ class ParamDeserializer : public MessageReplyDeserializer {
// Used for synchronous messages.
template <class SendParamType, class ReplyParamType>
class MessageWithReply : public SyncMessage {
class SyncMessageSchema {
public:
typedef SendParamType SendParam;
typedef typename TupleTypes<SendParam>::ParamTuple RefSendParam;
typedef ReplyParamType ReplyParam;
MessageWithReply(int32 routing_id, uint32 type,
const RefSendParam& send, const ReplyParam& reply);
static void Write(Message* msg, const RefSendParam& send) IPC_MSG_NOINLINE;
static bool ReadSendParam(const Message* msg, SendParam* p) IPC_MSG_NOINLINE;
static bool ReadReplyParam(
const Message* msg,
typename TupleTypes<ReplyParam>::ValueTuple* p) IPC_MSG_NOINLINE;
template<class T, class S, class Method>
static bool Dispatch(const Message* msg, T* obj, S* sender, Method func) {
SendParam send_params;
Message* reply = GenerateReply(msg);
bool error;
if (ReadSendParam(msg, &send_params)) {
static bool DispatchWithSendParams(bool ok, const SendParam& send_params,
const Message* msg, T* obj, S* sender,
Method func) {
Message* reply = SyncMessage::GenerateReply(msg);
if (ok) {
typename TupleTypes<ReplyParam>::ValueTuple reply_params;
DispatchToMethod(obj, func, send_params, &reply_params);
WriteParam(reply, reply_params);
error = false;
LogReplyParamsToMessage(reply_params, msg);
} else {
NOTREACHED() << "Error deserializing message " << msg->type();
reply->set_reply_error();
error = true;
}
sender->Send(reply);
return !error;
return ok;
}
template<class T, class Method>
static bool DispatchDelayReply(const Message* msg, T* obj, Method func) {
SendParam send_params;
Message* reply = GenerateReply(msg);
bool error;
if (ReadSendParam(msg, &send_params)) {
static bool DispatchDelayReplyWithSendParams(bool ok,
const SendParam& send_params,
const Message* msg, T* obj,
Method func) {
Message* reply = SyncMessage::GenerateReply(msg);
if (ok) {
Tuple1<Message&> t = MakeRefTuple(*reply);
ConnectMessageAndReply(msg, reply);
DispatchToMethod(obj, func, send_params, &t);
error = false;
} else {
NOTREACHED() << "Error deserializing message " << msg->type();
reply->set_reply_error();
obj->Send(reply);
error = true;
}
return !error;
return ok;
}
template<typename TA>
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
......@@ -12,14 +12,12 @@
namespace IPC {
template <class ParamType>
MessageWithTuple<ParamType>::MessageWithTuple(
int32 routing_id, uint32 type, const RefParam& p)
: Message(routing_id, type, PRIORITY_NORMAL) {
WriteParam(this, p);
void MessageSchema<ParamType>::Write(Message* msg, const RefParam& p) {
WriteParam(msg, p);
}
template <class ParamType>
bool MessageWithTuple<ParamType>::Read(const Message* msg, Param* p) {
bool MessageSchema<ParamType>::Read(const Message* msg, Param* p) {
void* iter = NULL;
if (ReadParam(msg, &iter, p))
return true;
......@@ -27,29 +25,22 @@ bool MessageWithTuple<ParamType>::Read(const Message* msg, Param* p) {
return false;
}
// We can't migrate the template for Log() to MessageWithTuple, because each
// subclass needs to have Log() to call Read(), which instantiates the above
// template.
template <class SendParamType, class ReplyParamType>
MessageWithReply<SendParamType, ReplyParamType>::MessageWithReply(
int32 routing_id, uint32 type,
const RefSendParam& send,
const ReplyParam& reply)
: SyncMessage(routing_id, type, PRIORITY_NORMAL,
new ParamDeserializer<ReplyParam>(reply)) {
WriteParam(this, send);
void SyncMessageSchema<SendParamType, ReplyParamType>::Write(
Message* msg,
const RefSendParam& send) {
WriteParam(msg, send);
}
template <class SendParamType, class ReplyParamType>
bool MessageWithReply<SendParamType, ReplyParamType>::ReadSendParam(
bool SyncMessageSchema<SendParamType, ReplyParamType>::ReadSendParam(
const Message* msg, SendParam* p) {
void* iter = SyncMessage::GetDataIterator(msg);
return ReadParam(msg, &iter, p);
}
template <class SendParamType, class ReplyParamType>
bool MessageWithReply<SendParamType, ReplyParamType>::ReadReplyParam(
bool SyncMessageSchema<SendParamType, ReplyParamType>::ReadReplyParam(
const Message* msg, typename TupleTypes<ReplyParam>::ValueTuple* p) {
void* iter = SyncMessage::GetDataIterator(msg);
return ReadParam(msg, &iter, p);
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -10,12 +10,7 @@
#include "base/message_loop.h"
#include "base/process_util.h"
#include "build/build_config.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_channel_proxy.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_utils.h"
#include "ipc/ipc_message_utils_impl.h"
#include "ipc/ipc_tests.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/multiprocess_func_list.h"
......@@ -24,74 +19,34 @@
#include "base/file_descriptor_posix.h"
#endif
enum IPCMessageIds {
UNUSED_IPC_TYPE,
SERVER_FIRST_IPC_TYPE, // SetHandle message sent to server.
SERVER_SECOND_IPC_TYPE, // Shutdown message sent to server.
CLIENT_FIRST_IPC_TYPE // Response message sent to client.
};
// IPC messages for testing ---------------------------------------------------
namespace {
const char kHelloString[] = "Hello, SyncSocket Client";
const size_t kHelloStringLength = arraysize(kHelloString);
} // namespace
#define IPC_MESSAGE_IMPL
#include "ipc/ipc_message_macros.h"
#define IPC_MESSAGE_START TestMsgStart
// Message class to pass a base::SyncSocket::Handle to another process.
// This is not as easy as it sounds, because of the differences in transferring
// Message class to pass a base::SyncSocket::Handle to another process. This
// is not as easy as it sounds, because of the differences in transferring
// Windows HANDLEs versus posix file descriptors.
#if defined(OS_WIN)
class MsgClassSetHandle
: public IPC::MessageWithTuple< Tuple1<base::SyncSocket::Handle> > {
public:
enum { ID = SERVER_FIRST_IPC_TYPE };
explicit MsgClassSetHandle(const base::SyncSocket::Handle arg1)
: IPC::MessageWithTuple< Tuple1<base::SyncSocket::Handle> >(
MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1)) {}
private:
DISALLOW_COPY_AND_ASSIGN(MsgClassSetHandle);
};
IPC_MESSAGE_CONTROL1(MsgClassSetHandle, base::SyncSocket::Handle)
#elif defined(OS_POSIX)
class MsgClassSetHandle
: public IPC::MessageWithTuple< Tuple1<base::FileDescriptor> > {
public:
enum { ID = SERVER_FIRST_IPC_TYPE };
explicit MsgClassSetHandle(const base::FileDescriptor& arg1)
: IPC::MessageWithTuple< Tuple1<base::FileDescriptor> >(
MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1)) {}
private:
DISALLOW_COPY_AND_ASSIGN(MsgClassSetHandle);
};
#else
# error "What platform?"
#endif // defined(OS_WIN)
IPC_MESSAGE_CONTROL1(MsgClassSetHandle, base::FileDescriptor)
#endif
// Message class to pass a response to the server.
class MsgClassResponse
: public IPC::MessageWithTuple< Tuple1<std::string> > {
public:
enum { ID = CLIENT_FIRST_IPC_TYPE };
explicit MsgClassResponse(const std::string& arg1)
: IPC::MessageWithTuple< Tuple1<std::string> >(
MSG_ROUTING_CONTROL, ID, MakeRefTuple(arg1)) {}
private:
DISALLOW_COPY_AND_ASSIGN(MsgClassResponse);
};
IPC_MESSAGE_CONTROL1(MsgClassResponse, std::string)
// Message class to tell the server to shut down.
class MsgClassShutdown
: public IPC::MessageWithTuple< Tuple0 > {
public:
enum { ID = SERVER_SECOND_IPC_TYPE };
MsgClassShutdown()
: IPC::MessageWithTuple< Tuple0 >(
MSG_ROUTING_CONTROL, ID, MakeTuple()) {}
IPC_MESSAGE_CONTROL0(MsgClassShutdown)
private:
DISALLOW_COPY_AND_ASSIGN(MsgClassShutdown);
};
// ----------------------------------------------------------------------------
namespace {
const char kHelloString[] = "Hello, SyncSocket Client";
const size_t kHelloStringLength = arraysize(kHelloString);
} // namespace
// The SyncSocket server listener class processes two sorts of
// messages from the client.
......
......@@ -104,7 +104,7 @@
'type': 'static_library',
'dependencies': [
'<(DEPTH)/base/base.gyp:base_i18n',
'<(DEPTH)/base/base.gyp:base_static',
'<(DEPTH)/base/base.gyp:base_static',
'<(DEPTH)/gpu/gpu.gyp:gles2_implementation',
'<(DEPTH)/net/net.gyp:net',
'<(DEPTH)/ppapi/ppapi.gyp:ppapi_c',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment