| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_SHARED_IMPL_HOST_RESOURCE_H_ | 5 #ifndef PPAPI_SHARED_IMPL_HOST_RESOURCE_H_ |
| 6 #define PPAPI_SHARED_IMPL_HOST_RESOURCE_H_ | 6 #define PPAPI_SHARED_IMPL_HOST_RESOURCE_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/pp_instance.h" | 8 #include "ppapi/c/pp_instance.h" |
| 9 #include "ppapi/c/pp_resource.h" | 9 #include "ppapi/c/pp_resource.h" |
| 10 #include "ppapi/shared_impl/ppapi_shared_export.h" |
| 10 | 11 |
| 11 namespace ppapi { | 12 namespace ppapi { |
| 12 | 13 |
| 13 // Represents a PP_Resource sent over the wire. This just wraps a PP_Resource. | 14 // 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 // 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 // Resource values are remapped in the plugin so that it can talk to multiple |
| 16 // hosts. If all values were PP_Resource, it would be easy to forget to do | 17 // hosts. If all values were PP_Resource, it would be easy to forget to do |
| 17 // this tranformation. | 18 // this tranformation. |
| 18 // | 19 // |
| 19 // All HostResources respresent IDs valid in the host. | 20 // All HostResources respresent IDs valid in the host. |
| 20 class HostResource { | 21 class PPAPI_SHARED_EXPORT HostResource { |
| 21 public: | 22 public: |
| 22 HostResource() : instance_(0), host_resource_(0) { | 23 HostResource() : instance_(0), host_resource_(0) { |
| 23 } | 24 } |
| 24 | 25 |
| 25 bool is_null() const { | 26 bool is_null() const { |
| 26 return !host_resource_; | 27 return !host_resource_; |
| 27 } | 28 } |
| 28 | 29 |
| 29 // Some resources are plugin-side only and don't have a corresponding | 30 // Some resources are plugin-side only and don't have a corresponding |
| 30 // resource in the host. Yet these resources still need an instance to be | 31 // resource in the host. Yet these resources still need an instance to be |
| (...skipping 28 matching lines...) Expand all Loading... |
| 59 } | 60 } |
| 60 | 61 |
| 61 private: | 62 private: |
| 62 PP_Instance instance_; | 63 PP_Instance instance_; |
| 63 PP_Resource host_resource_; | 64 PP_Resource host_resource_; |
| 64 }; | 65 }; |
| 65 | 66 |
| 66 } // namespace ppapi | 67 } // namespace ppapi |
| 67 | 68 |
| 68 #endif // PPAPI_SHARED_IMPL_HOST_RESOURCE_H_ | 69 #endif // PPAPI_SHARED_IMPL_HOST_RESOURCE_H_ |
| OLD | NEW |