OLD | NEW |
1 // Copyright (c) 2009 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 #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 |
11 | 11 |
(...skipping 11 matching lines...) Expand all Loading... |
23 // One instance per process. Needs to be created on the main thread (the UI | 23 // One instance per process. Needs to be created on the main thread (the UI |
24 // thread in the browser) but OnPreDispatchMessage/OnPostDispatchMessage | 24 // thread in the browser) but OnPreDispatchMessage/OnPostDispatchMessage |
25 // can be called on other threads. | 25 // can be called on other threads. |
26 class Logging : public base::WaitableEventWatcher::Delegate, | 26 class Logging : public base::WaitableEventWatcher::Delegate, |
27 public MessageLoop::DestructionObserver { | 27 public MessageLoop::DestructionObserver { |
28 public: | 28 public: |
29 // Implemented by consumers of log messages. | 29 // Implemented by consumers of log messages. |
30 class Consumer { | 30 class Consumer { |
31 public: | 31 public: |
32 virtual void Log(const LogData& data) = 0; | 32 virtual void Log(const LogData& data) = 0; |
33 protected: | |
34 ~Consumer() {} | |
35 }; | 33 }; |
36 | 34 |
37 void SetConsumer(Consumer* consumer); | 35 void SetConsumer(Consumer* consumer); |
38 | 36 |
39 ~Logging(); | 37 ~Logging(); |
40 static Logging* current(); | 38 static Logging* current(); |
41 | 39 |
42 void Enable(); | 40 void Enable(); |
43 void Disable(); | 41 void Disable(); |
44 bool Enabled() const { return enabled_; } | 42 bool Enabled() const { return enabled_; } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 Consumer* consumer_; | 103 Consumer* consumer_; |
106 | 104 |
107 static LogFunction *log_function_mapping_; | 105 static LogFunction *log_function_mapping_; |
108 }; | 106 }; |
109 | 107 |
110 } // namespace IPC | 108 } // namespace IPC |
111 | 109 |
112 #endif // IPC_MESSAGE_LOG_ENABLED | 110 #endif // IPC_MESSAGE_LOG_ENABLED |
113 | 111 |
114 #endif // IPC_IPC_LOGGING_H_ | 112 #endif // IPC_IPC_LOGGING_H_ |
OLD | NEW |