summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-13 19:10:34 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-13 19:10:34 +0000
commit96da696cd0f43a860dd4ea6b135b958f95ed5e52 (patch)
treed40dfc42b6a63364fc6b96a14ef7aef4075db354 /ipc
parent6596c17e07245a4b65e62e8b1b44faa5bca71b88 (diff)
downloadchromium_src-96da696cd0f43a860dd4ea6b135b958f95ed5e52.zip
chromium_src-96da696cd0f43a860dd4ea6b135b958f95ed5e52.tar.gz
chromium_src-96da696cd0f43a860dd4ea6b135b958f95ed5e52.tar.bz2
Add new ipc message utility and new message types in preparation for OOP import patch. This patch adds the ability to move a set across IPC, and adds two new message types.
BUG= 18774 TEST= none Review URL: http://codereview.chromium.org/2097001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47172 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r--ipc/ipc_message_utils.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index bad5fc2..df2c6c7 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -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 @@ enum IPCMessageStart {
PluginProcessHostMsgStart,
PluginMsgStart,
PluginHostMsgStart,
+ ProfileImportProcessMsgStart,
+ ProfileImportProcessHostMsgStart,
NPObjectMsgStart,
TestMsgStart,
DevToolsAgentMsgStart,
@@ -467,12 +470,38 @@ struct ParamTraits<std::vector<P> > {
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>");
+ }
+};
+
+
template <class K, class V>
struct ParamTraits<std::map<K, V> > {
typedef std::map<K, V> param_type;