| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. | 10 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. |
| 11 | 11 |
| 12 #ifdef IPC_MESSAGE_LOG_ENABLED | 12 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 13 | 13 |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/containers/hash_tables.h" | 16 #include "base/containers/hash_tables.h" |
| 17 #include "base/memory/ref_counted.h" |
| 17 #include "base/memory/singleton.h" | 18 #include "base/memory/singleton.h" |
| 18 #include "base/message_loop/message_loop.h" | 19 #include "base/single_thread_task_runner.h" |
| 19 #include "ipc/ipc_export.h" | 20 #include "ipc/ipc_export.h" |
| 20 | 21 |
| 21 // Logging function. |name| is a string in ASCII and |params| is a string in | 22 // Logging function. |name| is a string in ASCII and |params| is a string in |
| 22 // UTF-8. | 23 // UTF-8. |
| 23 typedef void (*LogFunction)(std::string* name, | 24 typedef void (*LogFunction)(std::string* name, |
| 24 const IPC::Message* msg, | 25 const IPC::Message* msg, |
| 25 std::string* params); | 26 std::string* params); |
| 26 | 27 |
| 27 typedef base::hash_map<uint32_t, LogFunction > LogFunctionMap; | 28 typedef base::hash_map<uint32_t, LogFunction > LogFunctionMap; |
| 28 | 29 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 void Log(const LogData& data); | 108 void Log(const LogData& data); |
| 108 | 109 |
| 109 bool enabled_; | 110 bool enabled_; |
| 110 bool enabled_on_stderr_; // only used on POSIX for now | 111 bool enabled_on_stderr_; // only used on POSIX for now |
| 111 bool enabled_color_; // only used on POSIX for now | 112 bool enabled_color_; // only used on POSIX for now |
| 112 | 113 |
| 113 std::vector<LogData> queued_logs_; | 114 std::vector<LogData> queued_logs_; |
| 114 bool queue_invoke_later_pending_; | 115 bool queue_invoke_later_pending_; |
| 115 | 116 |
| 116 Sender* sender_; | 117 Sender* sender_; |
| 117 base::MessageLoop* main_thread_; | 118 scoped_refptr<base::SingleThreadTaskRunner> main_thread_; |
| 118 | 119 |
| 119 Consumer* consumer_; | 120 Consumer* consumer_; |
| 120 | 121 |
| 121 static LogFunctionMap* log_function_map_; | 122 static LogFunctionMap* log_function_map_; |
| 122 }; | 123 }; |
| 123 | 124 |
| 124 } // namespace IPC | 125 } // namespace IPC |
| 125 | 126 |
| 126 #endif // IPC_MESSAGE_LOG_ENABLED | 127 #endif // IPC_MESSAGE_LOG_ENABLED |
| 127 | 128 |
| 128 #endif // IPC_IPC_LOGGING_H_ | 129 #endif // IPC_IPC_LOGGING_H_ |
| OLD | NEW |