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

Side by Side Diff: base/bind.h.pump

Issue 8728010: Increase Bind/Callback Arity from 6 -> 7. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated comments. Created 9 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
OLDNEW
1 $$ This is a pump file for generating file templates. Pump is a python 1 $$ This is a pump file for generating file templates. Pump is a python
2 $$ script that is part of the Google Test suite of utilities. Description 2 $$ script that is part of the Google Test suite of utilities. Description
3 $$ can be found here: 3 $$ can be found here:
4 $$ 4 $$
5 $$ http://code.google.com/p/googletest/wiki/PumpManual 5 $$ http://code.google.com/p/googletest/wiki/PumpManual
6 $$ 6 $$
7 7
8 $var MAX_ARITY = 6 8 $$
9 $$ MAX_ARITY controls the number of arguments that Bind() supports.
10 $$ The amount of code, and more importantly, the number of template types
11 $$ generated by pump grows at O(MAX_ARITY^2).
12 $$
13 $$ We tried going to 11 and found it imposed an extra 10 penalty on windows
14 $$ cycle times compared to our original baseline of 6.
15 $$
16 $$ Currently 7 is chosen as a compromise between supporting a convenient
17 $$ number of arguments and keeping compile times low. At 7, we have 115
18 $$ templates being generated by pump.
19 $$
20 $$ Be careful when adjusting this number. If people find a need to bind
21 $$ a larger number of arguments, consider refactoring the function to use
22 $$ a param struct instead of raising the MAX_ARITY.
23 $$
24 $$ See http://crbug.com/98542 for more context.
25 $$
26 $var MAX_ARITY = 7
9 27
10 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 28 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
11 // Use of this source code is governed by a BSD-style license that can be 29 // Use of this source code is governed by a BSD-style license that can be
12 // found in the LICENSE file. 30 // found in the LICENSE file.
13 31
14 #ifndef BASE_BIND_H_ 32 #ifndef BASE_BIND_H_
15 #define BASE_BIND_H_ 33 #define BASE_BIND_H_
16 #pragma once 34 #pragma once
17 35
18 #include "base/bind_internal.h" 36 #include "base/bind_internal.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 void($for ARG , [[typename internal::CallbackParamTraits<P$(ARG)>::StorageType]] )>( 131 void($for ARG , [[typename internal::CallbackParamTraits<P$(ARG)>::StorageType]] )>(
114 internal::MakeRunnable(functor)[[]] 132 internal::MakeRunnable(functor)[[]]
115 $if ARITY > 0 [[, ]] $for ARG , [[p$(ARG)]])); 133 $if ARITY > 0 [[, ]] $for ARG , [[p$(ARG)]]));
116 } 134 }
117 135
118 ]] $$ for ARITY 136 ]] $$ for ARITY
119 137
120 } // namespace base 138 } // namespace base
121 139
122 #endif // BASE_BIND_H_ 140 #endif // BASE_BIND_H_
OLDNEW
« no previous file with comments | « base/bind.h ('k') | base/bind_internal.h » ('j') | base/bind_internal.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698