0

Revert of Reland "Add enable_ipc_logging build argument" (patchset id:1 of https://codereview.chromium.org/2777983005/ )

Reason for revert:
This still appears to be causing a build flake on https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng

log: https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Ftryserver.chromium.linux%2Flinux_chromium_rel_ng%2F418400%2F%2B%2Frecipes%2Fsteps%2Fcompile__without_patch_%2F0%2Fstdout

Original issue's description:
> Reland "Add enable_ipc_logging build argument (patchset  id:20001 of https://codereview.chromium.org/2770653002/ )"
>
> It introduced a build flake due to assorted missing dependencies
> on //ipc and it was reverted in https://codereview.chromium.org/2768403002.
> The public dependencies on //ipc are fixed in https://codereview.chromium.org/2767193005.
>
> Original issue's description:
> > Add enable_ipc_logging build argument
> >
> > Implement a build option to enable the IPC logging system
> > in release builds. It's useful to save time and resources when
> > debugging IPC communication (e.g. in automated testing
> > environments).
> >
> > It also turns IPC_MESSAGE_LOG_ENABLED macro to a build flag.
> >
> > BUG=
> >
> > Review-Url: https://codereview.chromium.org/2770653002
> > Cr-Commit-Position: refs/heads/master@{#459094}
> > Committed: 76890ec11e
>
> BUG=
>
> Review-Url: https://codereview.chromium.org/2777983005
> Cr-Commit-Position: refs/heads/master@{#460152}
> Committed: b39d83360c

TBR=rockot@chromium.org,jam@chromium.org,kenrb@chromium.org,davidsz@inf.u-szeged.hu
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=

Review-Url: https://codereview.chromium.org/2776393003
Cr-Commit-Position: refs/heads/master@{#460218}
This commit is contained in:
jwd
2017-03-28 14:12:31 -07:00
committed by Commit bot
parent 13390fea41
commit c1028928ea
24 changed files with 65 additions and 69 deletions

@ -701,7 +701,6 @@ Suvanjan Mukherjee <suvanjanmukherjee@gmail.com>
Swati Jaiswal <swa.jaiswal@samsung.com>
Sylvain Zimmer <sylvinus@gmail.com>
Sylvestre Ledru <sylvestre.ledru@gmail.com>
Szabolcs David <davidsz@inf.u-szeged.hu>
Szymon Piechowicz <szymonpiechowicz@o2.pl>
Taehoon Lee <taylor.hoon@gmail.com>
Takeshi Kurosawa <taken.spc@gmail.com>

@ -8,13 +8,13 @@
// IPC_MESSAGE_LOG_ENABLED. We need to use it to define
// IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the
// ViewMsgLog et al. functions.
#include "ipc/ipc_features.h"
#include "ipc/ipc_message.h"
// On Windows, the about:ipc dialog shows IPCs; on POSIX, we hook up a
// logger in this file. (We implement about:ipc on Mac but implement
// the loggers here anyway). We need to do this real early to be sure
// IPC_MESSAGE_MACROS_LOG_ENABLED doesn't get undefined.
#if defined(OS_POSIX) && BUILDFLAG(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) \

@ -22,7 +22,7 @@ ServiceIPCServer::ServiceIPCServer(
}
bool ServiceIPCServer::Init() {
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
IPC::Logging::GetInstance()->SetIPCSender(this);
#endif
CreateChannel();
@ -39,7 +39,7 @@ void ServiceIPCServer::CreateChannel() {
}
ServiceIPCServer::~ServiceIPCServer() {
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
IPC::Logging::GetInstance()->SetIPCSender(NULL);
#endif
}

@ -13,7 +13,7 @@
namespace content {
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#if defined(IPC_MESSAGE_LOG_ENABLED)
void EnableIPCLoggingForChildProcesses(bool enabled) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
@ -46,6 +46,6 @@ void EnableIPCLogging(bool enable) {
i.GetCurrentValue()->Send(new ChildProcessMsg_SetIPCLoggingEnabled(enable));
}
#endif // BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#endif // IPC_MESSAGE_LOG_ENABLED
} // namespace content

@ -2104,7 +2104,7 @@ void RenderProcessHostImpl::OnChannelConnected(int32_t peer_pid) {
observer.RenderProcessReady(this);
}
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#if defined(IPC_MESSAGE_LOG_ENABLED)
Send(new ChildProcessMsg_SetIPCLoggingEnabled(
IPC::Logging::GetInstance()->Enabled()));
#endif

@ -414,7 +414,7 @@ void ChildThreadImpl::Init(const Options& options) {
g_lazy_tls.Pointer()->Set(this);
on_channel_error_called_ = false;
message_loop_ = base::MessageLoop::current();
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
// We must make sure to instantiate the IPC Logger *before* we create the
// channel, otherwise we can get a callback on the IO thread which creates
// the logger, and the logger does not like being created on the IO thread.
@ -424,7 +424,7 @@ void ChildThreadImpl::Init(const Options& options) {
channel_ =
IPC::SyncChannel::Create(this, ChildProcess::current()->io_task_runner(),
ChildProcess::current()->GetShutDownEvent());
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
if (!IsInBrowserProcess())
IPC::Logging::GetInstance()->SetIPCSender(this);
#endif
@ -570,7 +570,7 @@ void ChildThreadImpl::Init(const Options& options) {
}
ChildThreadImpl::~ChildThreadImpl() {
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
IPC::Logging::GetInstance()->SetIPCSender(NULL);
#endif
@ -720,7 +720,7 @@ bool ChildThreadImpl::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ChildThreadImpl, msg)
IPC_MESSAGE_HANDLER(ChildProcessMsg_Shutdown, OnShutdown)
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#if defined(IPC_MESSAGE_LOG_ENABLED)
IPC_MESSAGE_HANDLER(ChildProcessMsg_SetIPCLoggingEnabled,
OnSetIPCLoggingEnabled)
#endif
@ -791,7 +791,7 @@ void ChildThreadImpl::OnShutdown() {
base::MessageLoop::current()->QuitWhenIdle();
}
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#if defined(IPC_MESSAGE_LOG_ENABLED)
void ChildThreadImpl::OnSetIPCLoggingEnabled(bool enable) {
if (enable)
IPC::Logging::GetInstance()->Enable();

@ -22,7 +22,7 @@
#include "content/common/content_export.h"
#include "content/public/child/child_thread.h"
#include "ipc/ipc.mojom.h"
#include "ipc/ipc_features.h" // For BUILDFLAG(IPC_MESSAGE_LOG_ENABLED).
#include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
#include "ipc/ipc_platform_file.h"
#include "ipc/message_router.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
@ -228,7 +228,7 @@ class CONTENT_EXPORT ChildThreadImpl
void OnSetProfilerStatus(tracked_objects::ThreadData::Status status);
void OnGetChildProfilerData(int sequence_number, int current_profiling_phase);
void OnProfilingPhaseCompleted(int profiling_phase);
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
void OnSetIPCLoggingEnabled(bool enable);
#endif

@ -158,7 +158,7 @@ bool ChildProcessHostImpl::InitChannel() {
delegate_->OnChannelInitialized(channel_.get());
// Make sure these messages get sent first.
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#if defined(IPC_MESSAGE_LOG_ENABLED)
bool enabled = IPC::Logging::GetInstance()->Enabled();
Send(new ChildProcessMsg_SetIPCLoggingEnabled(enabled));
#endif
@ -214,7 +214,7 @@ uint64_t ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId(
}
bool ChildProcessHostImpl::OnMessageReceived(const IPC::Message& msg) {
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
IPC::Logging* logger = IPC::Logging::GetInstance();
if (msg.type() == IPC_LOGGING_ID) {
logger->OnReceivedLoggingMessage(msg);
@ -245,7 +245,7 @@ bool ChildProcessHostImpl::OnMessageReceived(const IPC::Message& msg) {
handled = delegate_->OnMessageReceived(msg);
}
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
if (logger->Enabled())
logger->OnPostDispatchMessage(msg);
#endif

@ -20,7 +20,6 @@
#include "gpu/command_buffer/common/sync_token.h"
#include "gpu/ipc/common/gpu_param_traits_macros.h"
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_features.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_platform_file.h"
#include "ui/gfx/gpu_memory_buffer.h"
@ -92,7 +91,7 @@ IPC_ENUM_TRAITS_MAX_VALUE(base::ThreadPriority,
// process that it's safe to shutdown.
IPC_MESSAGE_CONTROL0(ChildProcessMsg_Shutdown)
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#if defined(IPC_MESSAGE_LOG_ENABLED)
// Tell the child process to begin or end IPC message logging.
IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetIPCLoggingEnabled,
bool /* on or off */)

@ -2,17 +2,19 @@
// 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.
#include <stdint.h>
#include "ipc/ipc_features.h"
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#if 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/containers/hash_tables.h"
#include "base/lazy_instance.h"
@ -34,4 +36,4 @@ void RegisterIPCLogger(uint32_t msg_id, LogFunction logger) {
} // content
#endif // BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#endif

@ -6,11 +6,11 @@
#define CONTENT_PUBLIC_BROWSER_BROWSER_IPC_LOGGING_H_
#include "content/common/content_export.h"
#include "ipc/ipc_features.h"
#include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
namespace content {
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#if defined(IPC_MESSAGE_LOG_ENABLED)
// Enable or disable IPC logging for the browser, all processes
// derived from ChildProcess (plugin etc), and all

@ -5,6 +5,8 @@
#ifndef CONTENT_PUBLIC_COMMON_CONTENT_IPC_LOGGING_H_
#define CONTENT_PUBLIC_COMMON_CONTENT_IPC_LOGGING_H_
#include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
#include <stdint.h>
#include "content/common/content_export.h"
@ -12,7 +14,7 @@
namespace content {
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#if defined(IPC_MESSAGE_LOG_ENABLED)
// Register a logger for the given IPC message. Use
//

@ -12,7 +12,6 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/trace_event/trace_log.h"
#include "build/build_config.h"
#include "cc/base/switches.h"
#include "content/common/content_constants_internal.h"
@ -35,7 +34,6 @@
#include "content/shell/renderer/shell_content_renderer_client.h"
#include "content/shell/utility/shell_content_utility_client.h"
#include "gpu/config/gpu_switches.h"
#include "ipc/ipc_features.h"
#include "media/base/media_switches.h"
#include "media/base/mime_util.h"
#include "net/cookies/cookie_monster.h"
@ -47,7 +45,9 @@
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_switches.h"
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
#if 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) \

@ -2,23 +2,11 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/buildflag_header.gni")
import("//build/config/nacl/config.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//testing/test.gni")
import("//tools/ipc_fuzzer/ipc_fuzzer.gni")
declare_args() {
# Enabling debug builds automatically sets enable_ipc_logging to true.
enable_ipc_logging = is_debug
}
buildflag_header("ipc_features") {
header = "ipc_features.h"
flags = [ "IPC_MESSAGE_LOG_ENABLED=$enable_ipc_logging" ]
}
component("ipc") {
sources = [
"export_template.h",
@ -108,7 +96,6 @@ component("ipc") {
defines = [ "IPC_IMPLEMENTATION" ]
public_deps = [
":ipc_features",
":mojom",
":param_traits",
"//mojo/public/cpp/bindings",

@ -199,9 +199,9 @@ bool ChannelNacl::Send(Message* message) {
<< " with type " << message->type();
std::unique_ptr<Message> message_ptr(message);
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
Logging::GetInstance()->OnSendMessage(message_ptr.get());
#endif // BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#endif // IPC_MESSAGE_LOG_ENABLED
TRACE_EVENT_WITH_FLOW0(TRACE_DISABLED_BY_DEFAULT("ipc.flow"),
"ChannelNacl::Send",

@ -78,7 +78,7 @@ void ChannelProxy::Context::CreateChannel(
bool ChannelProxy::Context::TryFilters(const Message& message) {
DCHECK(message_filter_router_);
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
Logging* logger = Logging::GetInstance();
if (logger->Enabled())
logger->OnPreDispatchMessage(message);
@ -89,7 +89,7 @@ bool ChannelProxy::Context::TryFilters(const Message& message) {
listener_task_runner_->PostTask(
FROM_HERE, base::Bind(&Context::OnDispatchBadMessage, this, message));
}
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
if (logger->Enabled())
logger->OnPostDispatchMessage(message);
#endif
@ -315,7 +315,7 @@ void ChannelProxy::Context::OnDispatchMessage(const Message& message) {
OnDispatchConnected();
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
Logging* logger = Logging::GetInstance();
if (message.type() == IPC_LOGGING_ID) {
logger->OnReceivedLoggingMessage(message);
@ -330,7 +330,7 @@ void ChannelProxy::Context::OnDispatchMessage(const Message& message) {
if (message.dispatch_error())
listener_->OnBadMessageReceived(message);
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
if (logger->Enabled())
logger->OnPostDispatchMessage(message);
#endif
@ -530,7 +530,7 @@ bool ChannelProxy::Send(Message* message) {
message = outgoing_message_filter()->Rewrite(message);
#endif
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
Logging::GetInstance()->OnSendMessage(message);
#endif

@ -20,7 +20,7 @@
namespace IPC {
namespace internal {
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
namespace {
std::string GetMessageText(const Message& message) {
@ -42,7 +42,7 @@ std::string GetMessageText(const Message& message) {
(message).flags(), TRACE_EVENT_FLAG_FLOW_IN, "class", \
IPC_MESSAGE_ID_CLASS((message).type()), "line", \
IPC_MESSAGE_ID_LINE((message).type()));
#endif // BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#endif // IPC_MESSAGE_LOG_ENABLED
ChannelReader::ChannelReader(Listener* listener)
: listener_(listener),

@ -4,7 +4,7 @@
#include "ipc/ipc_logging.h"
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
#define IPC_MESSAGE_MACROS_LOG_ENABLED
#endif
@ -31,7 +31,7 @@
#include <unistd.h>
#endif
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
using base::Time;
@ -310,4 +310,4 @@ void GenerateLogData(const Message& message, LogData* data, bool get_params) {
}
#endif // BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#endif // IPC_MESSAGE_LOG_ENABLED

@ -5,11 +5,12 @@
#ifndef IPC_IPC_LOGGING_H_
#define IPC_IPC_LOGGING_H_
#include "ipc/ipc_features.h"
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#include <stdint.h>
#include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED.
#ifdef IPC_MESSAGE_LOG_ENABLED
#include <vector>
#include "base/containers/hash_tables.h"
@ -17,7 +18,6 @@
#include "base/memory/singleton.h"
#include "base/single_thread_task_runner.h"
#include "ipc/ipc_export.h"
#include "ipc/ipc_message.h"
// Logging function. |name| is a string in ASCII and |params| is a string in
// UTF-8.
@ -123,6 +123,6 @@ class IPC_EXPORT Logging {
} // namespace IPC
#endif // BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#endif // IPC_MESSAGE_LOG_ENABLED
#endif // IPC_IPC_LOGGING_H_

@ -82,7 +82,7 @@ Message::Message(const Message& other) : base::Pickle(other) {
void Message::Init() {
dispatch_error_ = false;
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
received_time_ = 0;
dont_log_ = false;
log_data_ = NULL;
@ -109,7 +109,7 @@ void Message::EnsureMessageAttachmentSet() {
attachment_set_ = new MessageAttachmentSet;
}
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
void Message::set_sent_time(int64_t time) {
DCHECK((header()->flags & HAS_SENT_TIME_BIT) == 0);
header()->flags |= HAS_SENT_TIME_BIT;
@ -128,7 +128,7 @@ int64_t Message::sent_time() const {
void Message::set_received_time(int64_t time) const {
received_time_ = time;
}
#endif // BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#endif
Message::NextMessageInfo::NextMessageInfo()
: message_size(0), message_found(false), pickle_end(nullptr),

@ -16,7 +16,10 @@
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "ipc/ipc_export.h"
#include "ipc/ipc_features.h"
#if !defined(NDEBUG)
#define IPC_MESSAGE_LOG_ENABLED
#endif
namespace IPC {
@ -204,7 +207,7 @@ class IPC_EXPORT Message : public base::Pickle {
// Returns true if there are any attachment in this message.
bool HasAttachments() const override;
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
// Adds the outgoing time from Time::Now() at the end of the message and sets
// a bit to indicate that it's been added.
void set_sent_time(int64_t time);
@ -272,7 +275,7 @@ class IPC_EXPORT Message : public base::Pickle {
return attachment_set_.get();
}
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
// Used for logging.
mutable int64_t received_time_;
mutable std::string output_params_;

@ -1100,7 +1100,7 @@ IPC_EXPORT void GenerateLogData(const Message& message,
LogData* data,
bool get_params);
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#if defined(IPC_MESSAGE_LOG_ENABLED)
inline void AddOutputParamsToLog(const Message* msg, std::string* l) {
const std::string& output_params = msg->output_params();
if (!l->empty() && !output_params.empty())

@ -578,7 +578,7 @@ scoped_refptr<SyncMessageFilter> SyncChannel::CreateSyncMessageFilter() {
}
bool SyncChannel::Send(Message* message) {
#if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
#ifdef IPC_MESSAGE_LOG_ENABLED
std::string name;
Logging::GetInstance()->GetMessageText(
message->type(), &name, message, nullptr);

@ -3,6 +3,10 @@
// found in the LICENSE file.
#include "build/build_config.h"
// Need to include this before most other files because it defines
// IPC_MESSAGE_LOG_ENABLED. We need to use it to define
// IPC_MESSAGE_MACROS_LOG_ENABLED so ppapi_messages.h will generate the
// ViewMsgLog et al. functions.
#include <stdint.h>