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

Side by Side Diff: gin/function_template.h

Issue 120043008: Add a simple one shot and repeating timer API for Mojo.js. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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/arguments.h ('k') | gin/gin.gyp » ('j') | gin/runner.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // This file was GENERATED by command: 1 // This file was GENERATED by command:
2 // pump.py function_template.h.pump 2 // pump.py function_template.h.pump
3 // DO NOT EDIT BY HAND!!! 3 // DO NOT EDIT BY HAND!!!
4 4
5 5
6 6
7 #ifndef GIN_FUNCTION_TEMPLATE_H_ 7 #ifndef GIN_FUNCTION_TEMPLATE_H_
8 #define GIN_FUNCTION_TEMPLATE_H_ 8 #define GIN_FUNCTION_TEMPLATE_H_
9 9
10 // Copyright 2013 The Chromium Authors. All rights reserved. 10 // Copyright 2013 The Chromium Authors. All rights reserved.
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 const P1& a1) { 172 const P1& a1) {
173 callback.Run(a1); 173 callback.Run(a1);
174 } 174 }
175 }; 175 };
176 176
177 template<typename R> 177 template<typename R>
178 struct Invoker<R, void, void, void, void> { 178 struct Invoker<R, void, void, void, void> {
179 inline static void Go( 179 inline static void Go(
180 Arguments* args, 180 Arguments* args,
181 const base::Callback<R()>& callback) { 181 const base::Callback<R()>& callback) {
182 args->Return(callback.Run()); 182 R r = callback.Run();
183 LOG(ERROR) << "Setting return value to: " << r;
184 args->Return(r);
183 } 185 }
184 }; 186 };
185 template<> 187 template<>
186 struct Invoker<void, void, void, void, void> { 188 struct Invoker<void, void, void, void, void> {
187 inline static void Go( 189 inline static void Go(
188 Arguments* args, 190 Arguments* args,
189 const base::Callback<void()>& callback) { 191 const base::Callback<void()>& callback) {
190 callback.Run(); 192 callback.Run();
191 } 193 }
192 }; 194 };
(...skipping 10 matching lines...) Expand all
203 } 205 }
204 206
205 // For advanced use cases, we allow callers to request the unparsed Arguments 207 // For advanced use cases, we allow callers to request the unparsed Arguments
206 // object and poke around in it directly. 208 // object and poke around in it directly.
207 inline bool GetNextArgument(Arguments* args, int create_flags, bool is_first, 209 inline bool GetNextArgument(Arguments* args, int create_flags, bool is_first,
208 Arguments* result) { 210 Arguments* result) {
209 *result = *args; 211 *result = *args;
210 return true; 212 return true;
211 } 213 }
212 214
215 // It's common for clients to just need the isolate, so we make that easy.
216 inline bool GetNextArgument(Arguments* args, int create_flags,
217 bool is_first, v8::Isolate** result) {
218 *result = args->isolate();
219 return true;
220 }
221
213 222
214 // DispatchToCallback converts all the JavaScript arguments to C++ types and 223 // DispatchToCallback converts all the JavaScript arguments to C++ types and
215 // invokes the base::Callback. 224 // invokes the base::Callback.
216 template<typename Sig> 225 template<typename Sig>
217 struct Dispatcher { 226 struct Dispatcher {
218 }; 227 };
219 228
220 template<typename R> 229 template<typename R>
221 struct Dispatcher<R()> { 230 struct Dispatcher<R()> {
222 static void DispatchToCallback( 231 static void DispatchToCallback(
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 isolate, new HolderT(callback, callback_flags)); 353 isolate, new HolderT(callback, callback_flags));
345 return v8::FunctionTemplate::New( 354 return v8::FunctionTemplate::New(
346 isolate, 355 isolate,
347 &internal::Dispatcher<Sig>::DispatchToCallback, 356 &internal::Dispatcher<Sig>::DispatchToCallback,
348 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); 357 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get()));
349 } 358 }
350 359
351 } // namespace gin 360 } // namespace gin
352 361
353 #endif // GIN_FUNCTION_TEMPLATE_H_ 362 #endif // GIN_FUNCTION_TEMPLATE_H_
OLDNEW
« no previous file with comments | « gin/arguments.h ('k') | gin/gin.gyp » ('j') | gin/runner.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698