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

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

Issue 1097393007: Update {virtual,override} to follow C++11 style in ppapi. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split off one file into separate review. Created 5 years, 8 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_object_var.h ('k') | ppapi/proxy/resource_creation_proxy.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_RAW_VAR_DATA_H_ 5 #ifndef PPAPI_PROXY_RAW_VAR_DATA_H_
6 #define PPAPI_PROXY_RAW_VAR_DATA_H_ 6 #define PPAPI_PROXY_RAW_VAR_DATA_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 bool initialized() { return initialized_; } 122 bool initialized() { return initialized_; }
123 123
124 protected: 124 protected:
125 bool initialized_; 125 bool initialized_;
126 }; 126 };
127 127
128 // A RawVarData class for PP_Vars which are value types. 128 // A RawVarData class for PP_Vars which are value types.
129 class BasicRawVarData : public RawVarData { 129 class BasicRawVarData : public RawVarData {
130 public: 130 public:
131 BasicRawVarData(); 131 BasicRawVarData();
132 virtual ~BasicRawVarData(); 132 ~BasicRawVarData() override;
133 133
134 // RawVarData implementation. 134 // RawVarData implementation.
135 virtual PP_VarType Type() override; 135 PP_VarType Type() override;
136 virtual bool Init(const PP_Var& var, PP_Instance instance) override; 136 bool Init(const PP_Var& var, PP_Instance instance) override;
137 virtual PP_Var CreatePPVar(PP_Instance instance) override; 137 PP_Var CreatePPVar(PP_Instance instance) override;
138 virtual void PopulatePPVar(const PP_Var& var, 138 void PopulatePPVar(const PP_Var& var,
139 const std::vector<PP_Var>& graph) override; 139 const std::vector<PP_Var>& graph) override;
140 virtual void Write(IPC::Message* m, 140 void Write(IPC::Message* m, const HandleWriter& handle_writer) override;
141 const HandleWriter& handle_writer) override; 141 bool Read(PP_VarType type,
142 virtual bool Read(PP_VarType type, 142 const IPC::Message* m,
143 const IPC::Message* m, 143 PickleIterator* iter) override;
144 PickleIterator* iter) override;
145 144
146 private: 145 private:
147 PP_Var var_; 146 PP_Var var_;
148 }; 147 };
149 148
150 // A RawVarData class for string PP_Vars. 149 // A RawVarData class for string PP_Vars.
151 class StringRawVarData : public RawVarData { 150 class StringRawVarData : public RawVarData {
152 public: 151 public:
153 StringRawVarData(); 152 StringRawVarData();
154 virtual ~StringRawVarData(); 153 ~StringRawVarData() override;
155 154
156 // RawVarData implementation. 155 // RawVarData implementation.
157 virtual PP_VarType Type() override; 156 PP_VarType Type() override;
158 virtual bool Init(const PP_Var& var, PP_Instance instance) override; 157 bool Init(const PP_Var& var, PP_Instance instance) override;
159 virtual PP_Var CreatePPVar(PP_Instance instance) override; 158 PP_Var CreatePPVar(PP_Instance instance) override;
160 virtual void PopulatePPVar(const PP_Var& var, 159 void PopulatePPVar(const PP_Var& var,
161 const std::vector<PP_Var>& graph) override; 160 const std::vector<PP_Var>& graph) override;
162 virtual void Write(IPC::Message* m, 161 void Write(IPC::Message* m, const HandleWriter& handle_writer) override;
163 const HandleWriter& handle_writer) override; 162 bool Read(PP_VarType type,
164 virtual bool Read(PP_VarType type, 163 const IPC::Message* m,
165 const IPC::Message* m, 164 PickleIterator* iter) override;
166 PickleIterator* iter) override;
167 165
168 private: 166 private:
169 // The data in the string. 167 // The data in the string.
170 std::string data_; 168 std::string data_;
171 }; 169 };
172 170
173 // A RawVarData class for array buffer PP_Vars. 171 // A RawVarData class for array buffer PP_Vars.
174 class ArrayBufferRawVarData : public RawVarData { 172 class ArrayBufferRawVarData : public RawVarData {
175 public: 173 public:
176 // Enum for array buffer message types. 174 // Enum for array buffer message types.
177 enum ShmemType { 175 enum ShmemType {
178 ARRAY_BUFFER_NO_SHMEM, 176 ARRAY_BUFFER_NO_SHMEM,
179 ARRAY_BUFFER_SHMEM_HOST, 177 ARRAY_BUFFER_SHMEM_HOST,
180 ARRAY_BUFFER_SHMEM_PLUGIN, 178 ARRAY_BUFFER_SHMEM_PLUGIN,
181 }; 179 };
182 180
183 ArrayBufferRawVarData(); 181 ArrayBufferRawVarData();
184 virtual ~ArrayBufferRawVarData(); 182 ~ArrayBufferRawVarData() override;
185 183
186 // RawVarData implementation. 184 // RawVarData implementation.
187 virtual PP_VarType Type() override; 185 PP_VarType Type() override;
188 virtual bool Init(const PP_Var& var, PP_Instance instance) override; 186 bool Init(const PP_Var& var, PP_Instance instance) override;
189 virtual PP_Var CreatePPVar(PP_Instance instance) override; 187 PP_Var CreatePPVar(PP_Instance instance) override;
190 virtual void PopulatePPVar(const PP_Var& var, 188 void PopulatePPVar(const PP_Var& var,
191 const std::vector<PP_Var>& graph) override; 189 const std::vector<PP_Var>& graph) override;
192 virtual void Write(IPC::Message* m, 190 void Write(IPC::Message* m, const HandleWriter& handle_writer) override;
193 const HandleWriter& handle_writer) override; 191 bool Read(PP_VarType type,
194 virtual bool Read(PP_VarType type, 192 const IPC::Message* m,
195 const IPC::Message* m, 193 PickleIterator* iter) override;
196 PickleIterator* iter) override; 194 SerializedHandle* GetHandle() override;
197 virtual SerializedHandle* GetHandle() override;
198 195
199 private: 196 private:
200 // The type of the storage underlying the array buffer. 197 // The type of the storage underlying the array buffer.
201 ShmemType type_; 198 ShmemType type_;
202 // The data in the buffer. Valid for |type_| == ARRAY_BUFFER_NO_SHMEM. 199 // The data in the buffer. Valid for |type_| == ARRAY_BUFFER_NO_SHMEM.
203 std::string data_; 200 std::string data_;
204 // Host shmem handle. Valid for |type_| == ARRAY_BUFFER_SHMEM_HOST. 201 // Host shmem handle. Valid for |type_| == ARRAY_BUFFER_SHMEM_HOST.
205 int host_shm_handle_id_; 202 int host_shm_handle_id_;
206 // Plugin shmem handle. Valid for |type_| == ARRAY_BUFFER_SHMEM_PLUGIN. 203 // Plugin shmem handle. Valid for |type_| == ARRAY_BUFFER_SHMEM_PLUGIN.
207 SerializedHandle plugin_shm_handle_; 204 SerializedHandle plugin_shm_handle_;
208 }; 205 };
209 206
210 // A RawVarData class for array PP_Vars. 207 // A RawVarData class for array PP_Vars.
211 class ArrayRawVarData : public RawVarData { 208 class ArrayRawVarData : public RawVarData {
212 public: 209 public:
213 ArrayRawVarData(); 210 ArrayRawVarData();
214 virtual ~ArrayRawVarData(); 211 ~ArrayRawVarData() override;
215 212
216 void AddChild(size_t element); 213 void AddChild(size_t element);
217 214
218 // RawVarData implementation. 215 // RawVarData implementation.
219 virtual PP_VarType Type() override; 216 PP_VarType Type() override;
220 virtual bool Init(const PP_Var& var, PP_Instance instance) override; 217 bool Init(const PP_Var& var, PP_Instance instance) override;
221 virtual PP_Var CreatePPVar(PP_Instance instance) override; 218 PP_Var CreatePPVar(PP_Instance instance) override;
222 virtual void PopulatePPVar(const PP_Var& var, 219 void PopulatePPVar(const PP_Var& var,
223 const std::vector<PP_Var>& graph) override; 220 const std::vector<PP_Var>& graph) override;
224 virtual void Write(IPC::Message* m, 221 void Write(IPC::Message* m, const HandleWriter& handle_writer) override;
225 const HandleWriter& handle_writer) override; 222 bool Read(PP_VarType type,
226 virtual bool Read(PP_VarType type, 223 const IPC::Message* m,
227 const IPC::Message* m, 224 PickleIterator* iter) override;
228 PickleIterator* iter) override;
229 225
230 private: 226 private:
231 std::vector<size_t> children_; 227 std::vector<size_t> children_;
232 }; 228 };
233 229
234 // A RawVarData class for dictionary PP_Vars. 230 // A RawVarData class for dictionary PP_Vars.
235 class DictionaryRawVarData : public RawVarData { 231 class DictionaryRawVarData : public RawVarData {
236 public: 232 public:
237 DictionaryRawVarData(); 233 DictionaryRawVarData();
238 virtual ~DictionaryRawVarData(); 234 ~DictionaryRawVarData() override;
239 235
240 void AddChild(const std::string& key, size_t value); 236 void AddChild(const std::string& key, size_t value);
241 237
242 // RawVarData implementation. 238 // RawVarData implementation.
243 virtual PP_VarType Type() override; 239 PP_VarType Type() override;
244 virtual bool Init(const PP_Var& var, PP_Instance instance) override; 240 bool Init(const PP_Var& var, PP_Instance instance) override;
245 virtual PP_Var CreatePPVar(PP_Instance instance) override; 241 PP_Var CreatePPVar(PP_Instance instance) override;
246 virtual void PopulatePPVar(const PP_Var& var, 242 void PopulatePPVar(const PP_Var& var,
247 const std::vector<PP_Var>& graph) override; 243 const std::vector<PP_Var>& graph) override;
248 virtual void Write(IPC::Message* m, 244 void Write(IPC::Message* m, const HandleWriter& handle_writer) override;
249 const HandleWriter& handle_writer) override; 245 bool Read(PP_VarType type,
250 virtual bool Read(PP_VarType type, 246 const IPC::Message* m,
251 const IPC::Message* m, 247 PickleIterator* iter) override;
252 PickleIterator* iter) override;
253 248
254 private: 249 private:
255 std::vector<std::pair<std::string, size_t> > children_; 250 std::vector<std::pair<std::string, size_t> > children_;
256 }; 251 };
257 252
258 // A RawVarData class for resource PP_Vars. 253 // A RawVarData class for resource PP_Vars.
259 // This class does not hold a reference on the PP_Resource that is being 254 // This class does not hold a reference on the PP_Resource that is being
260 // serialized. If sending a resource from the plugin to the host, the plugin 255 // serialized. If sending a resource from the plugin to the host, the plugin
261 // should not release the ResourceVar before sending the serialized message to 256 // should not release the ResourceVar before sending the serialized message to
262 // the host, and the host should immediately consume the ResourceVar before 257 // the host, and the host should immediately consume the ResourceVar before
263 // processing further messages. 258 // processing further messages.
264 class ResourceRawVarData : public RawVarData { 259 class ResourceRawVarData : public RawVarData {
265 public: 260 public:
266 ResourceRawVarData(); 261 ResourceRawVarData();
267 virtual ~ResourceRawVarData(); 262 ~ResourceRawVarData() override;
268 263
269 // RawVarData implementation. 264 // RawVarData implementation.
270 virtual PP_VarType Type() override; 265 PP_VarType Type() override;
271 virtual bool Init(const PP_Var& var, PP_Instance instance) override; 266 bool Init(const PP_Var& var, PP_Instance instance) override;
272 virtual PP_Var CreatePPVar(PP_Instance instance) override; 267 PP_Var CreatePPVar(PP_Instance instance) override;
273 virtual void PopulatePPVar(const PP_Var& var, 268 void PopulatePPVar(const PP_Var& var,
274 const std::vector<PP_Var>& graph) override; 269 const std::vector<PP_Var>& graph) override;
275 virtual void Write(IPC::Message* m, 270 void Write(IPC::Message* m, const HandleWriter& handle_writer) override;
276 const HandleWriter& handle_writer) override; 271 bool Read(PP_VarType type,
277 virtual bool Read(PP_VarType type, 272 const IPC::Message* m,
278 const IPC::Message* m, 273 PickleIterator* iter) override;
279 PickleIterator* iter) override;
280 274
281 private: 275 private:
282 // Resource ID in the plugin. If one has not yet been created, this is 0. 276 // Resource ID in the plugin. If one has not yet been created, this is 0.
283 // This is a borrowed reference; the resource's refcount is not incremented. 277 // This is a borrowed reference; the resource's refcount is not incremented.
284 PP_Resource pp_resource_; 278 PP_Resource pp_resource_;
285 279
286 // Pending resource host ID in the renderer. 280 // Pending resource host ID in the renderer.
287 int pending_renderer_host_id_; 281 int pending_renderer_host_id_;
288 282
289 // Pending resource host ID in the browser. 283 // Pending resource host ID in the browser.
290 int pending_browser_host_id_; 284 int pending_browser_host_id_;
291 285
292 // A message containing information about how to create a plugin-side 286 // A message containing information about how to create a plugin-side
293 // resource. The message type will vary based on the resource type, and will 287 // resource. The message type will vary based on the resource type, and will
294 // usually contain a pending resource host ID, and other required information. 288 // usually contain a pending resource host ID, and other required information.
295 // If the resource was created directly, this is NULL. 289 // If the resource was created directly, this is NULL.
296 scoped_ptr<IPC::Message> creation_message_; 290 scoped_ptr<IPC::Message> creation_message_;
297 }; 291 };
298 292
299 } // namespace proxy 293 } // namespace proxy
300 } // namespace ppapi 294 } // namespace ppapi
301 295
302 #endif // PPAPI_PROXY_RAW_VAR_DATA_H_ 296 #endif // PPAPI_PROXY_RAW_VAR_DATA_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/proxy_object_var.h ('k') | ppapi/proxy/resource_creation_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698