diff options
author | scheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-10 21:42:11 +0000 |
---|---|---|
committer | scheib@chromium.org <scheib@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-10 21:42:11 +0000 |
commit | 76f45b23f38ee0c8953280914190865bf3f8d9fc (patch) | |
tree | b4490932bf84390021b5402ff76551442777de28 /extensions/browser/process_manager.cc | |
parent | c35e7ec8e0b3d525f27f5a52864c61768698954f (diff) | |
download | chromium_src-76f45b23f38ee0c8953280914190865bf3f8d9fc.zip chromium_src-76f45b23f38ee0c8953280914190865bf3f8d9fc.tar.gz chromium_src-76f45b23f38ee0c8953280914190865bf3f8d9fc.tar.bz2 |
Clear testing callbacks in AppBackgrounPageNaclTest reentrantly.
Addresses a flaky ASAN failure where I believe callbacks from ImpulseCallbackCounter with an unretained reference were being held too long by ProcessManager.
This clears the callbacks immediately when the impulse count is reached, and does not call the quit closure repeatedly.
BUG=332440
Review URL: https://codereview.chromium.org/129243003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244247 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/browser/process_manager.cc')
-rw-r--r-- | extensions/browser/process_manager.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/extensions/browser/process_manager.cc b/extensions/browser/process_manager.cc index a38f8bc..fed3369 100644 --- a/extensions/browser/process_manager.cc +++ b/extensions/browser/process_manager.cc @@ -443,8 +443,11 @@ void ProcessManager::KeepaliveImpulse(const Extension* extension) { } } - if (!keepalive_impulse_callback_for_testing_.is_null()) - keepalive_impulse_callback_for_testing_.Run(extension->id()); + if (!keepalive_impulse_callback_for_testing_.is_null()) { + ImpulseCallbackForTesting callback_may_clear_callbacks_reentrantly = + keepalive_impulse_callback_for_testing_; + callback_may_clear_callbacks_reentrantly.Run(extension->id()); + } } // DecrementLazyKeepaliveCount is called when no calls to KeepaliveImpulse @@ -459,8 +462,11 @@ void ProcessManager::OnKeepaliveImpulseCheck() { ++i) { if (i->second.previous_keepalive_impulse && !i->second.keepalive_impulse) { DecrementLazyKeepaliveCount(i->first); - if (!keepalive_impulse_decrement_callback_for_testing_.is_null()) - keepalive_impulse_decrement_callback_for_testing_.Run(i->first); + if (!keepalive_impulse_decrement_callback_for_testing_.is_null()) { + ImpulseCallbackForTesting callback_may_clear_callbacks_reentrantly = + keepalive_impulse_decrement_callback_for_testing_; + callback_may_clear_callbacks_reentrantly.Run(i->first); + } } i->second.previous_keepalive_impulse = i->second.keepalive_impulse; |