Index: ipc/ipc_message_utils.h |
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h |
index e1d4b4b25e3c2fb917afbcdd76327dd1c1d5ca1f..c18ba38f1bb84eb1e91b9a627367bdafdb3607c0 100644 |
--- a/ipc/ipc_message_utils.h |
+++ b/ipc/ipc_message_utils.h |
@@ -18,7 +18,7 @@ |
#include "base/string16.h" |
#include "base/string_number_conversions.h" |
#include "base/string_util.h" |
-#include "base/time.h" |
+#include "base/utf_string_conversions.h" |
#include "base/tuple.h" |
#include "base/utf_string_conversions.h" |
#include "base/values.h" |
@@ -65,6 +65,13 @@ enum IPCMessageStart { |
LastMsgIndex |
}; |
+class DictionaryValue; |
+class ListValue; |
+ |
+namespace base { |
+class Time; |
+} |
+ |
namespace IPC { |
//----------------------------------------------------------------------------- |
@@ -304,19 +311,9 @@ struct ParamTraits<wchar_t> { |
template <> |
struct ParamTraits<base::Time> { |
typedef base::Time param_type; |
- static void Write(Message* m, const param_type& p) { |
- ParamTraits<int64>::Write(m, p.ToInternalValue()); |
- } |
- static bool Read(const Message* m, void** iter, param_type* r) { |
- int64 value; |
- if (!ParamTraits<int64>::Read(m, iter, &value)) |
- return false; |
- *r = base::Time::FromInternalValue(value); |
- return true; |
- } |
- static void Log(const param_type& p, std::wstring* l) { |
- ParamTraits<int64>::Log(p.ToInternalValue(), l); |
- } |
+ 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); |
}; |
#if defined(OS_WIN) |
@@ -363,6 +360,9 @@ struct ParamTraits<MSG> { |
return result; |
} |
+ static void Log(const param_type& p, std::wstring* l) { |
+ l->append(L"<MSG>"); |
+ } |
}; |
#endif // defined(OS_WIN) |
@@ -1024,13 +1024,17 @@ template <class ParamType> |
class MessageWithTuple : public Message { |
public: |
typedef ParamType Param; |
- typedef typename ParamType::ParamTuple RefParam; |
+ typedef typename TupleTypes<ParamType>::ParamTuple RefParam; |
- MessageWithTuple(int32 routing_id, uint32 type, const RefParam& p) |
- : Message(routing_id, type, PRIORITY_NORMAL) { |
- WriteParam(this, p); |
- } |
+ // 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); |
+ // TODO(erg): Migrate this method into ipc_message_utils_impl.h once I figure |
+ // out why just having the template in that file and the forward declaration |
+ // here breaks the release build. |
static bool Read(const Message* msg, Param* p) { |
Matt Perry
2010/08/09 20:56:28
Interesting, it still compiles with the forward de
Elliot Glaysher
2010/08/09 21:04:04
Correct. Since it is a reference type (and we don'
|
void* iter = NULL; |
if (ReadParam(msg, &iter, p)) |
@@ -1109,12 +1113,6 @@ class MessageWithTuple : public Message { |
return false; |
} |
- static void Log(const Message* msg, std::wstring* l) { |
- Param p; |
- if (Read(msg, &p)) |
- LogParam(p, l); |
- } |
- |
// 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> |
@@ -1187,7 +1185,7 @@ template <class SendParamType, class ReplyParamType> |
class MessageWithReply : public SyncMessage { |
public: |
typedef SendParamType SendParam; |
- typedef typename SendParam::ParamTuple RefSendParam; |
+ typedef typename TupleTypes<SendParam>::ParamTuple RefSendParam; |
typedef ReplyParamType ReplyParam; |
MessageWithReply(int32 routing_id, uint32 type, |
@@ -1214,7 +1212,7 @@ class MessageWithReply : public SyncMessage { |
} else { |
// This is an outgoing reply. Now that we have the output parameters, we |
// can finally log the message. |
- typename ReplyParam::ValueTuple p; |
+ typename TupleTypes<ReplyParam>::ValueTuple p; |
void* iter = SyncMessage::GetDataIterator(msg); |
if (ReadParam(msg, &iter, &p)) |
LogParam(p, l); |
@@ -1228,7 +1226,7 @@ class MessageWithReply : public SyncMessage { |
Message* reply = GenerateReply(msg); |
bool error; |
if (ReadParam(msg, &iter, &send_params)) { |
- typename ReplyParam::ValueTuple reply_params; |
+ typename TupleTypes<ReplyParam>::ValueTuple reply_params; |
DispatchToMethod(obj, func, send_params, &reply_params); |
WriteParam(reply, reply_params); |
error = false; |