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

Side by Side Diff: base/observer_list_unittest.cc

Issue 8888021: Remove MessageLoop::QuitTask() from base. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: *sigh* 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
« no previous file with comments | « base/message_pump_glib_unittest.cc ('k') | no next file » | 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 #include "base/observer_list.h" 5 #include "base/observer_list.h"
6 #include "base/observer_list_threadsafe.h" 6 #include "base/observer_list_threadsafe.h"
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 if (do_notifies_) { 135 if (do_notifies_) {
136 list_->Notify(&Foo::Observe, 10); 136 list_->Notify(&Foo::Observe, 10);
137 } 137 }
138 138
139 loop_->PostTask( 139 loop_->PostTask(
140 FROM_HERE, 140 FROM_HERE,
141 base::Bind(&AddRemoveThread::AddTask, weak_factory_.GetWeakPtr())); 141 base::Bind(&AddRemoveThread::AddTask, weak_factory_.GetWeakPtr()));
142 } 142 }
143 143
144 void Quit() { 144 void Quit() {
145 loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask()); 145 loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure());
146 } 146 }
147 147
148 virtual void Observe(int x) { 148 virtual void Observe(int x) {
149 count_observes_++; 149 count_observes_++;
150 150
151 // If we're getting called after we removed ourselves from 151 // If we're getting called after we removed ourselves from
152 // the list, that is very bad! 152 // the list, that is very bad!
153 DCHECK(in_list_); 153 DCHECK(in_list_);
154 154
155 // This callback should fire on the appropriate thread 155 // This callback should fire on the appropriate thread
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 ObserverList<Foo>* observer_list = new ObserverList<Foo>; 527 ObserverList<Foo>* observer_list = new ObserverList<Foo>;
528 ListDestructor a(observer_list); 528 ListDestructor a(observer_list);
529 observer_list->AddObserver(&a); 529 observer_list->AddObserver(&a);
530 530
531 FOR_EACH_OBSERVER(Foo, *observer_list, Observe(0)); 531 FOR_EACH_OBSERVER(Foo, *observer_list, Observe(0));
532 // If this test fails, there'll be Valgrind errors when this function goes out 532 // If this test fails, there'll be Valgrind errors when this function goes out
533 // of scope. 533 // of scope.
534 } 534 }
535 535
536 } // namespace 536 } // namespace
OLDNEW
« no previous file with comments | « base/message_pump_glib_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698