summaryrefslogtreecommitdiffstats
path: root/base/observer_list_unittest.cc
Commit message (Collapse)AuthorAgeFilesLines
* base: Update calls froms RunAllPending() to RunUntilIdle().tfarina@chromium.org2012-10-301-11/+11
| | | | | | | | | | | BUG=131220 TEST=base_unittests R=willchan@chromium.org Review URL: https://chromiumcodereview.appspot.com/11339020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164802 0039d316-1c4b-4281-b951-d872f2087c98
* base: Reverse the parameters passed to EXPECT_EQ in ObserverList test.tfarina@chromium.org2012-08-231-13/+13
| | | | | | | | | | The order should be (expected, actual). TBR=willchan@chromium.org Review URL: https://chromiumcodereview.appspot.com/10876012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152976 0039d316-1c4b-4281-b951-d872f2087c98
* base: Fix minor warnings reported by cppcheck.tfarina@chromium.org2012-08-061-1/+2
| | | | | | | | | | | | | | Found with: $ cppcheck --enable=all -j4 --force base 2> base-errors R=jar@chromium.org NOTRY=True Review URL: https://chromiumcodereview.appspot.com/10827112 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150059 0039d316-1c4b-4281-b951-d872f2087c98
* Add virtual and OVERRIDE to base/ implementation filesrsleevi@chromium.org2012-04-061-15/+24
| | | | | | | | | | BUG=none TEST=compiles Review URL: http://codereview.chromium.org/10004001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131098 0039d316-1c4b-4281-b951-d872f2087c98
* Working around a bug in VS2010 Express compiler causing two objects to be ↵alexeypa@chromium.org2012-04-051-1/+4
| | | | | | | | | | | aliased while they clearly should not be. BUG=121960 Review URL: http://codereview.chromium.org/9977012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130963 0039d316-1c4b-4281-b951-d872f2087c98
* Remove MessageLoop::QuitTask() from base.dcheng@chromium.org2011-12-091-1/+1
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/8888021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113875 0039d316-1c4b-4281-b951-d872f2087c98
* Make ObserverListThreadSafe key its observers by PlatformThreadId instead of ↵rsesek@chromium.org2011-11-231-0/+51
| | | | | | | | | | | | | | MessageLoop. This fixes a subtle behavior that drops RemoveObserver operations when the current() loop is NULL. Now those operations will always succeed. BUG=104826 TEST=base_unittests Review URL: http://codereview.chromium.org/8635002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111404 0039d316-1c4b-4281-b951-d872f2087c98
* base::Bind: Cleanup in base/observer_list*.jhawkins@chromium.org2011-10-121-8/+10
| | | | | | | | | | | BUG=none TEST=none R=csilv@chromium.org Review URL: http://codereview.chromium.org/8229035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105148 0039d316-1c4b-4281-b951-d872f2087c98
* Use MessageLoopProxy instead of MessageLoop to dispatch notifications in ↵adamk@chromium.org2011-08-091-6/+41
| | | | | | | | | | | | | | | ObserverListThreadsafe. This is nearly identical to the reverted r96013, with the modification that std::map::insert isn't used. Its invocation was complex (such that it worked in some compilers but not in others) and the performance gain is negligible in any use case I've seen in Chromium. BUG=91589 Review URL: http://codereview.chromium.org/7604006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96076 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 96013 - Use MessageLoopProxy instead of MessageLoop to dispatch ↵adamk@chromium.org2011-08-091-41/+6
| | | | | | | | | | | | | notifications in ObserverListThreadsafe. BUG=91589 Review URL: http://codereview.chromium.org/7584016 TBR=adamk@chromium.org Review URL: http://codereview.chromium.org/7605002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96024 0039d316-1c4b-4281-b951-d872f2087c98
* Use MessageLoopProxy instead of MessageLoop to dispatch notifications in ↵adamk@chromium.org2011-08-091-6/+41
| | | | | | | | | | ObserverListThreadsafe. BUG=91589 Review URL: http://codereview.chromium.org/7584016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96013 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 88284 - Revert 88151 (see crbug.com/85296) - Fix user-after-free ↵akalin@chromium.org2011-06-091-0/+23
| | | | | | | | | | | | | | | | | error with ObserverList. The problem is that if an ObserverListBase::Iterator is on the stack and one of the observers deletes the object holding the list, Iterator's destructor will use the deleted list. Relanding 88151 now that sync fixes (88483, 88472) are in. BUG=84919 Review URL: http://codereview.chromium.org/7127001 TBR=jam@chromium.org Review URL: http://codereview.chromium.org/7134008 TBR=thakis@chromium.org Review URL: http://codereview.chromium.org/7129036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88484 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 88151 (see crbug.com/85296) - Fix user-after-free error with ↵thakis@chromium.org2011-06-081-23/+0
| | | | | | | | | | | | ObserverList. The problem is that if an ObserverListBase::Iterator is on the stack and one of the observers deletes the object holding the list, Iterator's destructor will use the deleted list. BUG=84919 Review URL: http://codereview.chromium.org/7127001 TBR=jam@chromium.org Review URL: http://codereview.chromium.org/7134008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88284 0039d316-1c4b-4281-b951-d872f2087c98
* Fix user-after-free error with ObserverList. The problem is that if an ↵jam@chromium.org2011-06-071-0/+23
| | | | | | | | | ObserverListBase::Iterator is on the stack and one of the observers deletes the object holding the list, Iterator's destructor will use the deleted list. BUG=84919 Review URL: http://codereview.chromium.org/7127001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88151 0039d316-1c4b-4281-b951-d872f2087c98
* Fix bug in ObserverListThreadsafe::RemoveObserverakalin@chromium.org2011-06-051-1/+34
| | | | | | | | | | | | | | | | | | Like ObserverList, ObserverListThreadSafe::RemoveObserver should do nothing if the observer isn't in the list. Instead, it causes weird bugs if the list has 0 or 1 existing elements. Add comments clarifying semantics of AddObserver/RemoveObserver. Change AddObserver to do nothing in release mode if it tries to add an existing observer. BUG=84922 TEST= Review URL: http://codereview.chromium.org/7024037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87944 0039d316-1c4b-4281-b951-d872f2087c98
* Move some files from base to base/memory.levin@chromium.org2011-03-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | raw_scoped_refptr_mismatch_checker.h ref_counted.cc ref_counted.h ref_counted_memory.cc ref_counted_memory.h ref_counted_unittest.cc scoped_callback_factory.h scoped_comptr_win.h scoped_handle.h scoped_native_library.cc scoped_native_library.h scoped_native_library_unittest.cc scoped_nsobject.h scoped_open_process.h scoped_ptr.h scoped_ptr_unittest.cc scoped_temp_dir.cc scoped_temp_dir.h scoped_temp_dir_unittest.cc scoped_vector.h singleton.h singleton_objc.h singleton_unittest.cc linked_ptr.h linked_ptr_unittest.cc weak_ptr.cc weak_ptr.h weak_ptr_unittest.cc BUG=None TEST=Compile Review URL: http://codereview.chromium.org/6714032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79524 0039d316-1c4b-4281-b951-d872f2087c98
* Move platform_thread to base/threading and put in the base namespace. I left abrettw@chromium.org2010-12-311-5/+3
| | | | | | | | | | | stub and "using" declarations in the old location to avoid having to change the entire project at once. TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/6001010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70342 0039d316-1c4b-4281-b951-d872f2087c98
* Reland r62959 without the changes to histogram.cc, in hopes it won't break ↵pkasting@chromium.org2010-10-191-2/+2
| | | | | | | | | | | | | | | | | | tab_switching_test, and without the changes to tools_sanity_unittest.cc, which have already been relanded separately. TBR=timsteele Original changelog message: Convert LOG(INFO) to VLOG(1) - base/. Also removes an "else" after "return" and aligns "<<" per style guide. BUG=none TEST=none Review URL: http://codereview.chromium.org/3850007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63009 0039d316-1c4b-4281-b951-d872f2087c98
* ** Think this may have caused TabSwitchingTest to fail, as it is parsing log ↵tim@chromium.org2010-10-181-2/+2
| | | | | | | | | | | | | | | | | files. ** Revert 62959 - Convert LOG(INFO) to VLOG(1) - base/. Also removes an "else" after "return" and aligns "<<" per style guide. BUG=none TEST=none Review URL: http://codereview.chromium.org/3845002 TBR=pkasting@chromium.org Review URL: http://codereview.chromium.org/3850006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62981 0039d316-1c4b-4281-b951-d872f2087c98
* Convert LOG(INFO) to VLOG(1) - base/.pkasting@chromium.org2010-10-181-2/+2
| | | | | | | | | | Also removes an "else" after "return" and aligns "<<" per style guide. BUG=none TEST=none Review URL: http://codereview.chromium.org/3845002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62959 0039d316-1c4b-4281-b951-d872f2087c98
* Fix removal of multiple observers in ObserverListThreadSafe.willchan@chromium.org2010-09-171-1/+44
| | | | | | | | | BUG=55725 TEST=ObserverListThreadSafeTest.RemoveMultipleObservers Review URL: http://codereview.chromium.org/3381009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59833 0039d316-1c4b-4281-b951-d872f2087c98
* Reland 39942 - Switch NetworkChangeNotifier implementations to use ObserverList.willchan@chromium.org2010-02-251-2/+47
| | | | | | | | | Fixed build problem with database_tracker.(cc|h). BUG=36590 Review URL: http://codereview.chromium.org/660039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39983 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 39942 - Switch NetworkChangeNotifier implementations to use ObserverList.willchan@chromium.org2010-02-241-47/+2
| | | | | | | | | | | | | Fix up observer list so we can use FOR_EACH_OBSERVER when check_empty is set. Clean up the ObserverList API a bit, replacing GetElementAt() with HasObserver() and Clear(). BUG=36590 Review URL: http://codereview.chromium.org/652205 TBR=willchan@chromium.org Review URL: http://codereview.chromium.org/661029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39945 0039d316-1c4b-4281-b951-d872f2087c98
* Switch NetworkChangeNotifier implementations to use ObserverList.willchan@chromium.org2010-02-241-2/+47
| | | | | | | | | | Fix up observer list so we can use FOR_EACH_OBSERVER when check_empty is set. Clean up the ObserverList API a bit, replacing GetElementAt() with HasObserver() and Clear(). BUG=36590 Review URL: http://codereview.chromium.org/652205 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39942 0039d316-1c4b-4281-b951-d872f2087c98
* Fix up some style guide violations wrt aligning function arguments.willchan@chromium.org2010-02-121-2/+2
| | | | | | Review URL: http://codereview.chromium.org/593084 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38951 0039d316-1c4b-4281-b951-d872f2087c98
* Style cleanup in preparation for auto-linting base/.erg@google.com2010-01-261-1/+1
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/552004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37164 0039d316-1c4b-4281-b951-d872f2087c98
* Improve the run time of base_unittests by about 20s by reducing timeouts inphajdan.jr@chromium.org2009-11-051-1/+1
| | | | | | | | | | | | | | | | the following tests: ObserverListThreadSafeTest.CrossThreadObserver ObserverListThreadSafeTest.CrossThreadNotifications ThreadCollisionTest.MTSynchedScopedBookCriticalSectionTest ThreadCollisionTest.MTSynchedScopedRecursiveBookCriticalSectionTest TEST=Covered by base_unittests. BUG=none Review URL: http://codereview.chromium.org/369001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31112 0039d316-1c4b-4281-b951-d872f2087c98
* NO CODE CHANGE (except one global std::wstring changed to const wchar_t* ↵maruel@chromium.org2009-03-031-2/+3
| | | | | | | | | | | const per style compliance). Preliminary work to enforce new PRESUBMIT.py rules: - <=80 cols - no trailing whitespaces - svn:eol-style=LF git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10791 0039d316-1c4b-4281-b951-d872f2087c98
* Fix some leaks in observer_list_unittesterikkay@google.com2009-01-051-1/+2
| | | | | | Review URL: http://codereview.chromium.org/16505 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7551 0039d316-1c4b-4281-b951-d872f2087c98
* Adds the ability for ObserverList to not notify observers added duringsky@google.com2008-10-311-0/+40
| | | | | | | | | | | | | notification. I need this for bookmarks. If a new observer is added while the bookmark model is in the process of sending out notification the newly added observer gets confused. BUG=674 TEST=none Review URL: http://codereview.chromium.org/8919 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4267 0039d316-1c4b-4281-b951-d872f2087c98
* Move Time, TimeDelta and TimeTicks into namespace base.dsh@google.com2008-10-271-0/+2
| | | | | | Review URL: http://codereview.chromium.org/7995 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4022 0039d316-1c4b-4281-b951-d872f2087c98
* Create a thread-safe observer list. Will be usedmbelshe@google.com2008-10-221-6/+201
| | | | | | | | | by SystemMonitor. Right now the class requires that Observers be RefCounted<>. This is because we invoke tasks via NewRunnableMethod for them. However, because we manually track lifecycle via AddObserver/RemoveObserver, we could override the RunnableMethodTraits to not require RefCounted<>. This would have the advantage that callers do not need to make all Observers be RefCounted, but makes it more critical that observers not forget to call RemoveObserver(). Review URL: http://codereview.chromium.org/7353 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3787 0039d316-1c4b-4281-b951-d872f2087c98
* Use a more compact license header in source files.license.bot2008-08-241-28/+4
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1287 0039d316-1c4b-4281-b951-d872f2087c98
* Add observer_list_unittest.cc to base test target. Fix gcc warnings with ↵pinkerton@google.com2008-08-081-1/+4
| | | | | | virtual methods w/ non-virtual dtor and members being initialized in the init-list in the wrong order. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@569 0039d316-1c4b-4281-b951-d872f2087c98
* Add base to the repository.initial.commit2008-07-261-0/+88
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8 0039d316-1c4b-4281-b951-d872f2087c98