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

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

Issue 17005006: Move PPB_VarArray and PPB_VarDictionary out of dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/extensions/dict_field.h ('k') | ppapi/cpp/extensions/from_var_converter.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"
11 #include "ppapi/cpp/dev/var_array_dev.h"
12 #include "ppapi/cpp/extensions/from_var_converter.h" 11 #include "ppapi/cpp/extensions/from_var_converter.h"
13 #include "ppapi/cpp/logging.h" 12 #include "ppapi/cpp/logging.h"
14 #include "ppapi/cpp/pass_ref.h" 13 #include "ppapi/cpp/pass_ref.h"
15 #include "ppapi/cpp/var.h" 14 #include "ppapi/cpp/var.h"
15 #include "ppapi/cpp/var_array.h"
16 16
17 namespace pp { 17 namespace pp {
18 namespace ext { 18 namespace ext {
19 namespace internal { 19 namespace internal {
20 20
21 template <class T> 21 template <class T>
22 class VarOutputAdapterWithStorage { 22 class VarOutputAdapterWithStorage {
23 public: 23 public:
24 VarOutputAdapterWithStorage() : pp_var_(PP_MakeUndefined()) { 24 VarOutputAdapterWithStorage() : pp_var_(PP_MakeUndefined()) {
25 } 25 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 PP_Var& pp_var() { return pp_var_; } 87 PP_Var& pp_var() { return pp_var_; }
88 88
89 std::vector<T>& output() { 89 std::vector<T>& output() {
90 PP_DCHECK(output_storage_.empty()); 90 PP_DCHECK(output_storage_.empty());
91 91
92 Var var(PASS_REF, pp_var_); 92 Var var(PASS_REF, pp_var_);
93 pp_var_ = PP_MakeUndefined(); 93 pp_var_ = PP_MakeUndefined();
94 if (var.is_array()) { 94 if (var.is_array()) {
95 VarArray_Dev array(var); 95 VarArray array(var);
96 96
97 uint32_t length = array.GetLength(); 97 uint32_t length = array.GetLength();
98 output_storage_.reserve(length); 98 output_storage_.reserve(length);
99 for (uint32_t i = 0; i < length; ++i) { 99 for (uint32_t i = 0; i < length; ++i) {
100 FromVarConverter<T> converter(array.Get(i).pp_var()); 100 FromVarConverter<T> converter(array.Get(i).pp_var());
101 output_storage_.push_back(converter.value()); 101 output_storage_.push_back(converter.value());
102 } 102 }
103 } 103 }
104 104
105 return output_storage_; 105 return output_storage_;
(...skipping 23 matching lines...) Expand all
129 static inline std::vector<T>& StorageToPluginArg(StorageType& t) { 129 static inline std::vector<T>& StorageToPluginArg(StorageType& t) {
130 return t.output(); 130 return t.output();
131 } 131 }
132 }; 132 };
133 133
134 } // namespace internal 134 } // namespace internal
135 } // namespace ext 135 } // namespace ext
136 } // namespace pp 136 } // namespace pp
137 137
138 #endif // PPAPI_CPP_EXTENSIONS_OUTPUT_TRAITS_H_ 138 #endif // PPAPI_CPP_EXTENSIONS_OUTPUT_TRAITS_H_
OLDNEW
« no previous file with comments | « ppapi/cpp/extensions/dict_field.h ('k') | ppapi/cpp/extensions/from_var_converter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698