Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Unified Diff: content/common/content_ipc_logging.cc

Issue 11347012: Split IPC logging between content and chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/common/content_ipc_logging.cc
diff --git a/content/common/content_ipc_logging.cc b/content/common/content_ipc_logging.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d1178a226491aebb8ca87bd14b4c1fd546d3cc5a
--- /dev/null
+++ b/content/common/content_ipc_logging.cc
@@ -0,0 +1,35 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
+
+#if defined(OS_POSIX) && defined(IPC_MESSAGE_LOG_ENABLED)
+#define IPC_MESSAGE_MACROS_LOG_ENABLED
+#include "content/public/common/content_ipc_logging.h"
+#define IPC_LOG_TABLE_ADD_ENTRY(msg_id, logger) \
+ content::RegisterIPCLogger(msg_id, logger)
+#include "content/common/all_messages.h"
+#endif
+
+#if defined(IPC_MESSAGE_LOG_ENABLED)
+
+#include "base/hash_tables.h"
+#include "base/lazy_instance.h"
+
+namespace content {
+
+namespace {
+base::LazyInstance<base::hash_map<uint32, LogFunction> >::Leaky
+ g_log_function_mapping = LAZY_INSTANCE_INITIALIZER;
jam 2012/10/29 15:48:48 nit: spacing
+} // namespace
+
+void RegisterIPCLogger(uint32 msg_id, LogFunction logger) {
+ if (g_log_function_mapping == NULL)
+ IPC::Logging::set_log_function_map(g_log_function_mapping.Pointer());
+ g_log_function_mapping.Get()[msg_id] = logger;
+}
+
+} // content
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698