| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef MOJO_PUBLIC_CPP_SYSTEM_CORE_H_ | 5 #ifndef MOJO_PUBLIC_CPP_SYSTEM_CORE_H_ |
| 6 #define MOJO_PUBLIC_CPP_SYSTEM_CORE_H_ | 6 #define MOJO_PUBLIC_CPP_SYSTEM_CORE_H_ |
| 7 | 7 |
| 8 #include <assert.h> | 8 #include <assert.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 MOJO_COMPILE_ASSERT(sizeof(ScopedMessagePipeHandle) == | 263 MOJO_COMPILE_ASSERT(sizeof(ScopedMessagePipeHandle) == |
| 264 sizeof(MessagePipeHandle), | 264 sizeof(MessagePipeHandle), |
| 265 bad_size_for_cpp_ScopedMessagePipeHandle); | 265 bad_size_for_cpp_ScopedMessagePipeHandle); |
| 266 | 266 |
| 267 inline MojoResult CreateMessagePipe(ScopedMessagePipeHandle* message_pipe0, | 267 inline MojoResult CreateMessagePipe(ScopedMessagePipeHandle* message_pipe0, |
| 268 ScopedMessagePipeHandle* message_pipe1) { | 268 ScopedMessagePipeHandle* message_pipe1) { |
| 269 assert(message_pipe0); | 269 assert(message_pipe0); |
| 270 assert(message_pipe1); | 270 assert(message_pipe1); |
| 271 MessagePipeHandle handle0; | 271 MessagePipeHandle handle0; |
| 272 MessagePipeHandle handle1; | 272 MessagePipeHandle handle1; |
| 273 MojoResult rv = MojoCreateMessagePipe(handle0.mutable_value(), | 273 // TODO(vtl): Add support for the options struct. |
| 274 MojoResult rv = MojoCreateMessagePipe(NULL, |
| 275 handle0.mutable_value(), |
| 274 handle1.mutable_value()); | 276 handle1.mutable_value()); |
| 275 // Reset even on failure (reduces the chances that a "stale"/incorrect handle | 277 // Reset even on failure (reduces the chances that a "stale"/incorrect handle |
| 276 // will be used). | 278 // will be used). |
| 277 message_pipe0->reset(handle0); | 279 message_pipe0->reset(handle0); |
| 278 message_pipe1->reset(handle1); | 280 message_pipe1->reset(handle1); |
| 279 return rv; | 281 return rv; |
| 280 } | 282 } |
| 281 | 283 |
| 282 // These "raw" versions fully expose the underlying API, but don't help with | 284 // These "raw" versions fully expose the underlying API, but don't help with |
| 283 // ownership of handles (especially when writing messages). | 285 // ownership of handles (especially when writing messages). |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 CreateSharedBuffer(&options, num_bytes, &handle); | 534 CreateSharedBuffer(&options, num_bytes, &handle); |
| 533 assert(result == MOJO_RESULT_OK); | 535 assert(result == MOJO_RESULT_OK); |
| 534 } | 536 } |
| 535 | 537 |
| 536 inline SharedBuffer::~SharedBuffer() { | 538 inline SharedBuffer::~SharedBuffer() { |
| 537 } | 539 } |
| 538 | 540 |
| 539 } // namespace mojo | 541 } // namespace mojo |
| 540 | 542 |
| 541 #endif // MOJO_PUBLIC_CPP_SYSTEM_CORE_H_ | 543 #endif // MOJO_PUBLIC_CPP_SYSTEM_CORE_H_ |
| OLD | NEW |