OLD | NEW |
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_message.h" | 5 #include "ipc/ipc_message.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 | 72 |
73 Message::Message(const char* data, int data_len) | 73 Message::Message(const char* data, int data_len) |
74 : base::Pickle(data, data_len) { | 74 : base::Pickle(data, data_len) { |
75 Init(); | 75 Init(); |
76 } | 76 } |
77 | 77 |
78 Message::Message(const Message& other) : base::Pickle(other) { | 78 Message::Message(const Message& other) : base::Pickle(other) { |
79 Init(); | 79 Init(); |
80 attachment_set_ = other.attachment_set_; | 80 attachment_set_ = other.attachment_set_; |
81 sender_pid_ = other.sender_pid_; | |
82 } | 81 } |
83 | 82 |
84 void Message::Init() { | 83 void Message::Init() { |
85 dispatch_error_ = false; | 84 dispatch_error_ = false; |
86 sender_pid_ = base::kNullProcessId; | |
87 #ifdef IPC_MESSAGE_LOG_ENABLED | 85 #ifdef IPC_MESSAGE_LOG_ENABLED |
88 received_time_ = 0; | 86 received_time_ = 0; |
89 dont_log_ = false; | 87 dont_log_ = false; |
90 log_data_ = NULL; | 88 log_data_ = NULL; |
91 #endif | 89 #endif |
92 } | 90 } |
93 | 91 |
94 Message& Message::operator=(const Message& other) { | 92 Message& Message::operator=(const Message& other) { |
95 *static_cast<base::Pickle*>(this) = other; | 93 *static_cast<base::Pickle*>(this) = other; |
96 attachment_set_ = other.attachment_set_; | 94 attachment_set_ = other.attachment_set_; |
97 sender_pid_ = other.sender_pid_; | |
98 return *this; | 95 return *this; |
99 } | 96 } |
100 | 97 |
101 void Message::SetHeaderValues(int32_t routing, uint32_t type, uint32_t flags) { | 98 void Message::SetHeaderValues(int32_t routing, uint32_t type, uint32_t flags) { |
102 // This should only be called when the message is already empty. | 99 // This should only be called when the message is already empty. |
103 DCHECK(payload_size() == 0); | 100 DCHECK(payload_size() == 0); |
104 | 101 |
105 header()->routing = routing; | 102 header()->routing = routing; |
106 header()->type = type; | 103 header()->type = type; |
107 header()->flags = flags; | 104 header()->flags = flags; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 bool Message::HasMojoHandles() const { | 215 bool Message::HasMojoHandles() const { |
219 return attachment_set_.get() && attachment_set_->num_mojo_handles() > 0; | 216 return attachment_set_.get() && attachment_set_->num_mojo_handles() > 0; |
220 } | 217 } |
221 | 218 |
222 bool Message::HasBrokerableAttachments() const { | 219 bool Message::HasBrokerableAttachments() const { |
223 return attachment_set_.get() && | 220 return attachment_set_.get() && |
224 attachment_set_->num_brokerable_attachments() > 0; | 221 attachment_set_->num_brokerable_attachments() > 0; |
225 } | 222 } |
226 | 223 |
227 } // namespace IPC | 224 } // namespace IPC |
OLD | NEW |