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

Side by Side Diff: base/callback_unittest.cc

Issue 11419224: Add missing (and remove superfluous) 'explicit' from constructors. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + remove non-straightforward changes Created 7 years, 11 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/bind_unittest.cc ('k') | base/containers/small_map_unittest.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/callback.h" 6 #include "base/callback.h"
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/callback_internal.h" 8 #include "base/callback_internal.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 TestForReentrancy tfr; 141 TestForReentrancy tfr;
142 ASSERT_FALSE(tfr.cb.is_null()); 142 ASSERT_FALSE(tfr.cb.is_null());
143 ASSERT_FALSE(tfr.cb_already_run); 143 ASSERT_FALSE(tfr.cb_already_run);
144 ResetAndReturn(&tfr.cb).Run(); 144 ResetAndReturn(&tfr.cb).Run();
145 ASSERT_TRUE(tfr.cb.is_null()); 145 ASSERT_TRUE(tfr.cb.is_null());
146 ASSERT_TRUE(tfr.cb_already_run); 146 ASSERT_TRUE(tfr.cb_already_run);
147 } 147 }
148 148
149 class CallbackOwner : public base::RefCounted<CallbackOwner> { 149 class CallbackOwner : public base::RefCounted<CallbackOwner> {
150 public: 150 public:
151 CallbackOwner(bool* deleted) { 151 explicit CallbackOwner(bool* deleted) {
152 callback_ = Bind(&CallbackOwner::Unused, this); 152 callback_ = Bind(&CallbackOwner::Unused, this);
153 deleted_ = deleted; 153 deleted_ = deleted;
154 } 154 }
155 void Reset() { 155 void Reset() {
156 callback_.Reset(); 156 callback_.Reset();
157 // We are deleted here if no-one else had a ref to us. 157 // We are deleted here if no-one else had a ref to us.
158 } 158 }
159 159
160 private: 160 private:
161 friend class base::RefCounted<CallbackOwner>; 161 friend class base::RefCounted<CallbackOwner>;
(...skipping 10 matching lines...) Expand all
172 172
173 TEST_F(CallbackTest, CallbackHasLastRefOnContainingObject) { 173 TEST_F(CallbackTest, CallbackHasLastRefOnContainingObject) {
174 bool deleted = false; 174 bool deleted = false;
175 CallbackOwner* owner = new CallbackOwner(&deleted); 175 CallbackOwner* owner = new CallbackOwner(&deleted);
176 owner->Reset(); 176 owner->Reset();
177 ASSERT_TRUE(deleted); 177 ASSERT_TRUE(deleted);
178 } 178 }
179 179
180 } // namespace 180 } // namespace
181 } // namespace base 181 } // namespace base
OLDNEW
« no previous file with comments | « base/bind_unittest.cc ('k') | base/containers/small_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698