OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Need to include this before any other file because it defines |
| 6 // IPC_MESSAGE_LOG_ENABLED. |
| 7 #include "chrome/common/ipc_message.h" |
| 8 |
| 9 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 10 #define IPC_MESSAGE_MACROS_LOG_ENABLED |
| 11 |
5 #include "chrome/browser/tab_contents/ipc_status_view.h" | 12 #include "chrome/browser/tab_contents/ipc_status_view.h" |
6 | 13 |
7 #include <stdio.h> | 14 #include <stdio.h> |
8 | 15 |
9 #include "base/logging.h" | 16 #include "base/logging.h" |
10 #include "base/string_util.h" | 17 #include "base/string_util.h" |
11 #include "chrome/app/chrome_dll_resource.h" | 18 #include "chrome/app/chrome_dll_resource.h" |
12 #include "chrome/browser/profile.h" | 19 #include "chrome/browser/profile.h" |
13 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
14 #include "chrome/common/ipc_logging.h" | 21 #include "chrome/common/ipc_logging.h" |
15 #include "chrome/common/plugin_messages.h" | 22 #include "chrome/common/plugin_messages.h" |
16 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
17 #include "chrome/common/pref_service.h" | 24 #include "chrome/common/pref_service.h" |
18 #include "chrome/common/render_messages.h" | 25 #include "chrome/common/render_messages.h" |
19 | 26 |
20 #ifdef IPC_MESSAGE_LOG_ENABLED | |
21 | |
22 using base::Time; | 27 using base::Time; |
23 | 28 |
24 namespace { | 29 namespace { |
25 const wchar_t kTitleMsg[] = L"IPC Messages"; | 30 const wchar_t kTitleMsg[] = L"IPC Messages"; |
26 | 31 |
27 const wchar_t kStartLoggingMsg[] = L"Start IPC Logging"; | 32 const wchar_t kStartLoggingMsg[] = L"Start IPC Logging"; |
28 const wchar_t kStopLoggingMsg[] = L"Stop IPC Logging"; | 33 const wchar_t kStopLoggingMsg[] = L"Stop IPC Logging"; |
29 const wchar_t kClearMsg[] = L"Clear"; | 34 const wchar_t kClearMsg[] = L"Clear"; |
30 const wchar_t kSettingsMsg[] = L"Filter"; | 35 const wchar_t kSettingsMsg[] = L"Filter"; |
31 | 36 |
32 enum { | 37 enum { |
33 kTimeColumn = 0, | 38 kTimeColumn = 0, |
34 kChannelColumn, | 39 kChannelColumn, |
35 kMessageColumn, | 40 kMessageColumn, |
36 kFlagsColumn, | 41 kFlagsColumn, |
37 kDispatchColumn, | 42 kDispatchColumn, |
38 kProcessColumn, | 43 kProcessColumn, |
39 kParamsColumn, | 44 kParamsColumn, |
40 }; | 45 }; |
41 | 46 |
42 // This class ensures that we have a link dependency on render_messages.cc and | |
43 // plugin_messages.cc, and at the same time sets up the message logger function | |
44 // mappings. | |
45 class RegisterLoggerFuncs { | |
46 public: | |
47 RegisterLoggerFuncs() { | |
48 RenderMessagesInit(); | |
49 PluginMessagesInit(); | |
50 } | |
51 }; | |
52 | |
53 RegisterLoggerFuncs g_register_logger_funcs; | |
54 | |
55 } // namespace | 47 } // namespace |
56 | 48 |
57 IPCStatusView* IPCStatusView::current_; | 49 IPCStatusView* IPCStatusView::current_; |
58 | 50 |
59 IPCStatusView::IPCStatusView() | 51 IPCStatusView::IPCStatusView() |
60 : StatusView(TAB_CONTENTS_IPC_STATUS_VIEW) { | 52 : StatusView(TAB_CONTENTS_IPC_STATUS_VIEW) { |
61 DCHECK(!current_); | 53 DCHECK(!current_); |
62 current_ = this; | 54 current_ = this; |
63 settings_dialog_ = NULL; | 55 settings_dialog_ = NULL; |
64 init_done_ = false; | 56 init_done_ = false; |
65 view_ = NULL; | 57 view_ = NULL; |
66 view_host_ = NULL; | 58 view_host_ = NULL; |
67 plugin_ = NULL; | 59 plugin_ = NULL; |
68 plugin_host_ = NULL; | 60 plugin_host_ = NULL; |
69 npobject_ = NULL; | 61 npobject_ = NULL; |
70 plugin_process_ = NULL; | 62 plugin_process_ = NULL; |
71 plugin_process_host_ = NULL; | 63 plugin_process_host_ = NULL; |
72 | 64 |
73 IPC::Logging::current()->SetConsumer(this); | 65 IPC::Logging* log = IPC::Logging::current(); |
| 66 log->RegisterMessageLogger(ViewStart, ViewMsgLog); |
| 67 log->RegisterMessageLogger(ViewHostStart, ViewHostMsgLog); |
| 68 log->RegisterMessageLogger(PluginProcessStart, PluginProcessMsgLog); |
| 69 log->RegisterMessageLogger(PluginProcessHostStart, PluginProcessHostMsgLog); |
| 70 log->RegisterMessageLogger(PluginStart, PluginMsgLog); |
| 71 log->RegisterMessageLogger(PluginHostStart, PluginHostMsgLog); |
| 72 log->RegisterMessageLogger(NPObjectStart, NPObjectMsgLog); |
| 73 |
| 74 log->SetConsumer(this); |
74 } | 75 } |
75 | 76 |
76 IPCStatusView::~IPCStatusView() { | 77 IPCStatusView::~IPCStatusView() { |
77 current_ = NULL; | 78 current_ = NULL; |
78 IPC::Logging::current()->SetConsumer(NULL); | 79 IPC::Logging::current()->SetConsumer(NULL); |
79 | 80 |
80 if (settings_dialog_ != NULL) | 81 if (settings_dialog_ != NULL) |
81 ::DestroyWindow(settings_dialog_); | 82 ::DestroyWindow(settings_dialog_); |
82 } | 83 } |
83 | 84 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 HINSTANCE module_handle = GetModuleHandle(chrome::kBrowserResourcesDll); | 363 HINSTANCE module_handle = GetModuleHandle(chrome::kBrowserResourcesDll); |
363 | 364 |
364 settings_dialog_ = CreateDialog(module_handle, | 365 settings_dialog_ = CreateDialog(module_handle, |
365 MAKEINTRESOURCE(IDD_IPC_SETTINGS), | 366 MAKEINTRESOURCE(IDD_IPC_SETTINGS), |
366 NULL, | 367 NULL, |
367 IPCStatusView::DialogProc); | 368 IPCStatusView::DialogProc); |
368 ::ShowWindow(settings_dialog_, SW_SHOW); | 369 ::ShowWindow(settings_dialog_, SW_SHOW); |
369 } | 370 } |
370 | 371 |
371 #endif // IPC_MESSAGE_LOG_ENABLED | 372 #endif // IPC_MESSAGE_LOG_ENABLED |
OLD | NEW |