Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: ppapi/proxy/serialized_handle.h

Issue 2849633002: Get rid of base::SharedMemory::NULLHandle(); (Closed)
Patch Set: Rebase. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ppapi/proxy/proxy_channel.cc ('k') | ppapi/proxy/serialized_handle.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « ppapi/proxy/proxy_channel.cc ('k') | ppapi/proxy/serialized_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698