summaryrefslogtreecommitdiffstats
path: root/chrome/common/ipc_logging.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common/ipc_logging.h')
-rw-r--r--chrome/common/ipc_logging.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/chrome/common/ipc_logging.h b/chrome/common/ipc_logging.h
index 7fa2be4..9173cd7 100644
--- a/chrome/common/ipc_logging.h
+++ b/chrome/common/ipc_logging.h
@@ -27,15 +27,18 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef CHROME_COMMON_IPC_LOGGING_H__
-#define CHROME_COMMON_IPC_LOGGING_H__
+#ifndef CHROME_COMMON_IPC_LOGGING_H_
+#define CHROME_COMMON_IPC_LOGGING_H_
#include "base/lock.h"
-#include "base/message_loop.h"
+#include "base/object_watcher.h"
+#include "base/singleton.h"
#include "chrome/common/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
#ifdef IPC_MESSAGE_LOG_ENABLED
+class MessageLoop;
+
namespace IPC {
class Message;
@@ -43,8 +46,7 @@ class Message;
// One instance per process. Needs to be created on the main thread (the UI
// thread in the browser) but OnPreDispatchMessage/OnPostDispatchMessage
// can be called on other threads.
-class Logging : public base::RefCounted<Logging>,
- public MessageLoop::Watcher {
+class Logging : public base::ObjectWatcher::Delegate {
public:
// Implemented by consumers of log messages.
class Consumer {
@@ -85,10 +87,11 @@ class Logging : public base::RefCounted<Logging>,
static void GetMessageText(uint16 type, std::wstring* name,
const Message* message, std::wstring* params);
- // MessageLoop::Watcher
+ // ObjectWatcher::Delegate implementation
void OnObjectSignaled(HANDLE object);
private:
+ friend struct DefaultSingletonTraits<IPC::Logging>;
Logging();
std::wstring GetEventName(int browser_pid, bool enabled);
@@ -97,6 +100,8 @@ class Logging : public base::RefCounted<Logging>,
void RegisterWaitForEvent(bool enabled);
+ base::ObjectWatcher watcher_;
+
HANDLE logging_event_on_;
HANDLE logging_event_off_;
bool enabled_;
@@ -108,14 +113,10 @@ class Logging : public base::RefCounted<Logging>,
MessageLoop* main_thread_;
Consumer* consumer_;
-
- static scoped_refptr<Logging> current_;
-
- static Lock logger_lock_;
};
} // namespace IPC
#endif // IPC_MESSAGE_LOG_ENABLED
-#endif // CHROME_COMMON_IPC_LOGGING_H__
+#endif // CHROME_COMMON_IPC_LOGGING_H_