Chromium Code Reviews| Index: chrome/test/ipclist/ipclist.cc |
| =================================================================== |
| --- chrome/test/ipclist/ipclist.cc (revision 0) |
| +++ chrome/test/ipclist/ipclist.cc (revision 0) |
| @@ -0,0 +1,56 @@ |
| + |
|
jam
2011/03/09 06:33:45
nit: empty line
|
| +#include <iostream> |
| +#include <string> |
| + |
|
Paweł Hajdan Jr.
2011/03/09 15:56:41
I think you really want this file in chrome/tools.
|
| +// Include once to get the type definitions |
| +#include "chrome/common/common_message_generator.h" |
| + |
| +struct msginfo { |
| + const char* name; |
| + int id; |
| + int in_count; |
| + int out_count; |
| +}; |
| + |
| +// Redefine macros to generate table |
| +#include "ipc/ipc_message_null_macros.h" |
| +#undef IPC_MESSAGE_DECL |
| +#define IPC_MESSAGE_DECL(kind, type, name, in, out, ilist, olist) \ |
| + { #name, IPC_MESSAGE_ID(), in, out }, |
| + |
| +static const struct msginfo msgtable[] = { |
| +#include "chrome/common/common_message_generator.h" |
| +}; |
| + |
| +int main(int argc, char **argv) { |
| + bool show_args = false; |
| + bool show_ids = false; |
| + |
| + while (--argc > 0) { |
| + ++argv; |
| + if (std::string("--args") == *argv) |
|
jam
2011/03/09 06:33:45
nit: need brace brackets for if statement per guid
|
| + show_args = true; |
| + else if (std::string("--ids") == *argv) |
| + show_ids = true; |
| + else { |
| + std::cout << "usage: ipclist [--args] [--ids]" << std::endl; |
| + return 1; |
| + } |
| + } |
| + |
| + for (size_t i = 0; i < sizeof(msgtable)/sizeof(msgtable[0]); ++i) { |
| + std::cout << msgtable[i].name; |
| + |
| + if (show_args) |
| + std::cout << "(" << msgtable[i].in_count << " IN, " << |
| + msgtable[i].out_count << " OUT)"; |
| + |
| + if (show_ids) |
| + std::cout << " {" << IPC_MESSAGE_ID_CLASS(msgtable[i].id) << ", " << |
| + IPC_MESSAGE_ID_LINE(msgtable[i].id) << "}"; |
| + |
| + std::cout << std::endl; |
| + } |
| + |
| + return 0; |
| +} |
| Property changes on: chrome/test/ipclist/ipclist.cc |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |