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

Side by Side Diff: base/bind_helpers.h

Issue 369703003: Reduce usage of MessageLoopProxy in base/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 2 months 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 | « base/base.gypi ('k') | base/debug/trace_event_impl.h » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This defines a set of argument wrappers and related factory methods that 5 // This defines a set of argument wrappers and related factory methods that
6 // can be used specify the refcounting and reference semantics of arguments 6 // can be used specify the refcounting and reference semantics of arguments
7 // that are bound by the Bind() function in base/bind.h. 7 // that are bound by the Bind() function in base/bind.h.
8 // 8 //
9 // It also defines a set of simple functions and utilities that people want 9 // It also defines a set of simple functions and utilities that people want
10 // when using Callback<> and Bind(). 10 // when using Callback<> and Bind().
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // cb = Bind(&TakesOwnership, Passed(CreateFoo())); 122 // cb = Bind(&TakesOwnership, Passed(CreateFoo()));
123 // 123 //
124 // // |arg| in TakesOwnership() is given ownership of Foo(). |cb| 124 // // |arg| in TakesOwnership() is given ownership of Foo(). |cb|
125 // // no longer owns Foo() and, if reset, would not delete Foo(). 125 // // no longer owns Foo() and, if reset, would not delete Foo().
126 // cb.Run(); // Foo() is now transferred to |arg| and deleted. 126 // cb.Run(); // Foo() is now transferred to |arg| and deleted.
127 // cb.Run(); // This CHECK()s since Foo() already been used once. 127 // cb.Run(); // This CHECK()s since Foo() already been used once.
128 // 128 //
129 // Passed() is particularly useful with PostTask() when you are transferring 129 // Passed() is particularly useful with PostTask() when you are transferring
130 // ownership of an argument into a task, but don't necessarily know if the 130 // ownership of an argument into a task, but don't necessarily know if the
131 // task will always be executed. This can happen if the task is cancellable 131 // task will always be executed. This can happen if the task is cancellable
132 // or if it is posted to a MessageLoopProxy. 132 // or if it is posted to a TaskRunner.
133 // 133 //
134 // 134 //
135 // SIMPLE FUNCTIONS AND UTILITIES. 135 // SIMPLE FUNCTIONS AND UTILITIES.
136 // 136 //
137 // DoNothing() - Useful for creating a Closure that does nothing when called. 137 // DoNothing() - Useful for creating a Closure that does nothing when called.
138 // DeletePointer<T>() - Useful for creating a Closure that will delete a 138 // DeletePointer<T>() - Useful for creating a Closure that will delete a
139 // pointer when invoked. Only use this when necessary. 139 // pointer when invoked. Only use this when necessary.
140 // In most cases MessageLoop::DeleteSoon() is a better 140 // In most cases MessageLoop::DeleteSoon() is a better
141 // fit. 141 // fit.
142 142
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 BASE_EXPORT void DoNothing(); 535 BASE_EXPORT void DoNothing();
536 536
537 template<typename T> 537 template<typename T>
538 void DeletePointer(T* obj) { 538 void DeletePointer(T* obj) {
539 delete obj; 539 delete obj;
540 } 540 }
541 541
542 } // namespace base 542 } // namespace base
543 543
544 #endif // BASE_BIND_HELPERS_H_ 544 #endif // BASE_BIND_HELPERS_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/debug/trace_event_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698