Chromium Code Reviews| Index: ppapi/proxy/serialized_resource.h |
| =================================================================== |
| --- ppapi/proxy/serialized_resource.h (revision 0) |
| +++ ppapi/proxy/serialized_resource.h (revision 0) |
| @@ -0,0 +1,48 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef PPAPI_PROXY_SERIALIZED_RESOURCE_H_ |
| +#define PPAPI_PROXY_SERIALIZED_RESOURCE_H_ |
| + |
| +#include "ppapi/c/pp_resource.h" |
| + |
| +namespace pp { |
| +namespace proxy { |
| + |
| +// Represents a PP_Resource sent over the wire. This just wraps a PP_Resource. |
| +// The point is to prevent mistakes where the wrong resource value is sent. |
| +// Resource values are remapped in the plugin so that it can talk to multiple |
| +// 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/
|
| +// this tranformation. |
| +// |
| +// All SerializedResources respresent the IDs valid in the host. |
|
viettrungluu
2011/01/27 16:52:58
s/respresent/represent/
Also, I think the (first)
|
| +class SerializedResource { |
| + public: |
| + SerializedResource() : host_resource_(0) { |
| + } |
| + |
| + bool is_null() const { |
| + return !host_resource_; |
| + } |
| + |
| + // Sets and retrieves the internal PP_Resource which is valid for the host |
| + // (a.k.a. renderer, as opposed to the plugin) process. |
| + // |
| + // 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
|
| + // the class comment above. |
| + void set_host_resource(PP_Resource resource) { |
| + host_resource_ = resource; |
| + } |
| + PP_Resource host_resource() const { |
| + return host_resource_; |
| + } |
| + |
| + private: |
| + PP_Resource host_resource_; |
| +}; |
| + |
| +} // namespace proxy |
| +} // namespace pp |
| + |
| +#endif // PPAPI_PROXY_SERIALIZED_RESOURCE_H_ |
| Property changes on: ppapi/proxy/serialized_resource.h |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| + LF |