| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef PPAPI_CPP_DEV_STRUCT_WRAPPER_OUTPUT_TRAITS_DEV_ |
| 6 #define PPAPI_CPP_DEV_STRUCT_WRAPPER_OUTPUT_TRAITS_DEV_ |
| 7 |
| 8 namespace pp { |
| 9 namespace internal { |
| 10 |
| 11 // This class is used as the base class for CallbackOutputTraits specialized for |
| 12 // C struct wrappers. |
| 13 template <typename T> |
| 14 struct StructWrapperOutputTraits { |
| 15 typedef typename T::CType* APIArgType; |
| 16 typedef T StorageType; |
| 17 |
| 18 // Returns the underlying C struct of |t|, which can be passed to the browser |
| 19 // as an output parameter. |
| 20 static inline APIArgType StorageToAPIArg(StorageType& t) { |
| 21 return t.StartRawUpdate(); |
| 22 } |
| 23 |
| 24 // For each |t| passed into StorageToAPIArg(), this method must be called |
| 25 // exactly once in order to match StartRawUpdate() and EndRawUpdate(). |
| 26 static inline T& StorageToPluginArg(StorageType& t) { |
| 27 t.EndRawUpdate(); |
| 28 return t; |
| 29 } |
| 30 |
| 31 static inline void Initialize(StorageType* /* t */) {} |
| 32 }; |
| 33 |
| 34 } // namespace internal |
| 35 } // namespace pp |
| 36 |
| 37 #endif // PPAPI_CPP_DEV_STRUCT_WRAPPER_OUTPUT_TRAITS_DEV_ |
| OLD | NEW |