| 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 #ifndef IPC_IPC_MESSAGE_UTILS_H_ | 5 #ifndef IPC_IPC_MESSAGE_UTILS_H_ |
| 6 #define IPC_IPC_MESSAGE_UTILS_H_ | 6 #define IPC_IPC_MESSAGE_UTILS_H_ |
| 7 | 7 |
| 8 #include <limits.h> | 8 #include <limits.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 // code which handles the message is responsible for taking ownership of it. | 547 // code which handles the message is responsible for taking ownership of it. |
| 548 // File descriptors are OS resources and must be closed when no longer needed. | 548 // File descriptors are OS resources and must be closed when no longer needed. |
| 549 // | 549 // |
| 550 // When sending a file descriptor, the file descriptor must be valid at the time | 550 // When sending a file descriptor, the file descriptor must be valid at the time |
| 551 // of transmission. Since transmission is not synchronous, one should consider | 551 // of transmission. Since transmission is not synchronous, one should consider |
| 552 // dup()ing any file descriptors to be transmitted and setting the |auto_close| | 552 // dup()ing any file descriptors to be transmitted and setting the |auto_close| |
| 553 // flag, which causes the file descriptor to be closed after writing. | 553 // flag, which causes the file descriptor to be closed after writing. |
| 554 template<> | 554 template<> |
| 555 struct IPC_EXPORT ParamTraits<base::FileDescriptor> { | 555 struct IPC_EXPORT ParamTraits<base::FileDescriptor> { |
| 556 typedef base::FileDescriptor param_type; | 556 typedef base::FileDescriptor param_type; |
| 557 static void GetSize(base::PickleSizer* sizer, const param_type& p); |
| 557 static void Write(base::Pickle* m, const param_type& p); | 558 static void Write(base::Pickle* m, const param_type& p); |
| 558 static bool Read(const base::Pickle* m, | 559 static bool Read(const base::Pickle* m, |
| 559 base::PickleIterator* iter, | 560 base::PickleIterator* iter, |
| 560 param_type* r); | 561 param_type* r); |
| 561 static void Log(const param_type& p, std::string* l); | 562 static void Log(const param_type& p, std::string* l); |
| 562 }; | 563 }; |
| 563 #endif // defined(OS_POSIX) | 564 #endif // defined(OS_POSIX) |
| 564 | 565 |
| 565 #if (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN) | 566 #if (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN) |
| 566 template <> | 567 template <> |
| 567 struct IPC_EXPORT ParamTraits<base::SharedMemoryHandle> { | 568 struct IPC_EXPORT ParamTraits<base::SharedMemoryHandle> { |
| 568 typedef base::SharedMemoryHandle param_type; | 569 typedef base::SharedMemoryHandle param_type; |
| 570 static void GetSize(base::PickleSizer* sizer, const param_type& p); |
| 569 static void Write(base::Pickle* m, const param_type& p); | 571 static void Write(base::Pickle* m, const param_type& p); |
| 570 static bool Read(const base::Pickle* m, | 572 static bool Read(const base::Pickle* m, |
| 571 base::PickleIterator* iter, | 573 base::PickleIterator* iter, |
| 572 param_type* r); | 574 param_type* r); |
| 573 static void Log(const param_type& p, std::string* l); | 575 static void Log(const param_type& p, std::string* l); |
| 574 }; | 576 }; |
| 575 #endif // (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN) | 577 #endif // (defined(OS_MACOSX) && !defined(OS_IOS)) || defined(OS_WIN) |
| 576 | 578 |
| 577 template <> | 579 template <> |
| 578 struct IPC_EXPORT ParamTraits<base::FilePath> { | 580 struct IPC_EXPORT ParamTraits<base::FilePath> { |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 template <class ReplyParamType> | 1101 template <class ReplyParamType> |
| 1100 inline void LogReplyParamsToMessage(const ReplyParamType& reply_params, | 1102 inline void LogReplyParamsToMessage(const ReplyParamType& reply_params, |
| 1101 const Message* msg) {} | 1103 const Message* msg) {} |
| 1102 | 1104 |
| 1103 inline void ConnectMessageAndReply(const Message* msg, Message* reply) {} | 1105 inline void ConnectMessageAndReply(const Message* msg, Message* reply) {} |
| 1104 #endif | 1106 #endif |
| 1105 | 1107 |
| 1106 } // namespace IPC | 1108 } // namespace IPC |
| 1107 | 1109 |
| 1108 #endif // IPC_IPC_MESSAGE_UTILS_H_ | 1110 #endif // IPC_IPC_MESSAGE_UTILS_H_ |
| OLD | NEW |