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

Side by Side Diff: ppapi/cpp/extensions/ext_output_traits.h

Issue 18611004: PPAPI: Initialize CompletionCallbackWithOutput storage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/cpp/directory_entry.h ('k') | ppapi/cpp/output_traits.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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_CPP_EXTENSIONS_OUTPUT_TRAITS_H_ 5 #ifndef PPAPI_CPP_EXTENSIONS_OUTPUT_TRAITS_H_
6 #define PPAPI_CPP_EXTENSIONS_OUTPUT_TRAITS_H_ 6 #define PPAPI_CPP_EXTENSIONS_OUTPUT_TRAITS_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "ppapi/c/pp_var.h" 10 #include "ppapi/c/pp_var.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 static inline APIArgType StorageToAPIArg(StorageType& t) { 62 static inline APIArgType StorageToAPIArg(StorageType& t) {
63 return &t.pp_var(); 63 return &t.pp_var();
64 } 64 }
65 65
66 // This must be called exactly once to consume the one PP_Var reference 66 // This must be called exactly once to consume the one PP_Var reference
67 // assigned to us by the browser. 67 // assigned to us by the browser.
68 static inline T& StorageToPluginArg(StorageType& t) { 68 static inline T& StorageToPluginArg(StorageType& t) {
69 return t.output(); 69 return t.output();
70 } 70 }
71
72 static inline void Initialize(StorageType* /* t */) {}
71 }; 73 };
72 74
73 // This class provides storage for a PP_Var and a vector of objects which are 75 // This class provides storage for a PP_Var and a vector of objects which are
74 // of type T. The PP_Var is used as an output parameter to receive an array var 76 // of type T. The PP_Var is used as an output parameter to receive an array var
75 // from the browser. Each element in the array var is converted to a T object, 77 // from the browser. Each element in the array var is converted to a T object,
76 // using FromVarConverter, and stores in the vector. 78 // using FromVarConverter, and stores in the vector.
77 template <class T> 79 template <class T>
78 class ArrayVarOutputAdapterWithStorage { 80 class ArrayVarOutputAdapterWithStorage {
79 public: 81 public:
80 ArrayVarOutputAdapterWithStorage() : pp_var_(PP_MakeUndefined()) { 82 ArrayVarOutputAdapterWithStorage() : pp_var_(PP_MakeUndefined()) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 124
123 static inline APIArgType StorageToAPIArg(StorageType& t) { 125 static inline APIArgType StorageToAPIArg(StorageType& t) {
124 return &t.pp_var(); 126 return &t.pp_var();
125 } 127 }
126 128
127 // This must be called exactly once to consume the one PP_Var reference 129 // This must be called exactly once to consume the one PP_Var reference
128 // assigned to us by the browser. 130 // assigned to us by the browser.
129 static inline std::vector<T>& StorageToPluginArg(StorageType& t) { 131 static inline std::vector<T>& StorageToPluginArg(StorageType& t) {
130 return t.output(); 132 return t.output();
131 } 133 }
134
135 static inline void Initialize(StorageType* /* t */) {}
132 }; 136 };
133 137
134 } // namespace internal 138 } // namespace internal
135 } // namespace ext 139 } // namespace ext
136 } // namespace pp 140 } // namespace pp
137 141
138 #endif // PPAPI_CPP_EXTENSIONS_OUTPUT_TRAITS_H_ 142 #endif // PPAPI_CPP_EXTENSIONS_OUTPUT_TRAITS_H_
OLDNEW
« no previous file with comments | « ppapi/cpp/directory_entry.h ('k') | ppapi/cpp/output_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698