Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef PPAPI_PROXY_SERIALIZED_RESOURCE_H_ | |
| 6 #define PPAPI_PROXY_SERIALIZED_RESOURCE_H_ | |
| 7 | |
| 8 #include "ppapi/c/pp_resource.h" | |
| 9 | |
| 10 namespace pp { | |
| 11 namespace proxy { | |
| 12 | |
| 13 // Represents a PP_Resource sent over the wire. This just wraps a PP_Resource. | |
| 14 // The point is to prevent mistakes where the wrong resource value is sent. | |
| 15 // Resource values are remapped in the plugin so that it can talk to multiple | |
| 16 // hosts. It all values were PP_Resource, it would be easy to forget to do | |
|
viettrungluu
2011/01/27 16:52:58
s/It/If/
| |
| 17 // this tranformation. | |
| 18 // | |
| 19 // All SerializedResources respresent the IDs valid in the host. | |
|
viettrungluu
2011/01/27 16:52:58
s/respresent/represent/
Also, I think the (first)
| |
| 20 class SerializedResource { | |
| 21 public: | |
| 22 SerializedResource() : host_resource_(0) { | |
| 23 } | |
| 24 | |
| 25 bool is_null() const { | |
| 26 return !host_resource_; | |
| 27 } | |
| 28 | |
| 29 // Sets and retrieves the internal PP_Resource which is valid for the host | |
| 30 // (a.k.a. renderer, as opposed to the plugin) process. | |
| 31 // | |
| 32 // DO NOT CALL THESE FUNCTIONS IN THE PLUGIN. The values will be invalid. See | |
|
viettrungluu
2011/01/27 16:52:58
By "PLUGIN", you mean "PLUGIN PROCESS" (or "PLUGIN
| |
| 33 // the class comment above. | |
| 34 void set_host_resource(PP_Resource resource) { | |
| 35 host_resource_ = resource; | |
| 36 } | |
| 37 PP_Resource host_resource() const { | |
| 38 return host_resource_; | |
| 39 } | |
| 40 | |
| 41 private: | |
| 42 PP_Resource host_resource_; | |
| 43 }; | |
| 44 | |
| 45 } // namespace proxy | |
| 46 } // namespace pp | |
| 47 | |
| 48 #endif // PPAPI_PROXY_SERIALIZED_RESOURCE_H_ | |
| OLD | NEW |