blob: 9d2a27de33e428b0b3f2790c54d05ac951f0d261 [file] [log] [blame]
[email protected]4f68ed72012-10-30 05:24:071// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
avia9aa7a82015-12-25 03:06:315#include <stdint.h>
6
Scott Violeta35f9a42018-03-22 22:00:447#include "ipc/ipc_buildflags.h"
davidsz041528a2017-05-12 09:19:238
9#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
[email protected]4f68ed72012-10-30 05:24:0710#define IPC_MESSAGE_MACROS_LOG_ENABLED
11#include "content/public/common/content_ipc_logging.h"
12#define IPC_LOG_TABLE_ADD_ENTRY(msg_id, logger) \
13 content::RegisterIPCLogger(msg_id, logger)
14#include "content/common/all_messages.h"
[email protected]4f68ed72012-10-30 05:24:0715
[email protected]4f68ed72012-10-30 05:24:0716
[email protected]14c1c232013-06-11 17:52:4417#include "base/containers/hash_tables.h"
[email protected]4f68ed72012-10-30 05:24:0718#include "base/lazy_instance.h"
19
20namespace content {
21
22namespace {
23
avia9aa7a82015-12-25 03:06:3124base::LazyInstance<base::hash_map<uint32_t, LogFunction>>::Leaky
[email protected]4f68ed72012-10-30 05:24:0725 g_log_function_mapping = LAZY_INSTANCE_INITIALIZER;
26
27} // namespace
28
avia9aa7a82015-12-25 03:06:3129void RegisterIPCLogger(uint32_t msg_id, LogFunction logger) {
Lukasz Anforowiczd3e19132017-12-06 19:44:2730 if (!g_log_function_mapping.IsCreated())
[email protected]4f68ed72012-10-30 05:24:0731 IPC::Logging::set_log_function_map(g_log_function_mapping.Pointer());
32 g_log_function_mapping.Get()[msg_id] = logger;
33}
34
35} // content
36
davidsz041528a2017-05-12 09:19:2337#endif // BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)