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

Side by Side Diff: chrome/tools/ipclist/ipclist.cc

Issue 11347012: Split IPC logging between content and chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 #include <iostream> 6 #include <iostream>
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 // Include once to get the type definitions 10 // Include once to get the type definitions
11 #include "chrome/common/all_messages.h" 11 #include "chrome/common/all_messages.h"
12 #include "content/common/all_messages.h"
12 13
13 struct msginfo { 14 struct msginfo {
14 const char* name; 15 const char* name;
15 int id; 16 int id;
16 int in_count; 17 int in_count;
17 int out_count; 18 int out_count;
18 19
19 bool operator< (const msginfo other) const { 20 bool operator< (const msginfo other) const {
20 return id < other.id; 21 return id < other.id;
21 } 22 }
22 }; 23 };
23 24
24 // Redefine macros to generate table 25 // Redefine macros to generate table
25 #include "ipc/ipc_message_null_macros.h" 26 #include "ipc/ipc_message_null_macros.h"
26 #undef IPC_MESSAGE_DECL 27 #undef IPC_MESSAGE_DECL
27 #define IPC_MESSAGE_DECL(kind, type, name, in, out, ilist, olist) \ 28 #define IPC_MESSAGE_DECL(kind, type, name, in, out, ilist, olist) \
28 { #name, IPC_MESSAGE_ID(), in, out }, 29 { #name, IPC_MESSAGE_ID(), in, out },
29 30
30 static msginfo msgtable[] = { 31 static msginfo msgtable[] = {
31 #include "chrome/common/all_messages.h" 32 #include "chrome/common/all_messages.h"
33 #include "content/common/all_messages.h"
32 }; 34 };
33 #define MSGTABLE_SIZE (sizeof(msgtable)/sizeof(msgtable[0])) 35 #define MSGTABLE_SIZE (sizeof(msgtable)/sizeof(msgtable[0]))
34 36
35 static bool check_msgtable() { 37 static bool check_msgtable() {
36 bool result = true; 38 bool result = true;
37 int previous_class_id = 0; 39 int previous_class_id = 0;
38 int highest_class_id = 0; 40 int highest_class_id = 0;
39 std::vector<int> exemptions; 41 std::vector<int> exemptions;
40 42
41 // Exclude test and other non-browser files from consideration. Do not 43 // Exclude test and other non-browser files from consideration. Do not
(...skipping 28 matching lines...) Expand all
70 iter = find(exemptions.begin(), exemptions.end(), highest_class_id+1); 72 iter = find(exemptions.begin(), exemptions.end(), highest_class_id+1);
71 if (iter == exemptions.end()) { 73 if (iter == exemptions.end()) {
72 std::cout << "Missing message file: gap before LastIPCMsgStart\n"; 74 std::cout << "Missing message file: gap before LastIPCMsgStart\n";
73 result = false; 75 result = false;
74 break; 76 break;
75 } 77 }
76 ++highest_class_id; 78 ++highest_class_id;
77 } 79 }
78 80
79 if (!result) 81 if (!result)
80 std::cout << "Please check chrome/common/all_messages.h.\n"; 82 std::cout << "Please check {chrome,content}/common/all_messages.h.\n";
81 83
82 return result; 84 return result;
83 } 85 }
84 86
85 static void dump_msgtable(bool show_args, bool show_ids, 87 static void dump_msgtable(bool show_args, bool show_ids,
86 bool show_comma, const char *prefix) { 88 bool show_comma, const char *prefix) {
87 bool first = true; 89 bool first = true;
88 for (size_t i = 0; i < MSGTABLE_SIZE; ++i) { 90 for (size_t i = 0; i < MSGTABLE_SIZE; ++i) {
89 if ((!prefix) || strstr(msgtable[i].name, prefix) == msgtable[i].name) { 91 if ((!prefix) || strstr(msgtable[i].name, prefix) == msgtable[i].name) {
90 if (show_comma) { 92 if (show_comma) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 142
141 std::sort(msgtable, msgtable + MSGTABLE_SIZE); 143 std::sort(msgtable, msgtable + MSGTABLE_SIZE);
142 144
143 if (!skip_check && check_msgtable() == false) 145 if (!skip_check && check_msgtable() == false)
144 return 1; 146 return 1;
145 147
146 dump_msgtable(show_args, show_ids, show_comma, filter); 148 dump_msgtable(show_args, show_ids, show_comma, filter);
147 return 0; 149 return 0;
148 } 150 }
149 151
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698