| 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" |
| 15 | 16 |
| 16 namespace ppapi { | 17 namespace ppapi { |
| 17 namespace thunk { | 18 namespace thunk { |
| 18 | 19 |
| 19 // EnterHost* helper objects: These objects wrap a call from the C PPAPI into | 20 // 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 | 21 // the internal implementation. They make sure the lock is acquired and will |
| 21 // automatically set up some stuff for you. | 22 // automatically set up some stuff for you. |
| 22 // | 23 // |
| 23 // You should always check whether the enter succeeded before using the object. | 24 // 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. | 25 // 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. | 122 // TODO(brettw) actually implement locks, this is just a placeholder for now. |
| 122 template<typename ResourceT> | 123 template<typename ResourceT> |
| 123 class EnterResourceNoLock : public EnterResource<ResourceT> { | 124 class EnterResourceNoLock : public EnterResource<ResourceT> { |
| 124 public: | 125 public: |
| 125 EnterResourceNoLock(PP_Resource resource, bool report_error) | 126 EnterResourceNoLock(PP_Resource resource, bool report_error) |
| 126 : EnterResource<ResourceT>(resource, report_error) { | 127 : EnterResource<ResourceT>(resource, report_error) { |
| 127 // TODO(brettw) assert the lock is held. | 128 // TODO(brettw) assert the lock is held. |
| 128 } | 129 } |
| 129 }; | 130 }; |
| 130 | 131 |
| 132 // Simpler wrapper to enter the resource creation API. This is used for every |
| 133 // class so we have this helper function to save template instantiations and |
| 134 // typing. |
| 135 PPAPI_THUNK_EXPORT class EnterResourceCreation |
| 136 : public EnterFunctionNoLock<ResourceCreationAPI> { |
| 137 public: |
| 138 EnterResourceCreation(PP_Instance instance); |
| 139 ~EnterResourceCreation(); |
| 140 }; |
| 141 |
| 142 // Simpler wrapper to enter the instance API from proxy code. This is used for |
| 143 // many interfaces so we have this helper function to save template |
| 144 // instantiations and typing. |
| 145 PPAPI_THUNK_EXPORT class EnterInstance |
| 146 : public EnterFunctionNoLock<PPB_Instance_FunctionAPI> { |
| 147 public: |
| 148 EnterInstance(PP_Instance instance); |
| 149 ~EnterInstance(); |
| 150 }; |
| 151 |
| 131 } // namespace thunk | 152 } // namespace thunk |
| 132 } // namespace ppapi | 153 } // namespace ppapi |
| 133 | 154 |
| 134 #endif // PPAPI_THUNK_ENTER_H_ | 155 #endif // PPAPI_THUNK_ENTER_H_ |
| OLD | NEW |