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

Side by Side Diff: gin/function_template.h

Issue 105423003: gin::Wrappable shouldn't inherit from base::RefCounted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix win 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 | « no previous file | gin/function_template.h.pump » ('j') | no next file with comments »
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.
11 // Use of this source code is governed by a BSD-style license that can be 11 // Use of this source code is governed by a BSD-style license that can be
12 // found in the LICENSE file. 12 // found in the LICENSE file.
13 13
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "gin/arguments.h" 16 #include "gin/arguments.h"
17 #include "gin/converter.h" 17 #include "gin/converter.h"
18 #include "gin/handle.h"
18 #include "gin/public/gin_embedders.h" 19 #include "gin/public/gin_embedders.h"
19 #include "gin/public/wrapper_info.h" 20 #include "gin/public/wrapper_info.h"
20 #include "gin/wrappable.h" 21 #include "gin/wrappable.h"
21 22
22 #include "v8/include/v8.h" 23 #include "v8/include/v8.h"
23 24
24 namespace gin { 25 namespace gin {
25 26
26 class PerIsolateData; 27 class PerIsolateData;
27 28
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 300
300 301
301 // Creates a v8::FunctionTemplate that will run the provided base::Callback each 302 // Creates a v8::FunctionTemplate that will run the provided base::Callback each
302 // time it is called. JavaScript arguments and return values are converted via 303 // time it is called. JavaScript arguments and return values are converted via
303 // gin::Converter. 304 // gin::Converter.
304 template<typename R> 305 template<typename R>
305 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate( 306 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate(
306 v8::Isolate* isolate, 307 v8::Isolate* isolate,
307 const base::Callback<R()> callback) { 308 const base::Callback<R()> callback) {
308 typedef internal::CallbackHolder<R()> HolderT; 309 typedef internal::CallbackHolder<R()> HolderT;
309 scoped_refptr<HolderT> holder(new HolderT(callback)); 310 gin::Handle<HolderT> holder = CreateHandle(isolate, new HolderT(callback));
310 return v8::FunctionTemplate::New( 311 return v8::FunctionTemplate::New(
312 isolate,
311 &internal::DispatchToCallback<R>, 313 &internal::DispatchToCallback<R>,
312 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); 314 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get()));
313 } 315 }
314 316
315 template<typename R, typename P1> 317 template<typename R, typename P1>
316 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate( 318 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate(
317 v8::Isolate* isolate, 319 v8::Isolate* isolate,
318 const base::Callback<R(P1)> callback) { 320 const base::Callback<R(P1)> callback) {
319 typedef internal::CallbackHolder<R(P1)> HolderT; 321 typedef internal::CallbackHolder<R(P1)> HolderT;
320 scoped_refptr<HolderT> holder(new HolderT(callback)); 322 gin::Handle<HolderT> holder = CreateHandle(isolate, new HolderT(callback));
321 return v8::FunctionTemplate::New( 323 return v8::FunctionTemplate::New(
324 isolate,
322 &internal::DispatchToCallback<R, P1>, 325 &internal::DispatchToCallback<R, P1>,
323 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); 326 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get()));
324 } 327 }
325 328
326 template<typename R, typename P1, typename P2> 329 template<typename R, typename P1, typename P2>
327 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate( 330 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate(
328 v8::Isolate* isolate, 331 v8::Isolate* isolate,
329 const base::Callback<R(P1, P2)> callback) { 332 const base::Callback<R(P1, P2)> callback) {
330 typedef internal::CallbackHolder<R(P1, P2)> HolderT; 333 typedef internal::CallbackHolder<R(P1, P2)> HolderT;
331 scoped_refptr<HolderT> holder(new HolderT(callback)); 334 gin::Handle<HolderT> holder = CreateHandle(isolate, new HolderT(callback));
332 return v8::FunctionTemplate::New( 335 return v8::FunctionTemplate::New(
336 isolate,
333 &internal::DispatchToCallback<R, P1, P2>, 337 &internal::DispatchToCallback<R, P1, P2>,
334 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); 338 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get()));
335 } 339 }
336 340
337 template<typename R, typename P1, typename P2, typename P3> 341 template<typename R, typename P1, typename P2, typename P3>
338 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate( 342 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate(
339 v8::Isolate* isolate, 343 v8::Isolate* isolate,
340 const base::Callback<R(P1, P2, P3)> callback) { 344 const base::Callback<R(P1, P2, P3)> callback) {
341 typedef internal::CallbackHolder<R(P1, P2, P3)> HolderT; 345 typedef internal::CallbackHolder<R(P1, P2, P3)> HolderT;
342 scoped_refptr<HolderT> holder(new HolderT(callback)); 346 gin::Handle<HolderT> holder = CreateHandle(isolate, new HolderT(callback));
343 return v8::FunctionTemplate::New( 347 return v8::FunctionTemplate::New(
348 isolate,
344 &internal::DispatchToCallback<R, P1, P2, P3>, 349 &internal::DispatchToCallback<R, P1, P2, P3>,
345 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); 350 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get()));
346 } 351 }
347 352
348 template<typename R, typename P1, typename P2, typename P3, typename P4> 353 template<typename R, typename P1, typename P2, typename P3, typename P4>
349 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate( 354 v8::Local<v8::FunctionTemplate> CreateFunctionTemplate(
350 v8::Isolate* isolate, 355 v8::Isolate* isolate,
351 const base::Callback<R(P1, P2, P3, P4)> callback) { 356 const base::Callback<R(P1, P2, P3, P4)> callback) {
352 typedef internal::CallbackHolder<R(P1, P2, P3, P4)> HolderT; 357 typedef internal::CallbackHolder<R(P1, P2, P3, P4)> HolderT;
353 scoped_refptr<HolderT> holder(new HolderT(callback)); 358 gin::Handle<HolderT> holder = CreateHandle(isolate, new HolderT(callback));
354 return v8::FunctionTemplate::New( 359 return v8::FunctionTemplate::New(
360 isolate,
355 &internal::DispatchToCallback<R, P1, P2, P3, P4>, 361 &internal::DispatchToCallback<R, P1, P2, P3, P4>,
356 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get())); 362 ConvertToV8<internal::CallbackHolderBase*>(isolate, holder.get()));
357 } 363 }
358 364
359 } // namespace gin 365 } // namespace gin
360 366
361 #endif // GIN_FUNCTION_TEMPLATE_H_ 367 #endif // GIN_FUNCTION_TEMPLATE_H_
OLDNEW
« no previous file with comments | « no previous file | gin/function_template.h.pump » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698