Chromium Code Reviews| Index: ipc/ipc_message_utils.h |
| =================================================================== |
| --- ipc/ipc_message_utils.h (revision 47146) |
| +++ ipc/ipc_message_utils.h (working copy) |
| @@ -9,6 +9,7 @@ |
| #include <string> |
| #include <vector> |
| #include <map> |
| +#include <set> |
| #include "base/file_path.h" |
| #include "base/format_macros.h" |
| @@ -38,6 +39,8 @@ |
| PluginProcessHostMsgStart, |
| PluginMsgStart, |
| PluginHostMsgStart, |
| + ProfileImportProcessMsgStart, |
| + ProfileImportProcessHostMsgStart, |
| NPObjectMsgStart, |
| TestMsgStart, |
| DevToolsAgentMsgStart, |
| @@ -467,12 +470,38 @@ |
| for (size_t i = 0; i < p.size(); ++i) { |
| if (i != 0) |
| l->append(L" "); |
| - |
| LogParam((p[i]), l); |
| } |
| } |
| }; |
| +template <class P> |
| +struct ParamTraits<std::set<P> > { |
| + typedef std::set<P> param_type; |
| + static void Write(Message* m, const param_type& p) { |
| + WriteParam(m, static_cast<int>(p.size())); |
| + typename param_type::const_iterator iter; |
| + for (iter = p.begin(); iter != p.end(); ++iter) |
| + WriteParam(m, *iter); |
| + } |
| + static bool Read(const Message* m, void** iter, param_type* r) { |
| + int size; |
| + if (!m->ReadLength(iter, &size)) |
| + return false; |
| + for (int i = 0; i < size; ++i) { |
| + P item; |
| + if (!ReadParam(m, iter, &item)) |
| + return false; |
| + r->insert(item); |
| + } |
| + return true; |
| + } |
| + static void Log(const param_type& p, std::wstring* l) { |
| + l->append(L"<std::set>"); |
|
jeremy
2010/05/13 21:01:59
Should LogParam() all items in the set (see std::v
|
| + } |
| +}; |
| + |
| + |
| template <class K, class V> |
| struct ParamTraits<std::map<K, V> > { |
| typedef std::map<K, V> param_type; |