| 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 | |
| 12 #include "chrome/browser/tab_contents/ipc_status_view.h" | 5 #include "chrome/browser/tab_contents/ipc_status_view.h" |
| 13 | 6 |
| 14 #include <stdio.h> | 7 #include <stdio.h> |
| 15 | 8 |
| 16 #include "base/logging.h" | 9 #include "base/logging.h" |
| 17 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 18 #include "chrome/app/chrome_dll_resource.h" | 11 #include "chrome/app/chrome_dll_resource.h" |
| 19 #include "chrome/browser/profile.h" | 12 #include "chrome/browser/profile.h" |
| 20 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
| 21 #include "chrome/common/ipc_logging.h" | 14 #include "chrome/common/ipc_logging.h" |
| 22 #include "chrome/common/plugin_messages.h" | 15 #include "chrome/common/plugin_messages.h" |
| 23 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 24 #include "chrome/common/pref_service.h" | 17 #include "chrome/common/pref_service.h" |
| 25 #include "chrome/common/render_messages.h" | 18 #include "chrome/common/render_messages.h" |
| 26 | 19 |
| 20 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 21 |
| 27 using base::Time; | 22 using base::Time; |
| 28 | 23 |
| 29 namespace { | 24 namespace { |
| 30 const wchar_t kTitleMsg[] = L"IPC Messages"; | 25 const wchar_t kTitleMsg[] = L"IPC Messages"; |
| 31 | 26 |
| 32 const wchar_t kStartLoggingMsg[] = L"Start IPC Logging"; | 27 const wchar_t kStartLoggingMsg[] = L"Start IPC Logging"; |
| 33 const wchar_t kStopLoggingMsg[] = L"Stop IPC Logging"; | 28 const wchar_t kStopLoggingMsg[] = L"Stop IPC Logging"; |
| 34 const wchar_t kClearMsg[] = L"Clear"; | 29 const wchar_t kClearMsg[] = L"Clear"; |
| 35 const wchar_t kSettingsMsg[] = L"Filter"; | 30 const wchar_t kSettingsMsg[] = L"Filter"; |
| 36 | 31 |
| 37 enum { | 32 enum { |
| 38 kTimeColumn = 0, | 33 kTimeColumn = 0, |
| 39 kChannelColumn, | 34 kChannelColumn, |
| 40 kMessageColumn, | 35 kMessageColumn, |
| 41 kFlagsColumn, | 36 kFlagsColumn, |
| 42 kDispatchColumn, | 37 kDispatchColumn, |
| 43 kProcessColumn, | 38 kProcessColumn, |
| 44 kParamsColumn, | 39 kParamsColumn, |
| 45 }; | 40 }; |
| 46 | 41 |
| 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 |
| 47 } // namespace | 55 } // namespace |
| 48 | 56 |
| 49 IPCStatusView* IPCStatusView::current_; | 57 IPCStatusView* IPCStatusView::current_; |
| 50 | 58 |
| 51 IPCStatusView::IPCStatusView() | 59 IPCStatusView::IPCStatusView() |
| 52 : StatusView(TAB_CONTENTS_IPC_STATUS_VIEW) { | 60 : StatusView(TAB_CONTENTS_IPC_STATUS_VIEW) { |
| 53 DCHECK(!current_); | 61 DCHECK(!current_); |
| 54 current_ = this; | 62 current_ = this; |
| 55 settings_dialog_ = NULL; | 63 settings_dialog_ = NULL; |
| 56 init_done_ = false; | 64 init_done_ = false; |
| 57 view_ = NULL; | 65 view_ = NULL; |
| 58 view_host_ = NULL; | 66 view_host_ = NULL; |
| 59 plugin_ = NULL; | 67 plugin_ = NULL; |
| 60 plugin_host_ = NULL; | 68 plugin_host_ = NULL; |
| 61 npobject_ = NULL; | 69 npobject_ = NULL; |
| 62 plugin_process_ = NULL; | 70 plugin_process_ = NULL; |
| 63 plugin_process_host_ = NULL; | 71 plugin_process_host_ = NULL; |
| 64 | 72 |
| 65 IPC::Logging* log = IPC::Logging::current(); | 73 IPC::Logging::current()->SetConsumer(this); |
| 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); | |
| 75 } | 74 } |
| 76 | 75 |
| 77 IPCStatusView::~IPCStatusView() { | 76 IPCStatusView::~IPCStatusView() { |
| 78 current_ = NULL; | 77 current_ = NULL; |
| 79 IPC::Logging::current()->SetConsumer(NULL); | 78 IPC::Logging::current()->SetConsumer(NULL); |
| 80 | 79 |
| 81 if (settings_dialog_ != NULL) | 80 if (settings_dialog_ != NULL) |
| 82 ::DestroyWindow(settings_dialog_); | 81 ::DestroyWindow(settings_dialog_); |
| 83 } | 82 } |
| 84 | 83 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 HINSTANCE module_handle = GetModuleHandle(chrome::kBrowserResourcesDll); | 362 HINSTANCE module_handle = GetModuleHandle(chrome::kBrowserResourcesDll); |
| 364 | 363 |
| 365 settings_dialog_ = CreateDialog(module_handle, | 364 settings_dialog_ = CreateDialog(module_handle, |
| 366 MAKEINTRESOURCE(IDD_IPC_SETTINGS), | 365 MAKEINTRESOURCE(IDD_IPC_SETTINGS), |
| 367 NULL, | 366 NULL, |
| 368 IPCStatusView::DialogProc); | 367 IPCStatusView::DialogProc); |
| 369 ::ShowWindow(settings_dialog_, SW_SHOW); | 368 ::ShowWindow(settings_dialog_, SW_SHOW); |
| 370 } | 369 } |
| 371 | 370 |
| 372 #endif // IPC_MESSAGE_LOG_ENABLED | 371 #endif // IPC_MESSAGE_LOG_ENABLED |
| OLD | NEW |