| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 PPAPI_PROXY_SERIALIZED_HANDLES_H_ | 5 #ifndef PPAPI_PROXY_SERIALIZED_HANDLES_H_ |
| 6 #define PPAPI_PROXY_SERIALIZED_HANDLES_H_ | 6 #define PPAPI_PROXY_SERIALIZED_HANDLES_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 type_ = SHARED_MEMORY; | 87 type_ = SHARED_MEMORY; |
| 88 shm_handle_ = handle; | 88 shm_handle_ = handle; |
| 89 size_ = size; | 89 size_ = size; |
| 90 | 90 |
| 91 descriptor_ = IPC::InvalidPlatformFileForTransit(); | 91 descriptor_ = IPC::InvalidPlatformFileForTransit(); |
| 92 } | 92 } |
| 93 void set_socket(const IPC::PlatformFileForTransit& socket) { | 93 void set_socket(const IPC::PlatformFileForTransit& socket) { |
| 94 type_ = SOCKET; | 94 type_ = SOCKET; |
| 95 descriptor_ = socket; | 95 descriptor_ = socket; |
| 96 | 96 |
| 97 shm_handle_ = base::SharedMemory::NULLHandle(); | 97 shm_handle_ = base::SharedMemoryHandle(); |
| 98 size_ = 0; | 98 size_ = 0; |
| 99 } | 99 } |
| 100 void set_file_handle(const IPC::PlatformFileForTransit& descriptor, | 100 void set_file_handle(const IPC::PlatformFileForTransit& descriptor, |
| 101 int32_t open_flags, | 101 int32_t open_flags, |
| 102 PP_Resource file_io) { | 102 PP_Resource file_io) { |
| 103 type_ = FILE; | 103 type_ = FILE; |
| 104 | 104 |
| 105 descriptor_ = descriptor; | 105 descriptor_ = descriptor; |
| 106 shm_handle_ = base::SharedMemory::NULLHandle(); | 106 shm_handle_ = base::SharedMemoryHandle(); |
| 107 size_ = 0; | 107 size_ = 0; |
| 108 open_flags_ = open_flags; | 108 open_flags_ = open_flags; |
| 109 file_io_ = file_io; | 109 file_io_ = file_io; |
| 110 } | 110 } |
| 111 void set_null_shmem() { | 111 void set_null_shmem() { set_shmem(base::SharedMemoryHandle(), 0); } |
| 112 set_shmem(base::SharedMemory::NULLHandle(), 0); | |
| 113 } | |
| 114 void set_null_socket() { | 112 void set_null_socket() { |
| 115 set_socket(IPC::InvalidPlatformFileForTransit()); | 113 set_socket(IPC::InvalidPlatformFileForTransit()); |
| 116 } | 114 } |
| 117 void set_null_file_handle() { | 115 void set_null_file_handle() { |
| 118 set_file_handle(IPC::InvalidPlatformFileForTransit(), 0, 0); | 116 set_file_handle(IPC::InvalidPlatformFileForTransit(), 0, 0); |
| 119 } | 117 } |
| 120 bool IsHandleValid() const; | 118 bool IsHandleValid() const; |
| 121 | 119 |
| 122 Header header() const { | 120 Header header() const { |
| 123 return Header(type_, size_, open_flags_, file_io_); | 121 return Header(type_, size_, open_flags_, file_io_); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 150 // The following fields are valid if type == FILE. | 148 // The following fields are valid if type == FILE. |
| 151 int32_t open_flags_; | 149 int32_t open_flags_; |
| 152 // This is non-zero if file writes require quota checking. | 150 // This is non-zero if file writes require quota checking. |
| 153 PP_Resource file_io_; | 151 PP_Resource file_io_; |
| 154 }; | 152 }; |
| 155 | 153 |
| 156 } // namespace proxy | 154 } // namespace proxy |
| 157 } // namespace ppapi | 155 } // namespace ppapi |
| 158 | 156 |
| 159 #endif // PPAPI_PROXY_SERIALIZED_HANDLES_H_ | 157 #endif // PPAPI_PROXY_SERIALIZED_HANDLES_H_ |
| OLD | NEW |