summaryrefslogtreecommitdiffstats
path: root/content/browser/resource_context.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove the AudioManager singleton.tommi@chromium.org2011-12-121-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unit tests now instantiate their own AudioManager and can choose to use the default one or provide their own mock implementation without having to worry about conflicting with the singleton. The teardown sequence of the AudioManager and its thread has been cleaned up significantly and I don't think it has been completely tested before as the audio thread was terminated before all objects that belonged to the thread had a chance to do cleanup. The AudioManager unit tests do not use the actual audio thread, so this part seems to have been left out. In Chrome, the AudioManager instance is now owned by BrowserProcessImpl and always constructed on the UI thread. This instance is then shared in the same way that several other 'manager' type objects are shared to 'content' code, via content::ResourceContext. Audio specific classes do though receive a direct pointer to the AudioManager and are required to do proper reference counting if they need to hold onto the instance. I chose to use the ResourceContext rather than direct use of g_browser_process to avoid requiring another singleton when writing relatively simple tests that touch the AudioManager. I added a couple of safeguards to guard against future regressions: - Not more than one instance of the AudioManager should be created. - The AudioManager should not be addrefed by its own thread. This can basically become a circular reference and prevent deterministic shutdown. Reviewers: Of course you're free to review everything, but here's the breakdown in terms of the bare minimum from the standpoint of "Owners approval". I'm asking Henrik to be the main reviewer of the entire patch (sorry!). Henrik: Everything minus the below, but it would be great if you could take a look at the whole thing, specifically media/audio. Pawel: I'd like you to take a generic look at this approach. The key areas as far as the singleton itself goes are in media/audio/audio_manager[_base].* and chrome/browser/browser_process*.* Satish: content/browser/speech/* media/audio/audio_manager_base.* (new reference counting code) Andrew: content/browser/renderer_host/media/* content/renderer/media/webrtc_audio_device_unittest.cc (Owner) Avi: content/browser/renderer_host/render_process_host_impl.cc content/browser/resource_context.* William: chrome/browser/profiles/profile_io_data.cc chrome/browser/browser_process*.* Robert: This is basically a heads up. I hope that I didn't break the OpenBSD implementation, but unfortunately I have no way of knowing for sure. Shijing: Please take a look at AudioManagerLinux. I replaced the set of active streams with a simple counter. BUG=105249 TEST=content_unittests, media_unittests, browser_tests. Review URL: http://codereview.chromium.org/8818012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114084 0039d316-1c4b-4281-b951-d872f2087c98
* Use callback_forward.h instead of callback.h where possible.erikwright@chromium.org2011-11-291-1/+1
| | | | | | | | | | | | | | | | | callback_forward.h will be committed separately, before this commit, and is included here only to assist in running try jobs. It will be removed before the final commit. You are asked to review this as you have OWNERS for these files. BUG=None TEST=Compiles R=jam@chromium.org Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=111936 Review URL: http://codereview.chromium.org/8699010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111965 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 111936 - Use callback_forward.h instead of callback.h where possible.jstritar@chromium.org2011-11-291-1/+1
| | | | | | | | | | | | | | | | | | callback_forward.h will be committed separately, before this commit, and is included here only to assist in running try jobs. It will be removed before the final commit. You are asked to review this as you have OWNERS for these files. BUG=None TEST=Compiles R=jam@chromium.org Review URL: http://codereview.chromium.org/8699010 TBR=erikwright@chromium.org Review URL: http://codereview.chromium.org/8726036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111940 0039d316-1c4b-4281-b951-d872f2087c98
* Use callback_forward.h instead of callback.h where possible.erikwright@chromium.org2011-11-291-1/+1
| | | | | | | | | | | | | | | callback_forward.h will be committed separately, before this commit, and is included here only to assist in running try jobs. It will be removed before the final commit. You are asked to review this as you have OWNERS for these files. BUG=None TEST=Compiles R=jam@chromium.org Review URL: http://codereview.chromium.org/8699010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111936 0039d316-1c4b-4281-b951-d872f2087c98
* Cleanup: Remove unneeded forward declarations in content/browser.thestig@chromium.org2011-11-101-1/+0
| | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/8499042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109363 0039d316-1c4b-4281-b951-d872f2087c98
* Fix history importing by delaying DownloadManager creation. Replace ↵benjhayden@chromium.org2011-10-291-6/+4
| | | | | | | | | | | | | | | | | | | | GetNextIdThunkType with DownloadIdFactory (RefCountedThreadSafe, created by DownloadService). DownloadService uses the same DownloadIdFactory for an OTR profile as its original profile. DownloadService passes the DownloadIdFactory into the DownloadManager so that the DownloadManager can allocate new valid ids for items loaded from the history or downloads started on the ui thread. Since the DownloadService precedes and outlives its DownloadManager, DownloadManager does not have a scoped_refptr<DownloadIdFactory>. Objects that do have a scoped_refptr<DownloadIdFactory>: DownloadService, ProfileIOData, ShellBrowserContext, ShellResourceContext. The DownloadIdFactory must be RefCountedThreadSafe because ProfileIOData outlives Profile and because it's used in both the OTR and original profiles. Longer term, the import process should strictly precede profile initialization, and the next_download_id counter should be loaded from the History db strictly before DownloadService is created and creates a DownloadIdFactory. BUG=98966 Review URL: http://codereview.chromium.org/8401001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107836 0039d316-1c4b-4281-b951-d872f2087c98
* Remove Prerender from ResourceContext and ProfileIOData.cbentzel@chromium.org2011-10-071-19/+0
| | | | | | | | | BUG=95222 Review URL: http://codereview.chromium.org/8175011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104487 0039d316-1c4b-4281-b951-d872f2087c98
* Removing singelton property of MediaStreamManager.mflodman@chromium.org2011-09-221-0/+8
| | | | | | | | | | This is almost the same patch [1] as was reverted last week due to flakiness in one of the Win tests, but for one change: MediaStreamManager is not called from MediaStreamDispatcherHost::OnChannelClosing, to avoid shut-down crash. This will be changed as soon as the shut-down issue is solved. [1] http://codereview.chromium.org/7649016/ Review URL: http://codereview.chromium.org/7948004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102255 0039d316-1c4b-4281-b951-d872f2087c98
* Retry r100017. This time, prevent a potential shutdown race by moving the ↵benjhayden@chromium.org2011-09-211-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | call to DownloadManager.Shutdown() from ExitedOffTheRecordMode() to ~OTRProfileImpl() to match ProfileImpl and guarantee that Shutdown() is called. Make a new integer field in sql::MetaTable (a per-profile db) containing a counter for the next download id, so that this id is unique across sessions. This id will allow us to merge download id with db_handle and merge most/all of the maps in DownloadManager in future CLs. Make DownloadManager read this field to initialize its next_id_ counter in Init(). Put a fine-grained mutex in DownloadManager::GetNextId() so that it can be called directly from any thread. Define a thunk wrapping DM::GNI() to be passed around between threads to guard against other threads calling any other DM methods. This thunk owns a scoped_refptr<DM> to manage life-time issues. This pattern is implemented for DM elsewhere. Store this thunk in ResourceContext to be called by ResourceDispatchHost/DownloadThrottlingResourceHandler on the IO thread. Pass the returned DownloadId into DownloadResourceHandler. The alternative way to obtain ids on the IO thread is to jump over to the UI thread and back. This way would add significant latency to a critical path. GetNextId() should be fast and easily accessible from any thread. Now that ids are per-profile, define a class DownloadId containing a per-profile id and an indication of which profile, currently the DownloadManager*. DownloadIds are hashable, comparable, globally unique, not persistent, and are used by DownloadFileManager. When the download is added to the history, MetaTable.next_download_id will be set to the new download's id +1 if that number is greater than MT.next_download_id. Increasing this counter at the same time as the download is added to the db prevents the counter from desyncing from the db, which was the primary concern re storing the counter in the BrowserPrefs. Owners: Randy: downloads/* (no change from 7776012) (Done) John: content/browser/{renderer_host/,resource_context.}* (no change from 7776012) (Done) Will, Miranda: profiles/* (small bugfix) Review URL: http://codereview.chromium.org/7847027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102149 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 101063 - Removing singleton property of MediaStreamManager and ↵mad@chromium.org2011-09-141-8/+0
| | | | | | | | | | | | | | | | creating thread first when needed. Most likely cause of new Flakiness in PrerenderBrowserTest.PrerenderUnload... BUG=92125 TEST= Review URL: http://codereview.chromium.org/7649016 TBR=mflodman@chromium.org Review URL: http://codereview.chromium.org/7885034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101107 0039d316-1c4b-4281-b951-d872f2087c98
* Removing singleton property of MediaStreamManager and creating thread first ↵mflodman@chromium.org2011-09-141-0/+8
| | | | | | | | | | | when needed. BUG=92125 TEST= Review URL: http://codereview.chromium.org/7649016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101063 0039d316-1c4b-4281-b951-d872f2087c98
* Annotate all of the functions in content that need to be exported, in ↵dpranke@chromium.org2011-09-131-1/+2
| | | | | | | | | | | | preparation for creating a content shared library. R=darin@chromium.org, jam@chromium.org, willchan@chromium.org BUG=90442 TEST=everything still compiles Review URL: http://codereview.chromium.org/7800015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100975 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 100017 - broke ProfileManagerTest.CreateProfileAsyncMultipleRequestsestade@chromium.org2011-09-071-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | on Linux Tests (Views) (dbg). r100017 was: Make a new integer field in sql::MetaTable (a per-profile db) containing a counter for the next download id, so that this id is unique across sessions. This id will allow us to merge download id with db_handle and merge most/all of the maps in DownloadManager in future CLs. (Retry of r98656 again. That CL included <iostream> in a "promiscuous" header file, dramatically increasing the number of static initializers, and was reverted. This is the same CL, but includes <iosfwd> instead of <iostream>.) Make DownloadManager read this field to initialize its next_id_ counter in Init(). Put a fine-grained mutex in DownloadManager::GetNextId() so that it can be called directly from any thread. Define a thunk wrapping DM::GNI() to be passed around between threads to guard against other threads calling any other DM methods. This thunk owns a scoped_refptr<DM> to manage life-time issues. This pattern is implemented for DM elsewhere. Store this thunk in ResourceContext to be called by ResourceDispatchHost/DownloadThrottlingResourceHandler on the IO thread. Pass the returned DownloadId into DownloadResourceHandler. The alternative way to obtain ids on the IO thread is to jump over to the UI thread and back. This way would add significant latency to a critical path. GetNextId() should be fast and easily accessible from any thread. Now that ids are per-profile, define a class DownloadId containing a per-profile id and an indication of which profile, currently the DownloadManager*. DownloadIds are hashable, comparable, globally unique, not persistent, and are used by DownloadFileManager. When the download is added to the history, MetaTable.next_download_id will be set to the new download's id +1 if that number is greater than MT.next_download_id. Increasing this counter at the same time as the download is added to the db prevents the counter from desyncing from the db, which was the primary concern re storing the counter in the BrowserPrefs. Review URL: http://codereview.chromium.org/7776012 TBR=benjhayden@chromium.org Review URL: http://codereview.chromium.org/7847006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100054 0039d316-1c4b-4281-b951-d872f2087c98
* Make a new integer field in sql::MetaTable (a per-profile db) containing a ↵benjhayden@chromium.org2011-09-071-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | counter for the next download id, so that this id is unique across sessions. This id will allow us to merge download id with db_handle and merge most/all of the maps in DownloadManager in future CLs. (Retry of r98656 again. That CL included <iostream> in a "promiscuous" header file, dramatically increasing the number of static initializers, and was reverted. This is the same CL, but includes <iosfwd> instead of <iostream>.) Make DownloadManager read this field to initialize its next_id_ counter in Init(). Put a fine-grained mutex in DownloadManager::GetNextId() so that it can be called directly from any thread. Define a thunk wrapping DM::GNI() to be passed around between threads to guard against other threads calling any other DM methods. This thunk owns a scoped_refptr<DM> to manage life-time issues. This pattern is implemented for DM elsewhere. Store this thunk in ResourceContext to be called by ResourceDispatchHost/DownloadThrottlingResourceHandler on the IO thread. Pass the returned DownloadId into DownloadResourceHandler. The alternative way to obtain ids on the IO thread is to jump over to the UI thread and back. This way would add significant latency to a critical path. GetNextId() should be fast and easily accessible from any thread. Now that ids are per-profile, define a class DownloadId containing a per-profile id and an indication of which profile, currently the DownloadManager*. DownloadIds are hashable, comparable, globally unique, not persistent, and are used by DownloadFileManager. When the download is added to the history, MetaTable.next_download_id will be set to the new download's id +1 if that number is greater than MT.next_download_id. Increasing this counter at the same time as the download is added to the db prevents the counter from desyncing from the db, which was the primary concern re storing the counter in the BrowserPrefs. Review URL: http://codereview.chromium.org/7776012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100017 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 98656 - Make a new integer field in sql::MetaTable (a per-profile db) ↵dmaclach@chromium.org2011-08-291-7/+0
| | | | | | | | | | | | | | | | | | | | | | containing a counter for the next download id, so that this id is unique across sessions. This id will allow us to merge download id with db_handle and merge most/all of the maps in DownloadManager in future CLs. Make DownloadManager read this field to initialize its next_id_ counter in Init(). Put a fine-grained mutex in DownloadManager::GetNextId() so that it can be called directly from any thread. Define a thunk wrapping DM::GNI() to be passed around between threads to guard against other threads calling any other DM methods. This thunk owns a scoped_refptr<DM> to manage life-time issues. This pattern is implemented for DM elsewhere. Store this thunk in ResourceContext to be called by ResourceDispatchHost/DownloadThrottlingResourceHandler on the IO thread. Pass the returned DownloadId into DownloadResourceHandler. The alternative way to obtain ids on the IO thread is to jump over to the UI thread and back. This way would add significant latency to a critical path. GetNextId() should be fast and easily accessible from any thread. Now that ids are per-profile, define a class DownloadId containing a per-profile id and an indication of which profile, currently the DownloadManager*. DownloadIds are hashable, comparable, globally unique, not persistent, and are used by DownloadFileManager. When the download is added to the history, MetaTable.next_download_id will be set to the new download's id +1 if that number is greater than MT.next_download_id. Increasing this counter at the same time as the download is added to the db prevents the counter from desyncing from the db, which was the primary concern re storing the counter in the BrowserPrefs. See also http://codereview.chromium.org/7192016 LMK what to write a test for if anything. Review URL: http://codereview.chromium.org/7237034 TBR=benjhayden@chromium.org Review URL: http://codereview.chromium.org/7793003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98660 0039d316-1c4b-4281-b951-d872f2087c98
* Make a new integer field in sql::MetaTable (a per-profile db) containing a ↵benjhayden@chromium.org2011-08-291-0/+7
| | | | | | | | | | | | | | | | | | | counter for the next download id, so that this id is unique across sessions. This id will allow us to merge download id with db_handle and merge most/all of the maps in DownloadManager in future CLs. Make DownloadManager read this field to initialize its next_id_ counter in Init(). Put a fine-grained mutex in DownloadManager::GetNextId() so that it can be called directly from any thread. Define a thunk wrapping DM::GNI() to be passed around between threads to guard against other threads calling any other DM methods. This thunk owns a scoped_refptr<DM> to manage life-time issues. This pattern is implemented for DM elsewhere. Store this thunk in ResourceContext to be called by ResourceDispatchHost/DownloadThrottlingResourceHandler on the IO thread. Pass the returned DownloadId into DownloadResourceHandler. The alternative way to obtain ids on the IO thread is to jump over to the UI thread and back. This way would add significant latency to a critical path. GetNextId() should be fast and easily accessible from any thread. Now that ids are per-profile, define a class DownloadId containing a per-profile id and an indication of which profile, currently the DownloadManager*. DownloadIds are hashable, comparable, globally unique, not persistent, and are used by DownloadFileManager. When the download is added to the history, MetaTable.next_download_id will be set to the new download's id +1 if that number is greater than MT.next_download_id. Increasing this counter at the same time as the download is added to the db prevents the counter from desyncing from the db, which was the primary concern re storing the counter in the BrowserPrefs. See also http://codereview.chromium.org/7192016 LMK what to write a test for if anything. Review URL: http://codereview.chromium.org/7237034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98656 0039d316-1c4b-4281-b951-d872f2087c98
* Eliminates base::WeakPtr<prerender::PrerenderManager> on IO thread.willchan@chromium.org2011-07-261-5/+7
| | | | | | | | | | | base::WeakPtr is not safe to destroy on a non-origin thread. Prevent prerender::PrerenderManager from using this. BUG=none TEST=none Review URL: http://codereview.chromium.org/7461071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94193 0039d316-1c4b-4281-b951-d872f2087c98
* Add MediaInternals data aggregator.scottfr@chromium.org2011-06-241-0/+5
| | | | | | | | | | BUG=none TEST=tests pass Review URL: http://codereview.chromium.org/7111061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90431 0039d316-1c4b-4281-b951-d872f2087c98
* Remove last extension dependencies from content.mpcomplete@chromium.org2011-06-081-5/+0
| | | | | | | | | | | | - UserScript reference from BufferedResourceHandler. - ExtensionInfoMap references from RenderMessageFilter and WorkerProcessHost and ResourceContext. BUG=76697 Review URL: http://codereview.chromium.org/7135003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88388 0039d316-1c4b-4281-b951-d872f2087c98
* Get rid of the remaining content settings code in the content module.jam@chromium.org2011-05-131-7/+12
| | | | | | | | | Add user data to content::ResourceContext that points to chrome's ProfileIOData. That way when the embedder code is called by content, it can get back to its profile specific data structures like HostContentSettingsMap. BUG=76793 Review URL: http://codereview.chromium.org/7014025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85247 0039d316-1c4b-4281-b951-d872f2087c98
* Treat the QuotaManager as we do other ProfileIOData.michaeln@google.com2011-05-101-0/+7
| | | | | | | BUG=61676 Review URL: http://codereview.chromium.org/6994004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84862 0039d316-1c4b-4281-b951-d872f2087c98
* Remove ChromeURLRequestContext from content/.willchan@chromium.org2011-04-291-0/+35
| | | | | | | | | | | | Takes the last remaining uses and kills them, or moves them into ResourceContext. Some of the additions to ResourceContext don't belong there either and will need to be removed. BUG=77086,78596 TEST=none Review URL: http://codereview.chromium.org/6880263 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83483 0039d316-1c4b-4281-b951-d872f2087c98
* Replace more uses of ChromeURLRequestContext/URLRequestContextGetter in ↵willchan@chromium.org2011-04-201-0/+12
| | | | | | | | | | | | content with ResourceContext BUG=78596 TEST=none Review URL: http://codereview.chromium.org/6882016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82219 0039d316-1c4b-4281-b951-d872f2087c98
* Move the rest of the storage objects into ResourceContext.willchan@chromium.org2011-04-161-0/+17
| | | | | | | | | | | | Also get rid of the default request context usage in ResourceMessageFilter. BUG=78596 TEST=none Review URL: http://codereview.chromium.org/6861006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81880 0039d316-1c4b-4281-b951-d872f2087c98
* Create a content::ResourceContext.willchan@chromium.org2011-04-151-0/+41
Each Profile will have a ResourceContext which lives within the ProfileIOData on the IO thread, although it is created on the UI thread (since that's where the ProfileIOData is created). Move webkit_database::DatabaseTracker into ResourceContext and out of ChromeURLRequestContext. Fixed WorkerProcessHost to create its own ResourceMessageFilter that uses a URLRequestContextOverride pointing to its own URLRequestContext, rather than using the default request context. BUG=78596 TEST=existing Review URL: http://codereview.chromium.org/6825038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81774 0039d316-1c4b-4281-b951-d872f2087c98