| 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" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 instance, FunctionsT::interface_id); | 45 instance, FunctionsT::interface_id); |
| 46 if (base) | 46 if (base) |
| 47 functions_ = base->GetAs<FunctionsT>(); | 47 functions_ = base->GetAs<FunctionsT>(); |
| 48 // TODO(brettw) check error and if report_error is set, do something. | 48 // TODO(brettw) check error and if report_error is set, do something. |
| 49 } | 49 } |
| 50 ~EnterFunction() {} | 50 ~EnterFunction() {} |
| 51 | 51 |
| 52 bool succeeded() const { return !!functions_; } | 52 bool succeeded() const { return !!functions_; } |
| 53 bool failed() const { return !functions_; } | 53 bool failed() const { return !functions_; } |
| 54 | 54 |
| 55 PP_Instance instance() const { return instance_; } | |
| 56 FunctionsT* functions() { return functions_; } | 55 FunctionsT* functions() { return functions_; } |
| 57 | 56 |
| 58 private: | 57 private: |
| 59 PP_Instance instance_; | |
| 60 FunctionsT* functions_; | 58 FunctionsT* functions_; |
| 61 | 59 |
| 62 DISALLOW_COPY_AND_ASSIGN(EnterFunction); | 60 DISALLOW_COPY_AND_ASSIGN(EnterFunction); |
| 63 }; | 61 }; |
| 64 | 62 |
| 65 // Like EnterResource but assumes the lock is already held. | 63 // Like EnterResource but assumes the lock is already held. |
| 66 // TODO(brettw) actually implement locks, this is just a placeholder for now. | 64 // TODO(brettw) actually implement locks, this is just a placeholder for now. |
| 67 template<typename FunctionsT> | 65 template<typename FunctionsT> |
| 68 class EnterFunctionNoLock : public EnterFunction<FunctionsT> { | 66 class EnterFunctionNoLock : public EnterFunction<FunctionsT> { |
| 69 public: | 67 public: |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 EnterResourceNoLock(PP_Resource resource, bool report_error) | 116 EnterResourceNoLock(PP_Resource resource, bool report_error) |
| 119 : EnterResource<ResourceT>(resource, report_error) { | 117 : EnterResource<ResourceT>(resource, report_error) { |
| 120 // TODO(brettw) assert the lock is held. | 118 // TODO(brettw) assert the lock is held. |
| 121 } | 119 } |
| 122 }; | 120 }; |
| 123 | 121 |
| 124 } // namespace thunk | 122 } // namespace thunk |
| 125 } // namespace ppapi | 123 } // namespace ppapi |
| 126 | 124 |
| 127 #endif // PPAPI_THUNK_ENTER_H_ | 125 #endif // PPAPI_THUNK_ENTER_H_ |
| OLD | NEW |