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

Side by Side Diff: base/observer_list_unittest.cc

Issue 1101103002: Clean up ObserverList Pointers to use nullptr instad of NULL or 0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Quick Update Created 5 years, 8 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
« no previous file with comments | « base/observer_list_threadsafe.h ('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) 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/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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 static const int kThreadRunTime = 2000; // ms to run the multi-threaded test. 87 static const int kThreadRunTime = 2000; // ms to run the multi-threaded test.
88 88
89 // A thread for use in the ThreadSafeObserver test 89 // A thread for use in the ThreadSafeObserver test
90 // which will add and remove itself from the notification 90 // which will add and remove itself from the notification
91 // list repeatedly. 91 // list repeatedly.
92 class AddRemoveThread : public PlatformThread::Delegate, 92 class AddRemoveThread : public PlatformThread::Delegate,
93 public Foo { 93 public Foo {
94 public: 94 public:
95 AddRemoveThread(ObserverListThreadSafe<Foo>* list, bool notify) 95 AddRemoveThread(ObserverListThreadSafe<Foo>* list, bool notify)
96 : list_(list), 96 : list_(list),
97 loop_(NULL), 97 loop_(nullptr),
98 in_list_(false), 98 in_list_(false),
99 start_(Time::Now()), 99 start_(Time::Now()),
100 count_observes_(0), 100 count_observes_(0),
101 count_addtask_(0), 101 count_addtask_(0),
102 do_notifies_(notify), 102 do_notifies_(notify),
103 weak_factory_(this) { 103 weak_factory_(this) {
104 } 104 }
105 105
106 ~AddRemoveThread() override {} 106 ~AddRemoveThread() override {}
107 107
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 ListDestructor a(observer_list); 534 ListDestructor a(observer_list);
535 observer_list->AddObserver(&a); 535 observer_list->AddObserver(&a);
536 536
537 FOR_EACH_OBSERVER(Foo, *observer_list, Observe(0)); 537 FOR_EACH_OBSERVER(Foo, *observer_list, Observe(0));
538 // If this test fails, there'll be Valgrind errors when this function goes out 538 // If this test fails, there'll be Valgrind errors when this function goes out
539 // of scope. 539 // of scope.
540 } 540 }
541 541
542 } // namespace 542 } // namespace
543 } // namespace base 543 } // namespace base
OLDNEW
« no previous file with comments | « base/observer_list_threadsafe.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698