OLD | NEW |
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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 delete obj; | 543 delete obj; |
544 } | 544 } |
545 | 545 |
546 // ScopedClosureRunner is akin to scoped_ptr for Closures. It ensures that the | 546 // ScopedClosureRunner is akin to scoped_ptr for Closures. It ensures that the |
547 // Closure is executed and deleted no matter how the current scope exits. | 547 // Closure is executed and deleted no matter how the current scope exits. |
548 class BASE_EXPORT ScopedClosureRunner { | 548 class BASE_EXPORT ScopedClosureRunner { |
549 public: | 549 public: |
550 explicit ScopedClosureRunner(const Closure& closure); | 550 explicit ScopedClosureRunner(const Closure& closure); |
551 ~ScopedClosureRunner(); | 551 ~ScopedClosureRunner(); |
552 | 552 |
| 553 void Reset(const Closure& closure); |
553 Closure Release(); | 554 Closure Release(); |
554 | 555 |
555 private: | 556 private: |
556 Closure closure_; | 557 Closure closure_; |
557 | 558 |
558 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedClosureRunner); | 559 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedClosureRunner); |
559 }; | 560 }; |
560 | 561 |
561 } // namespace base | 562 } // namespace base |
562 | 563 |
563 #endif // BASE_BIND_HELPERS_H_ | 564 #endif // BASE_BIND_HELPERS_H_ |
OLD | NEW |