Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Unified Diff: ipc/ipc_message_utils.h

Issue 3080040: Revert 55259 - FBTF: New IPC definitions, only applied to async ROUTED and CO... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/ipc_message_macros.h ('k') | ipc/ipc_message_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_message_utils.h
===================================================================
--- ipc/ipc_message_utils.h (revision 55405)
+++ ipc/ipc_message_utils.h (working copy)
@@ -18,7 +18,7 @@
#include "base/string16.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
+#include "base/time.h"
#include "base/tuple.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -67,13 +67,6 @@
LastMsgIndex
};
-class DictionaryValue;
-class ListValue;
-
-namespace base {
-class Time;
-}
-
namespace IPC {
//-----------------------------------------------------------------------------
@@ -313,9 +306,19 @@
template <>
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 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);
+ }
};
#if defined(OS_WIN)
@@ -362,9 +365,6 @@
return result;
}
- static void Log(const param_type& p, std::wstring* l) {
- l->append(L"<MSG>");
- }
};
#endif // defined(OS_WIN)
@@ -1026,15 +1026,21 @@
class MessageWithTuple : public Message {
public:
typedef ParamType Param;
- typedef typename TupleTypes<ParamType>::ParamTuple RefParam;
+ typedef typename 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 bool Read(const Message* msg, Param* p);
+ MessageWithTuple(int32 routing_id, uint32 type, const RefParam& p)
+ : Message(routing_id, type, PRIORITY_NORMAL) {
+ WriteParam(this, p);
+ }
+ static bool Read(const Message* msg, Param* p) {
+ void* iter = NULL;
+ if (ReadParam(msg, &iter, p))
+ return true;
+ NOTREACHED() << "Error deserializing message " << msg->type();
+ return false;
+ }
+
// Generic dispatcher. Should cover most cases.
template<class T, class Method>
static bool Dispatch(const Message* msg, T* obj, Method func) {
@@ -1105,6 +1111,12 @@
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>
@@ -1177,7 +1189,7 @@
class MessageWithReply : public SyncMessage {
public:
typedef SendParamType SendParam;
- typedef typename TupleTypes<SendParam>::ParamTuple RefSendParam;
+ typedef typename SendParam::ParamTuple RefSendParam;
typedef ReplyParamType ReplyParam;
MessageWithReply(int32 routing_id, uint32 type,
@@ -1204,7 +1216,7 @@
} else {
// This is an outgoing reply. Now that we have the output parameters, we
// can finally log the message.
- typename TupleTypes<ReplyParam>::ValueTuple p;
+ typename ReplyParam::ValueTuple p;
void* iter = SyncMessage::GetDataIterator(msg);
if (ReadParam(msg, &iter, &p))
LogParam(p, l);
@@ -1218,7 +1230,7 @@
Message* reply = GenerateReply(msg);
bool error;
if (ReadParam(msg, &iter, &send_params)) {
- typename TupleTypes<ReplyParam>::ValueTuple reply_params;
+ typename ReplyParam::ValueTuple reply_params;
DispatchToMethod(obj, func, send_params, &reply_params);
WriteParam(reply, reply_params);
error = false;
« no previous file with comments | « ipc/ipc_message_macros.h ('k') | ipc/ipc_message_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698