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

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

Issue 11312017: Avoid leaking SerializedHandles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 PPAPI_PROXY_SERIALIZED_STRUCTS_H_ 5 #ifndef PPAPI_PROXY_SERIALIZED_STRUCTS_H_
6 #define PPAPI_PROXY_SERIALIZED_STRUCTS_H_ 6 #define PPAPI_PROXY_SERIALIZED_STRUCTS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 157 }
158 void set_null_channel_handle() { 158 void set_null_channel_handle() {
159 set_channel_handle(IPC::InvalidPlatformFileForTransit()); 159 set_channel_handle(IPC::InvalidPlatformFileForTransit());
160 } 160 }
161 bool IsHandleValid() const; 161 bool IsHandleValid() const;
162 162
163 Header header() const { 163 Header header() const {
164 return Header(type_, size_); 164 return Header(type_, size_);
165 } 165 }
166 166
167 // Closes the handle and sets it to invalid.
168 void Close();
169
167 // Write/Read a Header, which contains all the data except the handle. This 170 // Write/Read a Header, which contains all the data except the handle. This
168 // allows us to write the handle in a platform-specific way, as is necessary 171 // allows us to write the handle in a platform-specific way, as is necessary
169 // in NaClIPCAdapter to share handles with NaCl from Windows. 172 // in NaClIPCAdapter to share handles with NaCl from Windows.
170 static bool WriteHeader(const Header& hdr, Pickle* pickle); 173 static bool WriteHeader(const Header& hdr, Pickle* pickle);
171 static bool ReadHeader(PickleIterator* iter, Header* hdr); 174 static bool ReadHeader(PickleIterator* iter, Header* hdr);
172 175
173 private: 176 private:
174 // The kind of handle we're holding. 177 // The kind of handle we're holding.
175 Type type_; 178 Type type_;
176 179
(...skipping 23 matching lines...) Expand all
200 typedef base::SharedMemoryHandle ImageHandle; 203 typedef base::SharedMemoryHandle ImageHandle;
201 #else 204 #else
202 // On X Windows this is a SysV shared memory key. 205 // On X Windows this is a SysV shared memory key.
203 typedef int ImageHandle; 206 typedef int ImageHandle;
204 #endif 207 #endif
205 208
206 } // namespace proxy 209 } // namespace proxy
207 } // namespace ppapi 210 } // namespace ppapi
208 211
209 #endif // PPAPI_PROXY_SERIALIZED_STRUCTS_H_ 212 #endif // PPAPI_PROXY_SERIALIZED_STRUCTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698