summaryrefslogtreecommitdiffstats
path: root/base/ref_counted.h
Commit message (Collapse)AuthorAgeFilesLines
* Forces T*s to scoped_refptr<T> when PostTask()ing to a function expecting ↵jamesr@chromium.org2009-11-201-0/+18
| | | | | | | | scoped_refptr<T> Review URL: http://codereview.chromium.org/418007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32706 0039d316-1c4b-4281-b951-d872f2087c98
* First patch in making destructors of refcounted objects private.jam@chromium.org2009-11-051-2/+7
| | | | | | | BUG=26749 Review URL: http://codereview.chromium.org/360042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31136 0039d316-1c4b-4281-b951-d872f2087c98
* Add the ability for objects which derive from RefCountedThreadSafe to ↵jam@chromium.org2009-11-021-3/+26
| | | | | | | | | | | | specify a destructor trait. This allows browser objects to specify which thread they're terminated on. The benefit is we avoid the need to do manual ref counting when an object posts tasks to itself on different threads, if an object must be destructed on a specific thread. This patch adds initial support and only shows one example with ResourceMessageFilter. I will do the rest in a follow-up patch to keep things small. BUG=25354 TEST=added unit tests Review URL: http://codereview.chromium.org/338065 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30688 0039d316-1c4b-4281-b951-d872f2087c98
* First fix to minimize copying of image data.erg@google.com2009-10-191-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is the first of multiple patches that clean up handling of memory regarding images. Previously, the code did several memcpy()s or equivalents. This change: - Creates an abstract interface RefCountedMemory which provides access to the front() of a memory range and the size() of it. It is a RefCountedThreadSafe. - Adds a RefCountedStaticMemory class which isa RefCountedMemory. - Pushes RefCountedBytes up into base/ from chrome/ and make it conform to RefCountedMemory. - Have ResourceBundle return RefCountedStaticMemory to the mmaped() or DLL loaded resources instead of memcpy()ing them. - General cleanups to minimize copies in constructing RefCountedBytes. - Use the above consistent interface in the BrowserThemeProvider, along with special casing the loading of the new tab page background. This patch is mostly cleanups and there should only be a slight performance gain if any. Most of the real speedups should come in subsequent patches. BUG=http://crbug.com/24493 TEST=Slightly faster on Perf bot; does not introduce crashes. Review URL: http://codereview.chromium.org/288005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29412 0039d316-1c4b-4281-b951-d872f2087c98
* Reverting 27389.darin@chromium.org2009-09-301-0/+4
| | | | | | Review URL: http://codereview.chromium.org/246027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27594 0039d316-1c4b-4281-b951-d872f2087c98
* Reverting 27379, in hopes of fixing browser_tests.senorblanco@chromium.org2009-09-281-4/+0
| | | | | | | | TBR=darin Review URL: http://codereview.chromium.org/248021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27389 0039d316-1c4b-4281-b951-d872f2087c98
* Assert that thread-safe reference counting is used withdarin@chromium.org2009-09-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | cross-thread NewRunnableMethod. This assertion caught such an error in VisitedLinkMaster! My approach, modify RunnableMethodTraits<T> to assert that when ReleaseCallee happens on a different thread from RetainCallee that the type supports thread-safe reference counting. I do this by adding a static method to both RefCounted<T> and RefCountedThreadSafe<T>. This results in a little ugliness in cases where people implement AddRef and Release by hand (to make the no-ops). There may be a nicer way to deal with those few cases. R=brettw BUG=none TEST=none Review URL: http://codereview.chromium.org/251012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27379 0039d316-1c4b-4281-b951-d872f2087c98
* Implement ScopedRunnableMethodFactory using WeakPtr.darin@chromium.org2009-09-251-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This required some changes to WeakPtr to support the addition of WeakPtrFactory::HasWeakPtrs(), which is used to implement ScopedRunnableMethodFactory::empty(). Now, the WeakReferenceOwner just holds a pointer to the Flag class, and the Flag holds a back-pointer that it can use to clear the WeakReferenceOwner's pointer when the Flag is destroyed. I use the null'ness of this back-pointer in place of the bool member that was previously used to indicate if the WeakReference is valid. It was also necessary to expose a HasOneRef method on RefCounted. I included one on RefCountedThreadSafe for completeness. Finally, I switched HttpCache over to using WeakPtr instead of RevocableStore so that I could delete RevocableStore. (I'm making this change to consolidate similar functionality.) R=abarth BUG=none TEST=none Review URL: http://codereview.chromium.org/235027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27287 0039d316-1c4b-4281-b951-d872f2087c98
* Cross-process Message Port implementation.jam@chromium.org2009-08-041-0/+11
| | | | | | | | | I'm sending this first, then I'll add support to workers in another changelist to avoid making this change larger. TEST=running message port related layout tests in ui_tests Review URL: http://codereview.chromium.org/159372 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22356 0039d316-1c4b-4281-b951-d872f2087c98
* Reduce the amount of included header files. Vast change like in "Oh God! ↵maruel@chromium.org2009-02-181-1/+0
| | | | | | | | This revision changes half of the source files!". Review URL: http://codereview.chromium.org/20378 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9958 0039d316-1c4b-4281-b951-d872f2087c98
* Add thread safety checks but keep them disabled for now until I fix all the ↵maruel@chromium.org2009-01-261-0/+3
| | | | | | | | | current places where it triggers. Fix thread_collision_warner for real this (third?) time. Review URL: http://codereview.chromium.org/18569 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8650 0039d316-1c4b-4281-b951-d872f2087c98
* Reverting 8499.maruel@chromium.org2009-01-221-3/+0
| | | | | | Review URL: http://codereview.chromium.org/18687 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8504 0039d316-1c4b-4281-b951-d872f2087c98
* Add (currently disabled) RefCountedBase check. (2nd try)maruel@chromium.org2009-01-221-0/+3
| | | | | | Review URL: http://codereview.chromium.org/18438 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8499 0039d316-1c4b-4281-b951-d872f2087c98
* Reverting 8180.maruel@chromium.org2009-01-161-3/+0
| | | | | | Review URL: http://codereview.chromium.org/18319 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8186 0039d316-1c4b-4281-b951-d872f2087c98
* Add thread safety checks but keep them disabled for now until I fix all the ↵maruel@chromium.org2009-01-161-0/+3
| | | | | | | | | | | current places where it triggers. Set back StoreRef as non-thread-safe. BUG5689 Review URL: http://codereview.chromium.org/18272 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8180 0039d316-1c4b-4281-b951-d872f2087c98
* Changing access to scoped_refptr member variables from private to protected.tommi@chromium.org2009-01-101-1/+1
| | | | | | | | This is required to be able to extend the functionality of the class where existing public functionality does not offer sufficient access. Review URL: http://codereview.chromium.org/17464 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7851 0039d316-1c4b-4281-b951-d872f2087c98
* Move DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafe<T>) to private section.tim@chromium.org2008-12-101-0/+1
| | | | | | | | | | | | I hope this is as innocent as it seems, but the presence of the "subtle" namespace freaks me out. Given that everything built, I doubt this was affecting anything because if it were somehow abused moving this to private should have generated compilation errors. In any event, smack me if I'm missing something "subtley" obvious or should try something else (besides running tests). Review URL: http://codereview.chromium.org/13219 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6715 0039d316-1c4b-4281-b951-d872f2087c98
* Remove throttling code from the Browser process and implement throttling in ↵erg@google.com2008-10-171-1/+13
| | | | | | | | | | | | | the Renderer. The previous way of doing throttling was just calling CloseContents() on a window to reject it. But since the Browser is notified about a window opening asynchronously, by the time the CloseContents() sends a message back to the Renderer, a bunch more windows have been opened, leading to memory exhaustion. Instead, make all RenderViews created from a parent RenderView share a counter and start refusing to create RenderViews if too many RV have been created. Every RenderView (except for the first one) is assumed to be an unrequested popup, until notified by the Browser process by either a ViewMsg_DisassociateFromPopupCount message (this RenderView is a new top level page) or a ViewMsg_DisassociatePopup message (this RenderView is a requested popup and therefore shouldn't count against the count.) BUG=3382, 2632 Review URL: http://codereview.chromium.org/7388 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3568 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 ref_counted.cc to the Mac build.mmentovai@google.com2008-08-151-1/+1
| | | | git-svn-id: svn://svn.chromium.org/chrome/trunk/src@938 0039d316-1c4b-4281-b951-d872f2087c98
* Large patch set (159 files total) to cleanup the includes.maruel@google.com2008-08-151-65/+59
| | | | | | | | | | - Slightly reduce the size of the generated .lib files ~3%. - Reduce the number of implicit and explicit atl and windows includes. hooray! - Help incremental build by reducing the number of unnecessary included files. - Split some template class in two, one base class for the common code and the specialization that inherits from the base class. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@937 0039d316-1c4b-4281-b951-d872f2087c98
* Move ref_counted to the new atomic_ref_count interface.deanm@google.com2008-08-061-8/+5
| | | | | | | | BUG=1112286 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@425 0039d316-1c4b-4281-b951-d872f2087c98
* Add base to the repository.initial.commit2008-07-261-0/+249
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8 0039d316-1c4b-4281-b951-d872f2087c98