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

Side by Side Diff: ipc/ipc_channel_reader.cc

Issue 2847003005: Reland "Add enable_ipc_logging build argument" (Closed)
Patch Set: Reland "Add enable_ipc_logging build argument" Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « ipc/ipc_channel_proxy.cc ('k') | ipc/ipc_logging.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // 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 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 #include "ipc/ipc_channel_reader.h" 5 #include "ipc/ipc_channel_reader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "ipc/ipc_listener.h" 14 #include "ipc/ipc_listener.h"
15 #include "ipc/ipc_logging.h" 15 #include "ipc/ipc_logging.h"
16 #include "ipc/ipc_message.h" 16 #include "ipc/ipc_message.h"
17 #include "ipc/ipc_message_attachment_set.h" 17 #include "ipc/ipc_message_attachment_set.h"
18 #include "ipc/ipc_message_macros.h" 18 #include "ipc/ipc_message_macros.h"
19 19
20 namespace IPC { 20 namespace IPC {
21 namespace internal { 21 namespace internal {
22 22
23 #ifdef IPC_MESSAGE_LOG_ENABLED 23 #if BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
24 24
25 namespace { 25 namespace {
26 std::string GetMessageText(const Message& message) { 26 std::string GetMessageText(const Message& message) {
27 std::string name; 27 std::string name;
28 Logging::GetInstance()->GetMessageText( 28 Logging::GetInstance()->GetMessageText(
29 message.type(), &name, &message, nullptr); 29 message.type(), &name, &message, nullptr);
30 return name; 30 return name;
31 } 31 }
32 } // namespace 32 } // namespace
33 33
34 #define EMIT_TRACE_EVENT(message) \ 34 #define EMIT_TRACE_EVENT(message) \
35 TRACE_EVENT_WITH_FLOW1( \ 35 TRACE_EVENT_WITH_FLOW1( \
36 "ipc,toplevel", "ChannelReader::DispatchInputData", \ 36 "ipc,toplevel", "ChannelReader::DispatchInputData", \
37 (message).flags(), TRACE_EVENT_FLAG_FLOW_IN, "name", \ 37 (message).flags(), TRACE_EVENT_FLAG_FLOW_IN, "name", \
38 GetMessageText(message)); 38 GetMessageText(message));
39 #else 39 #else
40 #define EMIT_TRACE_EVENT(message) \ 40 #define EMIT_TRACE_EVENT(message) \
41 TRACE_EVENT_WITH_FLOW2("ipc,toplevel", "ChannelReader::DispatchInputData", \ 41 TRACE_EVENT_WITH_FLOW2("ipc,toplevel", "ChannelReader::DispatchInputData", \
42 (message).flags(), TRACE_EVENT_FLAG_FLOW_IN, "class", \ 42 (message).flags(), TRACE_EVENT_FLAG_FLOW_IN, "class", \
43 IPC_MESSAGE_ID_CLASS((message).type()), "line", \ 43 IPC_MESSAGE_ID_CLASS((message).type()), "line", \
44 IPC_MESSAGE_ID_LINE((message).type())); 44 IPC_MESSAGE_ID_LINE((message).type()));
45 #endif // IPC_MESSAGE_LOG_ENABLED 45 #endif // BUILDFLAG(IPC_MESSAGE_LOG_ENABLED)
46 46
47 ChannelReader::ChannelReader(Listener* listener) 47 ChannelReader::ChannelReader(Listener* listener)
48 : listener_(listener), 48 : listener_(listener),
49 max_input_buffer_size_(Channel::kMaximumReadBufferSize) { 49 max_input_buffer_size_(Channel::kMaximumReadBufferSize) {
50 memset(input_buf_, 0, sizeof(input_buf_)); 50 memset(input_buf_, 0, sizeof(input_buf_));
51 } 51 }
52 52
53 ChannelReader::~ChannelReader() { 53 ChannelReader::~ChannelReader() {
54 } 54 }
55 55
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 if (size <= Channel::kMaximumMessageSize) { 208 if (size <= Channel::kMaximumMessageSize) {
209 return true; 209 return true;
210 } 210 }
211 input_overflow_buf_.clear(); 211 input_overflow_buf_.clear();
212 LOG(ERROR) << "IPC message is too big: " << size; 212 LOG(ERROR) << "IPC message is too big: " << size;
213 return false; 213 return false;
214 } 214 }
215 215
216 } // namespace internal 216 } // namespace internal
217 } // namespace IPC 217 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/ipc_channel_proxy.cc ('k') | ipc/ipc_logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698