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

Side by Side Diff: gin/converter.h

Issue 62333018: Implement Asynchronous Module Definition API for Mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Aaron's comments Created 7 years, 1 month 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 | « gin/context_holder.cc ('k') | gin/converter.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 GIN_CONVERTER_H_ 5 #ifndef GIN_CONVERTER_H_
6 #define GIN_CONVERTER_H_ 6 #define GIN_CONVERTER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 }; 80 };
81 81
82 template<> 82 template<>
83 struct Converter<v8::Handle<v8::Object> > { 83 struct Converter<v8::Handle<v8::Object> > {
84 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, 84 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
85 v8::Handle<v8::Object> val); 85 v8::Handle<v8::Object> val);
86 static bool FromV8(v8::Handle<v8::Value> val, 86 static bool FromV8(v8::Handle<v8::Value> val,
87 v8::Handle<v8::Object>* out); 87 v8::Handle<v8::Object>* out);
88 }; 88 };
89 89
90 template<>
91 struct Converter<v8::Handle<v8::External> > {
92 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
93 v8::Handle<v8::External> val);
94 static bool FromV8(v8::Handle<v8::Value> val,
95 v8::Handle<v8::External>* out);
96 };
97
98 template<>
99 struct Converter<v8::Handle<v8::Value> > {
100 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
101 v8::Handle<v8::Value> val);
102 static bool FromV8(v8::Handle<v8::Value> val,
103 v8::Handle<v8::Value>* out);
104 };
105
90 template<typename T> 106 template<typename T>
91 struct Converter<std::vector<T> > { 107 struct Converter<std::vector<T> > {
92 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate, 108 static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
93 const std::vector<T>& val) { 109 const std::vector<T>& val) {
94 v8::Handle<v8::Array> result(v8::Array::New(static_cast<int>(val.size()))); 110 v8::Handle<v8::Array> result(v8::Array::New(static_cast<int>(val.size())));
95 for (size_t i = 0; i < val.size(); ++i) { 111 for (size_t i = 0; i < val.size(); ++i) {
96 result->Set(static_cast<int>(i), Converter<T>::ToV8(isolate, val[i])); 112 result->Set(static_cast<int>(i), Converter<T>::ToV8(isolate, val[i]));
97 } 113 }
98 return result; 114 return result;
99 } 115 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 const std::string& val); 150 const std::string& val);
135 151
136 template<typename T> 152 template<typename T>
137 bool ConvertFromV8(v8::Handle<v8::Value> input, T* result) { 153 bool ConvertFromV8(v8::Handle<v8::Value> input, T* result) {
138 return Converter<T>::FromV8(input, result); 154 return Converter<T>::FromV8(input, result);
139 } 155 }
140 156
141 } // namespace gin 157 } // namespace gin
142 158
143 #endif // GIN_CONVERTER_H_ 159 #endif // GIN_CONVERTER_H_
OLDNEW
« no previous file with comments | « gin/context_holder.cc ('k') | gin/converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698