| 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 "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "ipc/ipc_message_attachment.h" | 10 #include "ipc/ipc_message_attachment.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 Init(); | 66 Init(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 Message::Message(const char* data, int data_len) | 69 Message::Message(const char* data, int data_len) |
| 70 : base::Pickle(data, data_len) { | 70 : base::Pickle(data, data_len) { |
| 71 Init(); | 71 Init(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 Message::Message(const Message& other) : base::Pickle(other) { | 74 Message::Message(const Message& other) : base::Pickle(other) { |
| 75 Init(); | 75 Init(); |
| 76 #if defined(OS_POSIX) | |
| 77 attachment_set_ = other.attachment_set_; | 76 attachment_set_ = other.attachment_set_; |
| 78 #endif | |
| 79 } | 77 } |
| 80 | 78 |
| 81 void Message::Init() { | 79 void Message::Init() { |
| 82 dispatch_error_ = false; | 80 dispatch_error_ = false; |
| 83 #ifdef IPC_MESSAGE_LOG_ENABLED | 81 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 84 received_time_ = 0; | 82 received_time_ = 0; |
| 85 dont_log_ = false; | 83 dont_log_ = false; |
| 86 log_data_ = NULL; | 84 log_data_ = NULL; |
| 87 #endif | 85 #endif |
| 88 } | 86 } |
| 89 | 87 |
| 90 Message& Message::operator=(const Message& other) { | 88 Message& Message::operator=(const Message& other) { |
| 91 *static_cast<base::Pickle*>(this) = other; | 89 *static_cast<base::Pickle*>(this) = other; |
| 92 #if defined(OS_POSIX) | |
| 93 attachment_set_ = other.attachment_set_; | 90 attachment_set_ = other.attachment_set_; |
| 94 #endif | |
| 95 return *this; | 91 return *this; |
| 96 } | 92 } |
| 97 | 93 |
| 98 void Message::SetHeaderValues(int32 routing, uint32 type, uint32 flags) { | 94 void Message::SetHeaderValues(int32 routing, uint32 type, uint32 flags) { |
| 99 // This should only be called when the message is already empty. | 95 // This should only be called when the message is already empty. |
| 100 DCHECK(payload_size() == 0); | 96 DCHECK(payload_size() == 0); |
| 101 | 97 |
| 102 header()->routing = routing; | 98 header()->routing = routing; |
| 103 header()->type = type; | 99 header()->type = type; |
| 104 header()->flags = flags; | 100 header()->flags = flags; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 bool Message::HasMojoHandles() const { | 155 bool Message::HasMojoHandles() const { |
| 160 return attachment_set_.get() && attachment_set_->num_mojo_handles() > 0; | 156 return attachment_set_.get() && attachment_set_->num_mojo_handles() > 0; |
| 161 } | 157 } |
| 162 | 158 |
| 163 bool Message::HasBrokerableAttachments() const { | 159 bool Message::HasBrokerableAttachments() const { |
| 164 return attachment_set_.get() && | 160 return attachment_set_.get() && |
| 165 attachment_set_->num_brokerable_attachments() > 0; | 161 attachment_set_->num_brokerable_attachments() > 0; |
| 166 } | 162 } |
| 167 | 163 |
| 168 } // namespace IPC | 164 } // namespace IPC |
| OLD | NEW |