Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: ppapi/cpp/dev/struct_wrapper_output_traits_dev.h

Issue 116963003: App APIs in Pepper: C++ APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes according to Sam's suggestions. Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ppapi/cpp/dev/string_wrapper_dev.cc ('k') | ppapi/cpp/dev/to_c_type_converter_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/string_wrapper_dev.cc ('k') | ppapi/cpp/dev/to_c_type_converter_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698