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/shared_impl/api_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/ppapi_globals.h" | 12 #include "ppapi/shared_impl/ppapi_globals.h" |
13 #include "ppapi/shared_impl/proxy_lock.h" | 13 #include "ppapi/shared_impl/proxy_lock.h" |
14 #include "ppapi/shared_impl/resource.h" | 14 #include "ppapi/shared_impl/resource.h" |
15 #include "ppapi/shared_impl/resource_tracker.h" | 15 #include "ppapi/shared_impl/resource_tracker.h" |
16 #include "ppapi/thunk/ppapi_thunk_export.h" | 16 #include "ppapi/thunk/ppapi_thunk_export.h" |
17 #include "ppapi/thunk/ppb_instance_api.h" | 17 #include "ppapi/thunk/ppb_instance_api.h" |
18 #include "ppapi/thunk/resource_creation_api.h" | 18 #include "ppapi/thunk/resource_creation_api.h" |
19 | 19 |
20 namespace ppapi { | 20 namespace ppapi { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 } // namespace subtle | 69 } // namespace subtle |
70 | 70 |
71 | 71 |
72 template<typename FunctionsT, bool lock_on_entry = true> | 72 template<typename FunctionsT, bool lock_on_entry = true> |
73 class EnterFunction : subtle::LockOnEntry<lock_on_entry> { | 73 class EnterFunction : subtle::LockOnEntry<lock_on_entry> { |
74 public: | 74 public: |
75 EnterFunction(PP_Instance instance, bool report_error) | 75 EnterFunction(PP_Instance instance, bool report_error) |
76 : functions_(NULL) { | 76 : functions_(NULL) { |
77 FunctionGroupBase* base = PpapiGlobals::Get()->GetFunctionAPI( | 77 FunctionGroupBase* base = PpapiGlobals::Get()->GetFunctionAPI( |
78 instance, FunctionsT::interface_id); | 78 instance, FunctionsT::kApiID); |
79 if (base) | 79 if (base) |
80 functions_ = base->GetAs<FunctionsT>(); | 80 functions_ = base->GetAs<FunctionsT>(); |
81 // TODO(brettw) check error and if report_error is set, do something. | 81 // TODO(brettw) check error and if report_error is set, do something. |
82 } | 82 } |
83 | 83 |
84 ~EnterFunction() {} | 84 ~EnterFunction() {} |
85 | 85 |
86 bool succeeded() const { return !!functions_; } | 86 bool succeeded() const { return !!functions_; } |
87 bool failed() const { return !functions_; } | 87 bool failed() const { return !functions_; } |
88 | 88 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 : public EnterFunctionNoLock<PPB_Instance_FunctionAPI> { | 175 : public EnterFunctionNoLock<PPB_Instance_FunctionAPI> { |
176 public: | 176 public: |
177 EnterInstance(PP_Instance instance); | 177 EnterInstance(PP_Instance instance); |
178 ~EnterInstance(); | 178 ~EnterInstance(); |
179 }; | 179 }; |
180 | 180 |
181 } // namespace thunk | 181 } // namespace thunk |
182 } // namespace ppapi | 182 } // namespace ppapi |
183 | 183 |
184 #endif // PPAPI_THUNK_ENTER_H_ | 184 #endif // PPAPI_THUNK_ENTER_H_ |
OLD | NEW |