| 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_RESOURCE_H_ | 5 #ifndef PPAPI_SHARED_IMPL_RESOURCE_H_ |
| 6 #define PPAPI_SHARED_IMPL_RESOURCE_H_ | 6 #define PPAPI_SHARED_IMPL_RESOURCE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> // For NULL. | 8 #include <stddef.h> // For NULL. |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 namespace ppapi { | 53 namespace ppapi { |
| 54 | 54 |
| 55 // Forward declare all the resource APIs. | 55 // Forward declare all the resource APIs. |
| 56 namespace thunk { | 56 namespace thunk { |
| 57 #define DECLARE_RESOURCE_CLASS(RESOURCE) class RESOURCE; | 57 #define DECLARE_RESOURCE_CLASS(RESOURCE) class RESOURCE; |
| 58 FOR_ALL_PPAPI_RESOURCE_APIS(DECLARE_RESOURCE_CLASS) | 58 FOR_ALL_PPAPI_RESOURCE_APIS(DECLARE_RESOURCE_CLASS) |
| 59 #undef DECLARE_RESOURCE_CLASS | 59 #undef DECLARE_RESOURCE_CLASS |
| 60 } // namespace thunk | 60 } // namespace thunk |
| 61 | 61 |
| 62 class Resource : public base::RefCounted<Resource> { | 62 class PPAPI_SHARED_EXPORT Resource : public base::RefCounted<Resource> { |
| 63 public: | 63 public: |
| 64 // For constructing non-proxied objects. This just takes the associated | 64 // For constructing non-proxied objects. This just takes the associated |
| 65 // instance, and generates a new resource ID. The host resource will be the | 65 // instance, and generates a new resource ID. The host resource will be the |
| 66 // same as the newly-generated resource ID. | 66 // same as the newly-generated resource ID. |
| 67 explicit Resource(PP_Instance instance); | 67 explicit Resource(PP_Instance instance); |
| 68 | 68 |
| 69 // For constructing proxied objects. This takes the resource generated in | 69 // For constructing proxied objects. This takes the resource generated in |
| 70 // the host side, stores it, and allocates a "local" resource ID for use in | 70 // the host side, stores it, and allocates a "local" resource ID for use in |
| 71 // the current process. | 71 // the current process. |
| 72 explicit Resource(const HostResource& host_resource); | 72 explicit Resource(const HostResource& host_resource); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 #define DEFINE_RESOURCE_CAST(RESOURCE) \ | 132 #define DEFINE_RESOURCE_CAST(RESOURCE) \ |
| 133 template<> inline thunk::RESOURCE* Resource::GetAs() { \ | 133 template<> inline thunk::RESOURCE* Resource::GetAs() { \ |
| 134 return As##RESOURCE(); \ | 134 return As##RESOURCE(); \ |
| 135 } | 135 } |
| 136 FOR_ALL_PPAPI_RESOURCE_APIS(DEFINE_RESOURCE_CAST) | 136 FOR_ALL_PPAPI_RESOURCE_APIS(DEFINE_RESOURCE_CAST) |
| 137 #undef DEFINE_RESOURCE_CAST | 137 #undef DEFINE_RESOURCE_CAST |
| 138 | 138 |
| 139 } // namespace ppapi | 139 } // namespace ppapi |
| 140 | 140 |
| 141 #endif // PPAPI_SHARED_IMPL_RESOURCE_H_ | 141 #endif // PPAPI_SHARED_IMPL_RESOURCE_H_ |
| OLD | NEW |