| Index: ppapi/cpp/dev/struct_wrapper_output_traits_dev.h
|
| diff --git a/ppapi/cpp/dev/struct_wrapper_output_traits_dev.h b/ppapi/cpp/dev/struct_wrapper_output_traits_dev.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f398c973848da13d115802cc24d2c49372a748cb
|
| --- /dev/null
|
| +++ b/ppapi/cpp/dev/struct_wrapper_output_traits_dev.h
|
| @@ -0,0 +1,37 @@
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef PPAPI_CPP_DEV_STRUCT_WRAPPER_OUTPUT_TRAITS_DEV_
|
| +#define PPAPI_CPP_DEV_STRUCT_WRAPPER_OUTPUT_TRAITS_DEV_
|
| +
|
| +namespace pp {
|
| +namespace internal {
|
| +
|
| +// This class is used as the base class for CallbackOutputTraits specialized for
|
| +// C struct wrappers.
|
| +template <typename T>
|
| +struct StructWrapperOutputTraits {
|
| + typedef typename T::CType* APIArgType;
|
| + typedef T StorageType;
|
| +
|
| + // Returns the underlying C struct of |t|, which can be passed to the browser
|
| + // as an output parameter.
|
| + static inline APIArgType StorageToAPIArg(StorageType& t) {
|
| + return t.StartRawUpdate();
|
| + }
|
| +
|
| + // For each |t| passed into StorageToAPIArg(), this method must be called
|
| + // exactly once in order to match StartRawUpdate() and EndRawUpdate().
|
| + static inline T& StorageToPluginArg(StorageType& t) {
|
| + t.EndRawUpdate();
|
| + return t;
|
| + }
|
| +
|
| + static inline void Initialize(StorageType* /* t */) {}
|
| +};
|
| +
|
| +} // namespace internal
|
| +} // namespace pp
|
| +
|
| +#endif // PPAPI_CPP_DEV_STRUCT_WRAPPER_OUTPUT_TRAITS_DEV_
|
|
|