summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorerg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-18 18:33:57 +0000
committererg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-18 18:33:57 +0000
commit252cad6dec04039d456e716273153951d0090b5f (patch)
tree68437c27571fe3e88317f1f2848573fe647fdbb5 /ipc
parent371390a71a7e4530b39e46f1f52c5a6d5a3acd43 (diff)
downloadchromium_src-252cad6dec04039d456e716273153951d0090b5f.zip
chromium_src-252cad6dec04039d456e716273153951d0090b5f.tar.gz
chromium_src-252cad6dec04039d456e716273153951d0090b5f.tar.bz2
Remove all wstrings from the IPC logging subsystem.
Changes all IPC Log methods from wstring to string. All static logging debug data changed from wchar[] to char[]. Various string conversion/numeric headers no longer need to be included in ipc_message_utils.h and have been removed (and added in all implementation files that require them). BUG=none TEST=none Review URL: http://codereview.chromium.org/3159013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56563 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r--ipc/ipc_logging.cc26
-rw-r--r--ipc/ipc_logging.h10
-rw-r--r--ipc/ipc_message.h8
-rw-r--r--ipc/ipc_message_impl_macros.h4
-rw-r--r--ipc/ipc_message_macros.h114
-rw-r--r--ipc/ipc_message_utils.cc68
-rw-r--r--ipc/ipc_message_utils.h178
7 files changed, 214 insertions, 194 deletions
diff --git a/ipc/ipc_logging.cc b/ipc/ipc_logging.cc
index 51b94d2..da857ec 100644
--- a/ipc/ipc_logging.cc
+++ b/ipc/ipc_logging.cc
@@ -161,9 +161,9 @@ void Logging::OnPostDispatchMessage(const Message& message,
}
}
-void Logging::GetMessageText(uint32 type, std::wstring* name,
+void Logging::GetMessageText(uint32 type, std::string* name,
const Message* message,
- std::wstring* params) {
+ std::string* params) {
if (!log_function_mapping_)
return;
@@ -196,14 +196,14 @@ void Logging::Log(const LogData& data) {
if (data.message_name.empty()) {
message_name = StringPrintf("[unknown type %d]", data.type);
} else {
- message_name = WideToASCII(data.message_name);
+ message_name = data.message_name;
}
fprintf(stderr, "ipc %s %d %s %s %s\n",
data.channel.c_str(),
data.routing_id,
- WideToASCII(data.flags).c_str(),
+ data.flags.c_str(),
message_name.c_str(),
- WideToUTF8(data.params).c_str());
+ data.params.c_str());
}
}
@@ -211,27 +211,27 @@ void GenerateLogData(const std::string& channel, const Message& message,
LogData* data) {
if (message.is_reply()) {
// "data" should already be filled in.
- std::wstring params;
+ std::string params;
Logging::GetMessageText(data->type, NULL, &message, &params);
if (!data->params.empty() && !params.empty())
- data->params += L", ";
+ data->params += ", ";
- data->flags += L" DR";
+ data->flags += " DR";
data->params += params;
} else {
- std::wstring flags;
+ std::string flags;
if (message.is_sync())
- flags = L"S";
+ flags = "S";
if (message.is_reply())
- flags += L"R";
+ flags += "R";
if (message.is_reply_error())
- flags += L"E";
+ flags += "E";
- std::wstring params, message_name;
+ std::string params, message_name;
Logging::GetMessageText(message.type(), &message_name, &message, &params);
data->channel = channel;
diff --git a/ipc/ipc_logging.h b/ipc/ipc_logging.h
index 8d3916d..36e584a 100644
--- a/ipc/ipc_logging.h
+++ b/ipc/ipc_logging.h
@@ -68,13 +68,15 @@ class Logging {
// Like the *MsgLog functions declared for each message class, except this
// calls the correct one based on the message type automatically. Defined in
// ipc_logging.cc.
- static void GetMessageText(uint32 type, std::wstring* name,
- const Message* message, std::wstring* params);
+ static void GetMessageText(uint32 type, std::string* name,
+ const Message* message, std::string* params);
+ // Logging function. |name| is a string in ASCII and |params| is a string in
+ // UTF-8.
typedef void (*LogFunction)(uint32 type,
- std::wstring* name,
+ std::string* name,
const Message* msg,
- std::wstring* params);
+ std::string* params);
static void SetLoggerFunctions(LogFunction *functions);
diff --git a/ipc/ipc_message.h b/ipc/ipc_message.h
index 75cdd23..bff0ff70 100644
--- a/ipc/ipc_message.h
+++ b/ipc/ipc_message.h
@@ -157,7 +157,7 @@ class Message : public Pickle {
}
// Used for async messages with no parameters.
- static void Log(const Message* msg, std::wstring* l) {
+ static void Log(const Message* msg, std::string* l) {
}
// Find the end of the message data that starts at range_start. Returns NULL
@@ -185,8 +185,8 @@ class Message : public Pickle {
void set_received_time(int64 time) const;
int64 received_time() const { return received_time_; }
- void set_output_params(const std::wstring& op) const { output_params_ = op; }
- const std::wstring& output_params() const { return output_params_; }
+ void set_output_params(const std::string& op) const { output_params_ = op; }
+ const std::string& output_params() const { return output_params_; }
// The following four functions are needed so we can log sync messages with
// delayed replies. We stick the log data from the sent message into the
// reply message, so that when it's sent and we have the output parameters
@@ -257,7 +257,7 @@ class Message : public Pickle {
#ifdef IPC_MESSAGE_LOG_ENABLED
// Used for logging.
mutable int64 received_time_;
- mutable std::wstring output_params_;
+ mutable std::string output_params_;
mutable LogData* log_data_;
mutable bool dont_log_;
#endif
diff --git a/ipc/ipc_message_impl_macros.h b/ipc/ipc_message_impl_macros.h
index f9eede9..e2325a5 100644
--- a/ipc/ipc_message_impl_macros.h
+++ b/ipc/ipc_message_impl_macros.h
@@ -97,7 +97,7 @@
#define IPC_ASYNC_MESSAGE_DTOR_AND_LOG(msg_class) \
msg_class::~msg_class() {} \
\
- void msg_class::Log(const Message* msg, std::wstring* l) { \
+ void msg_class::Log(const Message* msg, std::string* l) { \
Param p; \
if (Read(msg, &p)) \
IPC::LogParam(p, l); \
@@ -198,7 +198,7 @@
#define IPC_SYNC_MESSAGE_DTOR_AND_LOG(msg_class) \
msg_class::~msg_class() {} \
\
- void msg_class::Log(const Message* msg, std::wstring* l) { \
+ void msg_class::Log(const Message* msg, std::string* l) { \
if (msg->is_sync()) { \
TupleTypes<SendParam>::ValueTuple p; \
if (ReadSendParam(msg, &p)) \
diff --git a/ipc/ipc_message_macros.h b/ipc/ipc_message_macros.h
index 903d566..ebfd7c6 100644
--- a/ipc/ipc_message_macros.h
+++ b/ipc/ipc_message_macros.h
@@ -461,22 +461,22 @@ void class_name::OnMessageReceived(const IPC::Message& msg) \
#ifndef IPC_LOG_TABLE_CREATED
#define IPC_LOG_TABLE_CREATED
typedef void (*LogFunction)(uint32 type,
- std::wstring* name,
+ std::string* name,
const IPC::Message* msg,
- std::wstring* params);
+ std::string* params);
LogFunction g_log_function_mapping[LastMsgIndex];
#endif
#define IPC_BEGIN_MESSAGES(label) \
- void label##MsgLog(uint32 type, std::wstring* name, const IPC::Message* msg, std::wstring* params) { \
+ void label##MsgLog(uint32 type, std::string* name, const IPC::Message* msg, std::string* params) { \
switch (type) {
#define IPC_END_MESSAGES(label) \
default: \
if (name) \
- *name = L"[UNKNOWN " L ## #label L" MSG"; \
+ *name = "[UNKNOWN " #label " MSG]"; \
} \
} \
class LoggerRegisterHelper##label { \
@@ -490,7 +490,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
#define IPC_MESSAGE_LOG(msg_class) \
case msg_class##__ID: \
if (name) \
- *name = L ## #msg_class; \
+ *name = #msg_class; \
if (msg && params) \
msg_class::Log(msg, params); \
break;
@@ -738,7 +738,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1& arg1); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_MESSAGE_CONTROL2(msg_class, type1, type2) \
@@ -747,7 +747,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1& arg1, const type2& arg2); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_MESSAGE_CONTROL3(msg_class, type1, type2, type3) \
@@ -757,7 +757,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1& arg1, const type2& arg2, const type3& arg3); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_MESSAGE_CONTROL4(msg_class, type1, type2, type3, type4) \
@@ -768,7 +768,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
msg_class(const type1& arg1, const type2& arg2, const type3& arg3, \
const type4& arg4); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_MESSAGE_CONTROL5(msg_class, type1, type2, type3, type4, type5) \
@@ -779,7 +779,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
msg_class(const type1& arg1, const type2& arg2, \
const type3& arg3, const type4& arg4, const type5& arg5); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_MESSAGE_ROUTED0(msg_class) \
@@ -796,7 +796,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int32 routing_id, const type1& arg1); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_MESSAGE_ROUTED2(msg_class, type1, type2) \
@@ -806,7 +806,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int32 routing_id, const type1& arg1, const type2& arg2); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_MESSAGE_ROUTED3(msg_class, type1, type2, type3) \
@@ -817,7 +817,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \
const type3& arg3); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_MESSAGE_ROUTED4(msg_class, type1, type2, type3, type4) \
@@ -828,7 +828,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \
const type3& arg3, const type4& arg4); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \
@@ -840,7 +840,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
msg_class(int32 routing_id, const type1& arg1, const type2& arg2, \
const type3& arg3, const type4& arg4, const type5& arg5); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \
@@ -849,7 +849,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL0_1(msg_class, type1_out) \
@@ -858,7 +858,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(type1_out* arg1); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL0_2(msg_class, type1_out, type2_out) \
@@ -868,7 +868,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(type1_out* arg1, type2_out* arg2); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL0_3(msg_class, type1_out, type2_out, type3_out) \
@@ -879,7 +879,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(type1_out* arg1, type2_out* arg2, type3_out* arg3); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL1_0(msg_class, type1_in) \
@@ -889,7 +889,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1_in& arg1); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL1_1(msg_class, type1_in, type1_out) \
@@ -899,7 +899,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1_in& arg1, type1_out* arg2); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL1_2(msg_class, type1_in, type1_out, type2_out) \
@@ -909,7 +909,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1_in& arg1, type1_out* arg2, type2_out* arg3); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \
@@ -920,7 +920,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1_in& arg1, type1_out* arg2, type2_out* arg3, type3_out* arg4); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL2_0(msg_class, type1_in, type2_in) \
@@ -930,7 +930,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1_in& arg1, const type2_in& arg2); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL2_1(msg_class, type1_in, type2_in, type1_out) \
@@ -940,7 +940,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \
@@ -951,7 +951,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \
@@ -962,7 +962,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4, type3_out* arg5); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \
@@ -973,7 +973,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \
@@ -984,7 +984,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \
@@ -995,7 +995,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5, type3_out* arg6); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \
@@ -1006,7 +1006,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg6); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_CONTROL4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \
@@ -1017,7 +1017,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED0_0(msg_class) \
@@ -1026,7 +1026,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED0_1(msg_class, type1_out) \
@@ -1035,7 +1035,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, type1_out* arg1); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED0_2(msg_class, type1_out, type2_out) \
@@ -1045,7 +1045,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, type1_out* arg1, type2_out* arg2); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED0_3(msg_class, type1_out, type2_out, type3_out) \
@@ -1056,7 +1056,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, type1_out* arg1, type2_out* arg2, type3_out* arg3); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED1_0(msg_class, type1_in) \
@@ -1066,7 +1066,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED1_1(msg_class, type1_in, type1_out) \
@@ -1076,7 +1076,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, type1_out* arg2); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED1_2(msg_class, type1_in, type1_out, type2_out) \
@@ -1086,7 +1086,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, type1_out* arg2, type2_out* arg3); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED1_3(msg_class, type1_in, type1_out, type2_out, type3_out) \
@@ -1097,7 +1097,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, type1_out* arg2, type2_out* arg3, type3_out* arg4); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED1_4(msg_class, type1_in, type1_out, type2_out, type3_out, type4_out) \
@@ -1108,7 +1108,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, type1_out* arg2, type2_out* arg3, type3_out* arg4, type4_out* arg5); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED2_0(msg_class, type1_in, type2_in) \
@@ -1118,7 +1118,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED2_1(msg_class, type1_in, type2_in, type1_out) \
@@ -1128,7 +1128,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, type1_out* arg3); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED2_2(msg_class, type1_in, type2_in, type1_out, type2_out) \
@@ -1139,7 +1139,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED2_3(msg_class, type1_in, type2_in, type1_out, type2_out, type3_out) \
@@ -1150,7 +1150,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, type1_out* arg3, type2_out* arg4, type3_out* arg5); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED3_0(msg_class, type1_in, type2_in, type3_in) \
@@ -1160,7 +1160,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED3_1(msg_class, type1_in, type2_in, type3_in, type1_out) \
@@ -1171,7 +1171,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED3_2(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out) \
@@ -1182,7 +1182,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED3_3(msg_class, type1_in, type2_in, type3_in, type1_out, type2_out, type3_out) \
@@ -1193,7 +1193,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, type1_out* arg4, type2_out* arg5, type3_out* arg6); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED4_0(msg_class, type1_in, type2_in, type3_in, type4_in) \
@@ -1204,7 +1204,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED4_1(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out) \
@@ -1215,7 +1215,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg6); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED4_2(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out) \
@@ -1226,7 +1226,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED4_3(msg_class, type1_in, type2_in, type3_in, type4_in, type1_out, type2_out, type3_out) \
@@ -1237,7 +1237,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, type1_out* arg5, type2_out* arg6, type3_out* arg7); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED5_0(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in) \
@@ -1248,7 +1248,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type5_in& arg5); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED5_1(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out) \
@@ -1259,7 +1259,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type5_in& arg5, type1_out* arg6); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED5_2(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out) \
@@ -1270,7 +1270,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type4_in& arg5, type1_out* arg6, type2_out* arg7); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#define IPC_SYNC_MESSAGE_ROUTED5_3(msg_class, type1_in, type2_in, type3_in, type4_in, type5_in, type1_out, type2_out, type3_out) \
@@ -1281,7 +1281,7 @@ LogFunction g_log_function_mapping[LastMsgIndex];
enum { ID = msg_class##__ID }; \
msg_class(int routing_id, const type1_in& arg1, const type2_in& arg2, const type3_in& arg3, const type4_in& arg4, const type4_in& arg5, type1_out* arg6, type2_out* arg7, type3_out* arg8); \
~msg_class(); \
- static void Log(const Message* msg, std::wstring* l); \
+ static void Log(const Message* msg, std::string* l); \
};
#endif // #if defined()
diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc
index 93f192ed..5c599ab 100644
--- a/ipc/ipc_message_utils.cc
+++ b/ipc/ipc_message_utils.cc
@@ -8,7 +8,9 @@
#include "base/json/json_writer.h"
#include "base/nullable_string16.h"
#include "base/scoped_ptr.h"
+#include "base/string_number_conversions.h"
#include "base/time.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
#if defined(OS_POSIX)
#include "ipc/file_descriptor_set_posix.h"
@@ -207,6 +209,29 @@ static bool ReadValue(const Message* m, void** iter, Value** value,
return true;
}
+void ParamTraits<int>::Log(const param_type& p, std::string* l) {
+ l->append(base::IntToString(p));
+}
+
+void ParamTraits<unsigned int>::Log(const param_type& p, std::string* l) {
+ l->append(base::UintToString(p));
+}
+
+void ParamTraits<long>::Log(const param_type& p, std::string* l) {
+ l->append(base::Int64ToString(static_cast<int64>(p)));
+}
+
+void ParamTraits<unsigned long>::Log(const param_type& p, std::string* l) {
+ l->append(base::Uint64ToString(static_cast<uint64>(p)));
+}
+
+void ParamTraits<long long>::Log(const param_type& p, std::string* l) {
+ l->append(base::Int64ToString(static_cast<int64>(p)));
+}
+
+void ParamTraits<unsigned long long>::Log(const param_type& p, std::string* l) {
+ l->append(base::Uint64ToString(p));
+}
void ParamTraits<base::Time>::Write(Message* m, const param_type& p) {
ParamTraits<int64>::Write(m, p.ToInternalValue());
@@ -221,7 +246,7 @@ bool ParamTraits<base::Time>::Read(const Message* m, void** iter,
return true;
}
-void ParamTraits<base::Time>::Log(const param_type& p, std::wstring* l) {
+void ParamTraits<base::Time>::Log(const param_type& p, std::string* l) {
ParamTraits<int64>::Log(p.ToInternalValue(), l);
}
@@ -238,10 +263,10 @@ bool ParamTraits<DictionaryValue>::Read(
return ReadDictionaryValue(m, iter, r, 0);
}
-void ParamTraits<DictionaryValue>::Log(const param_type& p, std::wstring* l) {
+void ParamTraits<DictionaryValue>::Log(const param_type& p, std::string* l) {
std::string json;
base::JSONWriter::Write(&p, false, &json);
- l->append(UTF8ToWide(json));
+ l->append(json);
}
void ParamTraits<ListValue>::Write(Message* m, const param_type& p) {
@@ -257,10 +282,14 @@ bool ParamTraits<ListValue>::Read(
return ReadListValue(m, iter, r, 0);
}
-void ParamTraits<ListValue>::Log(const param_type& p, std::wstring* l) {
+void ParamTraits<ListValue>::Log(const param_type& p, std::string* l) {
std::string json;
base::JSONWriter::Write(&p, false, &json);
- l->append(UTF8ToWide(json));
+ l->append(json);
+}
+
+void ParamTraits<std::wstring>::Log(const param_type& p, std::string* l) {
+ l->append(WideToUTF8(p));
}
void ParamTraits<NullableString16>::Write(Message* m, const param_type& p) {
@@ -280,14 +309,21 @@ bool ParamTraits<NullableString16>::Read(const Message* m, void** iter,
return true;
}
-void ParamTraits<NullableString16>::Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
+void ParamTraits<NullableString16>::Log(const param_type& p, std::string* l) {
+ l->append("(");
LogParam(p.string(), l);
- l->append(L", ");
+ l->append(", ");
LogParam(p.is_null(), l);
- l->append(L")");
+ l->append(")");
}
+#if !defined(WCHAR_T_IS_UTF16)
+void ParamTraits<string16>::Log(const param_type& p, std::string* l) {
+ l->append(UTF16ToUTF8(p));
+}
+#endif
+
+
void ParamTraits<FilePath>::Write(Message* m, const param_type& p) {
ParamTraits<FilePath::StringType>::Write(m, p.value());
}
@@ -300,7 +336,7 @@ bool ParamTraits<FilePath>::Read(const Message* m, void** iter, param_type* r) {
return true;
}
-void ParamTraits<FilePath>::Log(const param_type& p, std::wstring* l) {
+void ParamTraits<FilePath>::Log(const param_type& p, std::string* l) {
ParamTraits<FilePath::StringType>::Log(p.value(), l);
}
@@ -331,11 +367,11 @@ bool ParamTraits<base::FileDescriptor>::Read(const Message* m, void** iter,
}
void ParamTraits<base::FileDescriptor>::Log(const param_type& p,
- std::wstring* l) {
+ std::string* l) {
if (p.auto_close) {
- l->append(StringPrintf(L"FD(%d auto-close)", p.fd));
+ l->append(StringPrintf("FD(%d auto-close)", p.fd));
} else {
- l->append(StringPrintf(L"FD(%d)", p.fd));
+ l->append(StringPrintf("FD(%d)", p.fd));
}
}
#endif // defined(OS_POSIX)
@@ -357,12 +393,12 @@ bool ParamTraits<IPC::ChannelHandle>::Read(const Message* m, void** iter,
}
void ParamTraits<IPC::ChannelHandle>::Log(const param_type& p,
- std::wstring* l) {
- l->append(ASCIIToWide(StringPrintf("ChannelHandle(%s", p.name.c_str())));
+ std::string* l) {
+ l->append(StringPrintf("ChannelHandle(%s", p.name.c_str()));
#if defined(OS_POSIX)
ParamTraits<base::FileDescriptor>::Log(p.socket, l);
#endif
- l->append(L")");
+ l->append(")");
}
} // namespace IPC
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index 05d3916..c3a9ca4 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -14,10 +14,8 @@
#include "base/format_macros.h"
#include "base/string16.h"
-#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/tuple.h"
-#include "base/utf_string_conversions.h"
#include "ipc/ipc_sync_message.h"
#if defined(COMPILER_GCC)
@@ -148,7 +146,7 @@ static inline bool WARN_UNUSED_RESULT ReadParam(const Message* m, void** iter,
}
template <class P>
-static inline void LogParam(const P& p, std::wstring* l) {
+static inline void LogParam(const P& p, std::string* l) {
typedef typename SimilarTypeTraits<P>::Type Type;
ParamTraits<Type>::Log(static_cast<const Type& >(p), l);
}
@@ -162,8 +160,8 @@ struct ParamTraits<bool> {
static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadBool(iter, r);
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(p ? L"true" : L"false");
+ static void Log(const param_type& p, std::string* l) {
+ l->append(p ? "true" : "false");
}
};
@@ -176,9 +174,7 @@ struct ParamTraits<int> {
static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadInt(iter, r);
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(StringPrintf(L"%d", p));
- }
+ static void Log(const param_type& p, std::string* l);
};
template <>
@@ -190,9 +186,7 @@ struct ParamTraits<unsigned int> {
static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadInt(iter, reinterpret_cast<int*>(r));
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(StringPrintf(L"%d", p));
- }
+ static void Log(const param_type& p, std::string* l);
};
template <>
@@ -204,9 +198,7 @@ struct ParamTraits<long> {
static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadLong(iter, r);
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(StringPrintf(L"%ld", p));
- }
+ static void Log(const param_type& p, std::string* l);
};
template <>
@@ -218,9 +210,7 @@ struct ParamTraits<unsigned long> {
static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadLong(iter, reinterpret_cast<long*>(r));
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(StringPrintf(L"%lu", p));
- }
+ static void Log(const param_type& p, std::string* l);
};
template <>
@@ -232,9 +222,7 @@ struct ParamTraits<long long> {
static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadInt64(iter, reinterpret_cast<int64*>(r));
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(UTF8ToWide(base::Int64ToString(static_cast<int64>(p))));
- }
+ static void Log(const param_type& p, std::string* l);
};
template <>
@@ -246,9 +234,7 @@ struct ParamTraits<unsigned long long> {
static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadInt64(iter, reinterpret_cast<int64*>(r));
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(UTF8ToWide(base::Uint64ToString(p)));
- }
+ static void Log(const param_type& p, std::string* l);
};
// Note that the IPC layer doesn't sanitize NaNs and +/- INF values. Clients
@@ -271,8 +257,8 @@ struct ParamTraits<float> {
memcpy(r, data, sizeof(param_type));
return true;
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(StringPrintf(L"e", p));
+ static void Log(const param_type& p, std::string* l) {
+ l->append(StringPrintf("%e", p));
}
};
@@ -293,8 +279,8 @@ struct ParamTraits<double> {
memcpy(r, data, sizeof(param_type));
return true;
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(StringPrintf(L"e", p));
+ static void Log(const param_type& p, std::string* l) {
+ l->append(StringPrintf("%e", p));
}
};
@@ -317,8 +303,8 @@ struct ParamTraits<wchar_t> {
return result;
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(StringPrintf(L"%lc", p));
+ static void Log(const param_type& p, std::string* l) {
+ l->append(StringPrintf("%lc", p));
}
};
@@ -327,7 +313,7 @@ struct ParamTraits<base::Time> {
typedef base::Time param_type;
static void Write(Message* m, const param_type& p);
static bool Read(const Message* m, void** iter, param_type* r);
- static void Log(const param_type& p, std::wstring* l);
+ static void Log(const param_type& p, std::string* l);
};
#if defined(OS_WIN)
@@ -350,8 +336,8 @@ struct ParamTraits<LOGFONT> {
return result;
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(StringPrintf(L"<LOGFONT>"));
+ static void Log(const param_type& p, std::string* l) {
+ l->append(StringPrintf("<LOGFONT>"));
}
};
@@ -374,8 +360,8 @@ struct ParamTraits<MSG> {
return result;
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<MSG>");
+ static void Log(const param_type& p, std::string* l) {
+ l->append("<MSG>");
}
};
#endif // defined(OS_WIN)
@@ -385,7 +371,7 @@ struct ParamTraits<DictionaryValue> {
typedef DictionaryValue param_type;
static void Write(Message* m, const param_type& p);
static bool Read(const Message* m, void** iter, param_type* r);
- static void Log(const param_type& p, std::wstring* l);
+ static void Log(const param_type& p, std::string* l);
};
template <>
@@ -393,7 +379,7 @@ struct ParamTraits<ListValue> {
typedef ListValue param_type;
static void Write(Message* m, const param_type& p);
static bool Read(const Message* m, void** iter, param_type* r);
- static void Log(const param_type& p, std::wstring* l);
+ static void Log(const param_type& p, std::string* l);
};
template <>
@@ -405,13 +391,13 @@ struct ParamTraits<std::string> {
static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadString(iter, r);
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(UTF8ToWide(p));
+ static void Log(const param_type& p, std::string* l) {
+ l->append(p);
}
};
template<typename CharType>
-static void LogBytes(const std::vector<CharType>& data, std::wstring* out) {
+static void LogBytes(const std::vector<CharType>& data, std::string* out) {
#if defined(OS_WIN)
// Windows has a GUI for logging, which can handle arbitrary binary data.
for (size_t i = 0; i < data.size(); ++i)
@@ -423,11 +409,11 @@ static void LogBytes(const std::vector<CharType>& data, std::wstring* out) {
if (isprint(data[i]))
out->push_back(data[i]);
else
- out->append(StringPrintf(L"[%02X]", static_cast<unsigned char>(data[i])));
+ out->append(StringPrintf("[%02X]", static_cast<unsigned char>(data[i])));
}
if (data.size() > kMaxBytesToLog) {
out->append(
- StringPrintf(L" and %u more bytes",
+ StringPrintf(" and %u more bytes",
static_cast<unsigned>(data.size() - kMaxBytesToLog)));
}
#endif
@@ -454,7 +440,7 @@ struct ParamTraits<std::vector<unsigned char> > {
memcpy(&r->front(), data, data_size);
return true;
}
- static void Log(const param_type& p, std::wstring* l) {
+ static void Log(const param_type& p, std::string* l) {
LogBytes(p, l);
}
};
@@ -479,7 +465,7 @@ struct ParamTraits<std::vector<char> > {
memcpy(&r->front(), data, data_size);
return true;
}
- static void Log(const param_type& p, std::wstring* l) {
+ static void Log(const param_type& p, std::string* l) {
LogBytes(p, l);
}
};
@@ -507,10 +493,10 @@ struct ParamTraits<std::vector<P> > {
}
return true;
}
- static void Log(const param_type& p, std::wstring* l) {
+ static void Log(const param_type& p, std::string* l) {
for (size_t i = 0; i < p.size(); ++i) {
if (i != 0)
- l->append(L" ");
+ l->append(" ");
LogParam((p[i]), l);
}
}
@@ -537,8 +523,8 @@ struct ParamTraits<std::set<P> > {
}
return true;
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<std::set>");
+ static void Log(const param_type& p, std::string* l) {
+ l->append("<std::set>");
}
};
@@ -568,8 +554,8 @@ struct ParamTraits<std::map<K, V> > {
}
return true;
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<std::map>");
+ static void Log(const param_type& p, std::string* l) {
+ l->append("<std::map>");
}
};
@@ -583,9 +569,7 @@ struct ParamTraits<std::wstring> {
static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadWString(iter, r);
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(p);
- }
+ static void Log(const param_type& p, std::string* l);
};
template <class A, class B>
@@ -598,12 +582,12 @@ struct ParamTraits<std::pair<A, B> > {
static bool Read(const Message* m, void** iter, param_type* r) {
return ReadParam(m, iter, &r->first) && ReadParam(m, iter, &r->second);
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"(");
+ static void Log(const param_type& p, std::string* l) {
+ l->append("(");
LogParam(p.first, l);
- l->append(L", ");
+ l->append(", ");
LogParam(p.second, l);
- l->append(L")");
+ l->append(")");
}
};
@@ -612,7 +596,7 @@ struct ParamTraits<NullableString16> {
typedef NullableString16 param_type;
static void Write(Message* m, const param_type& p);
static bool Read(const Message* m, void** iter, param_type* r);
- static void Log(const param_type& p, std::wstring* l);
+ static void Log(const param_type& p, std::string* l);
};
// If WCHAR_T_IS_UTF16 is defined, then string16 is a std::wstring so we don't
@@ -627,9 +611,7 @@ struct ParamTraits<string16> {
static bool Read(const Message* m, void** iter, param_type* r) {
return m->ReadString16(iter, r);
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(UTF16ToWide(p));
- }
+ static void Log(const param_type& p, std::string* l);
};
#endif
@@ -647,8 +629,8 @@ struct ParamTraits<HANDLE> {
DCHECK_EQ(sizeof(param_type), sizeof(uint32));
return m->ReadUInt32(iter, reinterpret_cast<uint32*>(r));
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(StringPrintf(L"0x%X", p));
+ static void Log(const param_type& p, std::string* l) {
+ l->append(StringPrintf("0x%X", p));
}
};
@@ -662,8 +644,8 @@ struct ParamTraits<HCURSOR> {
DCHECK_EQ(sizeof(param_type), sizeof(uint32));
return m->ReadUInt32(iter, reinterpret_cast<uint32*>(r));
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(StringPrintf(L"0x%X", p));
+ static void Log(const param_type& p, std::string* l) {
+ l->append(StringPrintf("0x%X", p));
}
};
@@ -694,8 +676,8 @@ struct ParamTraits<POINT> {
r->y = y;
return true;
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(StringPrintf(L"(%d, %d)", p.x, p.y));
+ static void Log(const param_type& p, std::string* l) {
+ l->append(StringPrintf("(%d, %d)", p.x, p.y));
}
};
#endif // defined(OS_WIN)
@@ -705,7 +687,7 @@ struct ParamTraits<FilePath> {
typedef FilePath param_type;
static void Write(Message* m, const param_type& p);
static bool Read(const Message* m, void** iter, param_type* r);
- static void Log(const param_type& p, std::wstring* l);
+ static void Log(const param_type& p, std::string* l);
};
#if defined(OS_POSIX)
@@ -729,7 +711,7 @@ struct ParamTraits<base::FileDescriptor> {
typedef base::FileDescriptor param_type;
static void Write(Message* m, const param_type& p);
static bool Read(const Message* m, void** iter, param_type* r);
- static void Log(const param_type& p, std::wstring* l);
+ static void Log(const param_type& p, std::string* l);
};
#endif // defined(OS_POSIX)
@@ -741,7 +723,7 @@ struct ParamTraits<IPC::ChannelHandle> {
typedef ChannelHandle param_type;
static void Write(Message* m, const param_type& p);
static bool Read(const Message* m, void** iter, param_type* r);
- static void Log(const param_type& p, std::wstring* l);
+ static void Log(const param_type& p, std::string* l);
};
#if defined(OS_WIN)
@@ -764,8 +746,8 @@ struct ParamTraits<XFORM> {
return result;
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<XFORM>");
+ static void Log(const param_type& p, std::string* l) {
+ l->append("<XFORM>");
}
};
#endif // defined(OS_WIN)
@@ -774,14 +756,14 @@ struct LogData {
std::string channel;
int32 routing_id;
uint32 type; // "User-defined" message type, from ipc_message.h.
- std::wstring flags;
+ std::string flags;
int64 sent; // Time that the message was sent (i.e. at Send()).
int64 receive; // Time before it was dispatched (i.e. before calling
// OnMessageReceived).
int64 dispatch; // Time after it was dispatched (i.e. after calling
// OnMessageReceived).
- std::wstring message_name;
- std::wstring params;
+ std::string message_name;
+ std::string params;
};
template <>
@@ -811,7 +793,7 @@ struct ParamTraits<LogData> {
r->type = static_cast<uint16>(type);
return result;
}
- static void Log(const param_type& p, std::wstring* l) {
+ static void Log(const param_type& p, std::string* l) {
// Doesn't make sense to implement this!
}
};
@@ -832,8 +814,8 @@ struct ParamTraits<Message> {
*r = Message(data, size);
return true;
}
- static void Log(const Message& p, std::wstring* l) {
- l->append(L"<IPC::Message>");
+ static void Log(const Message& p, std::string* l) {
+ l->append("<IPC::Message>");
}
};
@@ -845,7 +827,7 @@ struct ParamTraits<Tuple0> {
static bool Read(const Message* m, void** iter, param_type* r) {
return true;
}
- static void Log(const param_type& p, std::wstring* l) {
+ static void Log(const param_type& p, std::string* l) {
}
};
@@ -858,7 +840,7 @@ struct ParamTraits< Tuple1<A> > {
static bool Read(const Message* m, void** iter, param_type* r) {
return ReadParam(m, iter, &r->a);
}
- static void Log(const param_type& p, std::wstring* l) {
+ static void Log(const param_type& p, std::string* l) {
LogParam(p.a, l);
}
};
@@ -874,9 +856,9 @@ struct ParamTraits< Tuple2<A, B> > {
return (ReadParam(m, iter, &r->a) &&
ReadParam(m, iter, &r->b));
}
- static void Log(const param_type& p, std::wstring* l) {
+ static void Log(const param_type& p, std::string* l) {
LogParam(p.a, l);
- l->append(L", ");
+ l->append(", ");
LogParam(p.b, l);
}
};
@@ -894,11 +876,11 @@ struct ParamTraits< Tuple3<A, B, C> > {
ReadParam(m, iter, &r->b) &&
ReadParam(m, iter, &r->c));
}
- static void Log(const param_type& p, std::wstring* l) {
+ static void Log(const param_type& p, std::string* l) {
LogParam(p.a, l);
- l->append(L", ");
+ l->append(", ");
LogParam(p.b, l);
- l->append(L", ");
+ l->append(", ");
LogParam(p.c, l);
}
};
@@ -918,13 +900,13 @@ struct ParamTraits< Tuple4<A, B, C, D> > {
ReadParam(m, iter, &r->c) &&
ReadParam(m, iter, &r->d));
}
- static void Log(const param_type& p, std::wstring* l) {
+ static void Log(const param_type& p, std::string* l) {
LogParam(p.a, l);
- l->append(L", ");
+ l->append(", ");
LogParam(p.b, l);
- l->append(L", ");
+ l->append(", ");
LogParam(p.c, l);
- l->append(L", ");
+ l->append(", ");
LogParam(p.d, l);
}
};
@@ -946,15 +928,15 @@ struct ParamTraits< Tuple5<A, B, C, D, E> > {
ReadParam(m, iter, &r->d) &&
ReadParam(m, iter, &r->e));
}
- static void Log(const param_type& p, std::wstring* l) {
+ static void Log(const param_type& p, std::string* l) {
LogParam(p.a, l);
- l->append(L", ");
+ l->append(", ");
LogParam(p.b, l);
- l->append(L", ");
+ l->append(", ");
LogParam(p.c, l);
- l->append(L", ");
+ l->append(", ");
LogParam(p.d, l);
- l->append(L", ");
+ l->append(", ");
LogParam(p.e, l);
}
};
@@ -1102,10 +1084,10 @@ void GenerateLogData(const std::string& channel, const Message& message,
#if defined(IPC_MESSAGE_LOG_ENABLED)
-inline void AddOutputParamsToLog(const Message* msg, std::wstring* l) {
- const std::wstring& output_params = msg->output_params();
+inline void AddOutputParamsToLog(const Message* msg, std::string* l) {
+ const std::string& output_params = msg->output_params();
if (!l->empty() && !output_params.empty())
- l->append(L", ");
+ l->append(", ");
l->append(output_params);
}
@@ -1114,7 +1096,7 @@ template <class ReplyParamType>
inline void LogReplyParamsToMessage(const ReplyParamType& reply_params,
const Message* msg) {
if (msg->received_time() != 0) {
- std::wstring output_params;
+ std::string output_params;
LogParam(reply_params, &output_params);
msg->set_output_params(output_params);
}
@@ -1132,7 +1114,7 @@ inline void ConnectMessageAndReply(const Message* msg, Message* reply) {
}
}
#else
-inline void AddOutputParamsToLog(const Message* msg, std::wstring* l) {}
+inline void AddOutputParamsToLog(const Message* msg, std::string* l) {}
template <class ReplyParamType>
inline void LogReplyParamsToMessage(const ReplyParamType& reply_params,