| OLD | NEW |
| 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 #ifndef IPC_IPC_LOGGING_H_ | 5 #ifndef IPC_IPC_LOGGING_H_ |
| 6 #define IPC_IPC_LOGGING_H_ | 6 #define IPC_IPC_LOGGING_H_ |
| 7 | 7 |
| 8 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. | 8 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. |
| 9 | 9 |
| 10 #ifdef IPC_MESSAGE_LOG_ENABLED | 10 #ifdef IPC_MESSAGE_LOG_ENABLED |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // UTF-8. | 21 // UTF-8. |
| 22 typedef void (*LogFunction)(std::string* name, | 22 typedef void (*LogFunction)(std::string* name, |
| 23 const IPC::Message* msg, | 23 const IPC::Message* msg, |
| 24 std::string* params); | 24 std::string* params); |
| 25 | 25 |
| 26 typedef base::hash_map<uint32, LogFunction > LogFunctionMap; | 26 typedef base::hash_map<uint32, LogFunction > LogFunctionMap; |
| 27 | 27 |
| 28 namespace IPC { | 28 namespace IPC { |
| 29 | 29 |
| 30 class Message; | 30 class Message; |
| 31 class Sender; |
| 31 | 32 |
| 32 // One instance per process. Needs to be created on the main thread (the UI | 33 // One instance per process. Needs to be created on the main thread (the UI |
| 33 // thread in the browser) but OnPreDispatchMessage/OnPostDispatchMessage | 34 // thread in the browser) but OnPreDispatchMessage/OnPostDispatchMessage |
| 34 // can be called on other threads. | 35 // can be called on other threads. |
| 35 class IPC_EXPORT Logging { | 36 class IPC_EXPORT Logging { |
| 36 public: | 37 public: |
| 37 // Implemented by consumers of log messages. | 38 // Implemented by consumers of log messages. |
| 38 class Consumer { | 39 class Consumer { |
| 39 public: | 40 public: |
| 40 virtual void Log(const LogData& data) = 0; | 41 virtual void Log(const LogData& data) = 0; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 Consumer* consumer_; | 118 Consumer* consumer_; |
| 118 | 119 |
| 119 static LogFunctionMap* log_function_map_; | 120 static LogFunctionMap* log_function_map_; |
| 120 }; | 121 }; |
| 121 | 122 |
| 122 } // namespace IPC | 123 } // namespace IPC |
| 123 | 124 |
| 124 #endif // IPC_MESSAGE_LOG_ENABLED | 125 #endif // IPC_MESSAGE_LOG_ENABLED |
| 125 | 126 |
| 126 #endif // IPC_IPC_LOGGING_H_ | 127 #endif // IPC_IPC_LOGGING_H_ |
| OLD | NEW |