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_THUNK_ENTER_H_ | 5 #ifndef PPAPI_THUNK_ENTER_H_ |
6 #define PPAPI_THUNK_ENTER_H_ | 6 #define PPAPI_THUNK_ENTER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "ppapi/c/pp_resource.h" | 9 #include "ppapi/c/pp_resource.h" |
10 #include "ppapi/proxy/interface_id.h" | 10 #include "ppapi/proxy/interface_id.h" |
11 #include "ppapi/shared_impl/function_group_base.h" | 11 #include "ppapi/shared_impl/function_group_base.h" |
12 #include "ppapi/shared_impl/resource.h" | 12 #include "ppapi/shared_impl/resource.h" |
13 #include "ppapi/shared_impl/tracker_base.h" | 13 #include "ppapi/shared_impl/tracker_base.h" |
14 #include "ppapi/shared_impl/resource_tracker.h" | 14 #include "ppapi/shared_impl/resource_tracker.h" |
| 15 #include "ppapi/thunk/ppapi_thunk_export.h" |
| 16 #include "ppapi/thunk/ppb_instance_api.h" |
| 17 #include "ppapi/thunk/resource_creation_api.h" |
15 | 18 |
16 namespace ppapi { | 19 namespace ppapi { |
17 namespace thunk { | 20 namespace thunk { |
18 | 21 |
19 // EnterHost* helper objects: These objects wrap a call from the C PPAPI into | 22 // EnterHost* helper objects: These objects wrap a call from the C PPAPI into |
20 // the internal implementation. They make sure the lock is acquired and will | 23 // the internal implementation. They make sure the lock is acquired and will |
21 // automatically set up some stuff for you. | 24 // automatically set up some stuff for you. |
22 // | 25 // |
23 // You should always check whether the enter succeeded before using the object. | 26 // You should always check whether the enter succeeded before using the object. |
24 // If this fails, then the instance or resource ID supplied was invalid. | 27 // If this fails, then the instance or resource ID supplied was invalid. |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // TODO(brettw) actually implement locks, this is just a placeholder for now. | 124 // TODO(brettw) actually implement locks, this is just a placeholder for now. |
122 template<typename ResourceT> | 125 template<typename ResourceT> |
123 class EnterResourceNoLock : public EnterResource<ResourceT> { | 126 class EnterResourceNoLock : public EnterResource<ResourceT> { |
124 public: | 127 public: |
125 EnterResourceNoLock(PP_Resource resource, bool report_error) | 128 EnterResourceNoLock(PP_Resource resource, bool report_error) |
126 : EnterResource<ResourceT>(resource, report_error) { | 129 : EnterResource<ResourceT>(resource, report_error) { |
127 // TODO(brettw) assert the lock is held. | 130 // TODO(brettw) assert the lock is held. |
128 } | 131 } |
129 }; | 132 }; |
130 | 133 |
| 134 // Simpler wrapper to enter the resource creation API. This is used for every |
| 135 // class so we have this helper function to save template instantiations and |
| 136 // typing. |
| 137 class PPAPI_THUNK_EXPORT EnterResourceCreation |
| 138 : public EnterFunctionNoLock<ResourceCreationAPI> { |
| 139 public: |
| 140 EnterResourceCreation(PP_Instance instance); |
| 141 ~EnterResourceCreation(); |
| 142 }; |
| 143 |
| 144 // Simpler wrapper to enter the instance API from proxy code. This is used for |
| 145 // many interfaces so we have this helper function to save template |
| 146 // instantiations and typing. |
| 147 class PPAPI_THUNK_EXPORT EnterInstance |
| 148 : public EnterFunctionNoLock<PPB_Instance_FunctionAPI> { |
| 149 public: |
| 150 EnterInstance(PP_Instance instance); |
| 151 ~EnterInstance(); |
| 152 }; |
| 153 |
131 } // namespace thunk | 154 } // namespace thunk |
132 } // namespace ppapi | 155 } // namespace ppapi |
133 | 156 |
134 #endif // PPAPI_THUNK_ENTER_H_ | 157 #endif // PPAPI_THUNK_ENTER_H_ |
OLD | NEW |