diff options
author | vabr@chromium.org <vabr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-03 14:05:23 +0000 |
---|---|---|
committer | vabr@chromium.org <vabr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-03 14:05:23 +0000 |
commit | 3a27ba68d063d21ae08cf2f2a1462fa7ad353d1f (patch) | |
tree | 2cf1f7a8f4588273ee8ca457b9d96d29e1e09689 /chrome/browser/browser_process_impl.h | |
parent | 6684dc816d4b3a6eec04275fa32bb4da326e258b (diff) | |
download | chromium_src-3a27ba68d063d21ae08cf2f2a1462fa7ad353d1f.zip chromium_src-3a27ba68d063d21ae08cf2f2a1462fa7ad353d1f.tar.gz chromium_src-3a27ba68d063d21ae08cf2f2a1462fa7ad353d1f.tar.bz2 |
Detach the RulesRegistryWithCache::weak_ptr_factory_ on destruction.
In tests I observed that RulesRegistryWithCache can be destructed on the UI thread. The destructor of the registry does not check this, but if the registry init
ialised the WeakPtrFactory for itself, that factory expects to be destructed on
the registry's thread. In case of WebRequestRulesRegistry (a subclass of RulesRegistryWithCache), this thread is IO, as opposed to the UI thread where the Rules
RegistryService lives.
Here I propose that the WeakPtrFactory should not care where it is destructed:
- The only piece of code from where the weak pointer to the registry is used is the UI part (running entirely on a UI thread).
- The UI part is owned by the RulesRegistryService (ui_parts_of_registries_).
- The registry is referenced by RulesRegistryService, i.e., it lives at least until the service's (and UI parts') destruction.
Based on the above, I don't think there is a moment when the registry would be destructed, and still there would be a pending task holding a weak pointer to it. Such task would need to be waiting on the UI thread, and coming from the UI part, but the UI part would get destructed (on UI) before that task could be scheduled. Destructing the UI part would invalidate the task (which would contain a weak pointer to the UI part as |this|).
BUG=218451
Review URL: https://chromiumcodereview.appspot.com/15688010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203710 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_process_impl.h')
0 files changed, 0 insertions, 0 deletions