| 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 | 8 |
| 9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 namespace IPC { | 42 namespace IPC { |
| 43 | 43 |
| 44 //------------------------------------------------------------------------------ | 44 //------------------------------------------------------------------------------ |
| 45 | 45 |
| 46 Message::~Message() { | 46 Message::~Message() { |
| 47 } | 47 } |
| 48 | 48 |
| 49 Message::Message() : base::Pickle(sizeof(Header)) { | 49 Message::Message() : base::Pickle(sizeof(Header)) { |
| 50 header()->routing = header()->type = 0; | 50 header()->routing = header()->type = 0; |
| 51 header()->flags = GetRefNumUpper24(); | 51 header()->flags = GetRefNumUpper24(); |
| 52 #if defined(OS_MACOSX) | 52 #if USE_ATTACHMENT_BROKER |
| 53 header()->num_brokered_attachments = 0; | 53 header()->num_brokered_attachments = 0; |
| 54 #endif | 54 #endif |
| 55 #if defined(OS_POSIX) | 55 #if defined(OS_POSIX) |
| 56 header()->num_fds = 0; | 56 header()->num_fds = 0; |
| 57 header()->pad = 0; | 57 header()->pad = 0; |
| 58 #endif | 58 #endif |
| 59 Init(); | 59 Init(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 Message::Message(int32_t routing_id, uint32_t type, PriorityValue priority) | 62 Message::Message(int32_t routing_id, uint32_t type, PriorityValue priority) |
| 63 : base::Pickle(sizeof(Header)) { | 63 : base::Pickle(sizeof(Header)) { |
| 64 header()->routing = routing_id; | 64 header()->routing = routing_id; |
| 65 header()->type = type; | 65 header()->type = type; |
| 66 DCHECK((priority & 0xffffff00) == 0); | 66 DCHECK((priority & 0xffffff00) == 0); |
| 67 header()->flags = priority | GetRefNumUpper24(); | 67 header()->flags = priority | GetRefNumUpper24(); |
| 68 #if defined(OS_MACOSX) | 68 #if USE_ATTACHMENT_BROKER |
| 69 header()->num_brokered_attachments = 0; | 69 header()->num_brokered_attachments = 0; |
| 70 #endif | 70 #endif |
| 71 #if defined(OS_POSIX) | 71 #if defined(OS_POSIX) |
| 72 header()->num_fds = 0; | 72 header()->num_fds = 0; |
| 73 header()->pad = 0; | 73 header()->pad = 0; |
| 74 #endif | 74 #endif |
| 75 Init(); | 75 Init(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 Message::Message(const char* data, int data_len) | 78 Message::Message(const char* data, int data_len) |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 bool Message::HasMojoHandles() const { | 265 bool Message::HasMojoHandles() const { |
| 266 return attachment_set_.get() && attachment_set_->num_mojo_handles() > 0; | 266 return attachment_set_.get() && attachment_set_->num_mojo_handles() > 0; |
| 267 } | 267 } |
| 268 | 268 |
| 269 bool Message::HasBrokerableAttachments() const { | 269 bool Message::HasBrokerableAttachments() const { |
| 270 return attachment_set_.get() && | 270 return attachment_set_.get() && |
| 271 attachment_set_->num_brokerable_attachments() > 0; | 271 attachment_set_->num_brokerable_attachments() > 0; |
| 272 } | 272 } |
| 273 | 273 |
| 274 } // namespace IPC | 274 } // namespace IPC |
| OLD | NEW |