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

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

Issue 1149113006: Move Pickle to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/serialized_flash_menu.h ('k') | ppapi/proxy/serialized_structs.h » ('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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/atomicops.h" 11 #include "base/atomicops.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/shared_memory.h" 15 #include "base/memory/shared_memory.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "ipc/ipc_platform_file.h" 17 #include "ipc/ipc_platform_file.h"
18 #include "ppapi/c/pp_resource.h" 18 #include "ppapi/c/pp_resource.h"
19 #include "ppapi/proxy/ppapi_proxy_export.h" 19 #include "ppapi/proxy/ppapi_proxy_export.h"
20 20
21 namespace base {
21 class Pickle; 22 class Pickle;
23 }
22 24
23 namespace ppapi { 25 namespace ppapi {
24 namespace proxy { 26 namespace proxy {
25 27
26 // SerializedHandle is a unified structure for holding a handle (e.g., a shared 28 // SerializedHandle is a unified structure for holding a handle (e.g., a shared
27 // memory handle, socket descriptor, etc). This is useful for passing handles in 29 // memory handle, socket descriptor, etc). This is useful for passing handles in
28 // resource messages and also makes it easier to translate handles in 30 // resource messages and also makes it easier to translate handles in
29 // NaClIPCAdapter for use in NaCl. 31 // NaClIPCAdapter for use in NaCl.
30 class PPAPI_PROXY_EXPORT SerializedHandle { 32 class PPAPI_PROXY_EXPORT SerializedHandle {
31 public: 33 public:
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 Header header() const { 124 Header header() const {
123 return Header(type_, size_, open_flags_, file_io_); 125 return Header(type_, size_, open_flags_, file_io_);
124 } 126 }
125 127
126 // Closes the handle and sets it to invalid. 128 // Closes the handle and sets it to invalid.
127 void Close(); 129 void Close();
128 130
129 // Write/Read a Header, which contains all the data except the handle. This 131 // Write/Read a Header, which contains all the data except the handle. This
130 // allows us to write the handle in a platform-specific way, as is necessary 132 // allows us to write the handle in a platform-specific way, as is necessary
131 // in NaClIPCAdapter to share handles with NaCl from Windows. 133 // in NaClIPCAdapter to share handles with NaCl from Windows.
132 static bool WriteHeader(const Header& hdr, Pickle* pickle); 134 static bool WriteHeader(const Header& hdr, base::Pickle* pickle);
133 static bool ReadHeader(PickleIterator* iter, Header* hdr); 135 static bool ReadHeader(base::PickleIterator* iter, Header* hdr);
134 136
135 private: 137 private:
136 // The kind of handle we're holding. 138 // The kind of handle we're holding.
137 Type type_; 139 Type type_;
138 140
139 // We hold more members than we really need; we can't easily use a union, 141 // We hold more members than we really need; we can't easily use a union,
140 // because we hold non-POD types. But these types are pretty light-weight. If 142 // because we hold non-POD types. But these types are pretty light-weight. If
141 // we add more complex things later, we should come up with a more memory- 143 // we add more complex things later, we should come up with a more memory-
142 // efficient strategy. 144 // efficient strategy.
143 // These are valid if type == SHARED_MEMORY. 145 // These are valid if type == SHARED_MEMORY.
144 base::SharedMemoryHandle shm_handle_; 146 base::SharedMemoryHandle shm_handle_;
145 uint32 size_; 147 uint32 size_;
146 148
147 // This is valid if type == SOCKET || type == FILE. 149 // This is valid if type == SOCKET || type == FILE.
148 IPC::PlatformFileForTransit descriptor_; 150 IPC::PlatformFileForTransit descriptor_;
149 151
150 // The following fields are valid if type == FILE. 152 // The following fields are valid if type == FILE.
151 int32 open_flags_; 153 int32 open_flags_;
152 // This is non-zero if file writes require quota checking. 154 // This is non-zero if file writes require quota checking.
153 PP_Resource file_io_; 155 PP_Resource file_io_;
154 }; 156 };
155 157
156 } // namespace proxy 158 } // namespace proxy
157 } // namespace ppapi 159 } // namespace ppapi
158 160
159 #endif // PPAPI_PROXY_SERIALIZED_HANDLES_H_ 161 #endif // PPAPI_PROXY_SERIALIZED_HANDLES_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/serialized_flash_menu.h ('k') | ppapi/proxy/serialized_structs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698