diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-16 22:35:14 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-16 22:35:14 +0000 |
commit | 935405891d4f2cb40c4fe287e3e4c06ade5c38ce (patch) | |
tree | d71dd33fe46eeddb200d92dda1d02c9c0b8a7c10 /base/callback.h.pump | |
parent | 409dc6ef2d6095d71f6ea4f59b07106b91626d24 (diff) | |
download | chromium_src-935405891d4f2cb40c4fe287e3e4c06ade5c38ce.zip chromium_src-935405891d4f2cb40c4fe287e3e4c06ade5c38ce.tar.gz chromium_src-935405891d4f2cb40c4fe287e3e4c06ade5c38ce.tar.bz2 |
Support binding WeakPtr<> to methods with void return types.
This should give functionality similar to ScopedRunnableMethodFactory.
Note that binding a WeakPtr only make sense with methods with void return types. If the return type is not void, then it is unclear what the function should return when the pointer is invalidated.
This code adds a compile time assert to check the return type.
BUG=35223
TEST=unittests
Review URL: http://codereview.chromium.org/7015064
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85549 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/callback.h.pump')
-rw-r--r-- | base/callback.h.pump | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/base/callback.h.pump b/base/callback.h.pump index b565e38..cc45dd7 100644 --- a/base/callback.h.pump +++ b/base/callback.h.pump @@ -47,12 +47,12 @@ $var MAX_ARITY = 6 // // /* Binding a normal function. */ // int Return5() { return 5; } -// base::Callback<int(int)> func_cb = base::Bind(&Return5); -// LOG(INFO) << func_cb.Run(5); // Prints 5. +// base::Callback<int(void)> func_cb = base::Bind(&Return5); +// LOG(INFO) << func_cb.Run(); // Prints 5. // // void PrintHi() { LOG(INFO) << "hi."; } // base::Closure void_func_cb = base::Bind(&PrintHi); -// LOG(INFO) << void_func_cb.Run(); // Prints: hi. +// void_func_cb.Run(); // Prints: hi. // // /* Binding a class method. */ // class Ref : public RefCountedThreadSafe<Ref> { @@ -191,7 +191,7 @@ $var MAX_ARITY = 6 // // These are not features that are required in Chromium. Some of them, such as // allowing for reference parameters, and subtyping of functions, may actually -// because a source of errors. Removing support for these features actually +// become a source of errors. Removing support for these features actually // allows for a simpler implementation, and a terser Currying API. // // |