| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SCOPED_PP_VAR_H_ | 5 #ifndef PPAPI_SHARED_IMPL_SCOPED_PP_VAR_H_ |
| 6 #define PPAPI_SHARED_IMPL_SCOPED_PP_VAR_H_ | 6 #define PPAPI_SHARED_IMPL_SCOPED_PP_VAR_H_ |
| 7 | 7 |
| 8 #include <stdlib.h> | 8 #include <stdlib.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // Returns the PP_Var, passing the reference to the caller. This class | 40 // Returns the PP_Var, passing the reference to the caller. This class |
| 41 // will no longer hold the var. | 41 // will no longer hold the var. |
| 42 PP_Var Release(); | 42 PP_Var Release(); |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 PP_Var var_; | 45 PP_Var var_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // An array of PP_Vars which will be deallocated and have their references | 48 // An array of PP_Vars which will be deallocated and have their references |
| 49 // decremented when they go out of scope. | 49 // decremented when they go out of scope. |
| 50 class PPAPI_SHARED_EXPORT ScopedPPVarArray { | 50 class ScopedPPVarArray { |
| 51 public: | 51 public: |
| 52 struct PassPPBMemoryAllocatedArray {}; | 52 struct PassPPBMemoryAllocatedArray {}; |
| 53 | 53 |
| 54 // Assumes responsibility for one ref of each of the vars in the array as | 54 // Assumes responsibility for one ref of each of the vars in the array as |
| 55 // well as the array memory allocated by PPB_Memory_Dev. | 55 // well as the array memory allocated by PPB_Memory_Dev. |
| 56 // TODO(raymes): Add compatibility for arrays allocated with C++ "new". | 56 // TODO(raymes): Add compatibility for arrays allocated with C++ "new". |
| 57 ScopedPPVarArray(const PassPPBMemoryAllocatedArray&, | 57 ScopedPPVarArray(const PassPPBMemoryAllocatedArray&, |
| 58 PP_Var* array, | 58 PP_Var* array, |
| 59 size_t size); | 59 size_t size); |
| 60 | 60 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 76 // TODO(raymes): Consider supporting copy/assign. | 76 // TODO(raymes): Consider supporting copy/assign. |
| 77 DISALLOW_COPY_AND_ASSIGN(ScopedPPVarArray); | 77 DISALLOW_COPY_AND_ASSIGN(ScopedPPVarArray); |
| 78 | 78 |
| 79 PP_Var* array_; | 79 PP_Var* array_; |
| 80 size_t size_; | 80 size_t size_; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace ppapi | 83 } // namespace ppapi |
| 84 | 84 |
| 85 #endif // PPAPI_SHARED_IMPL_SCOPED_PP_VAR_H_ | 85 #endif // PPAPI_SHARED_IMPL_SCOPED_PP_VAR_H_ |
| OLD | NEW |