diff options
author | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-26 02:30:40 +0000 |
---|---|---|
committer | benwells@chromium.org <benwells@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-26 02:30:40 +0000 |
commit | 6565395c162774ed5321a32ed9ef62455e021e8e (patch) | |
tree | 003a2ffe23268348072220ff5096b450625dbabe /chrome/browser/custom_handlers | |
parent | 40646b01c67e88588d8c30881c2cf1145ad073e0 (diff) | |
download | chromium_src-6565395c162774ed5321a32ed9ef62455e021e8e.zip chromium_src-6565395c162774ed5321a32ed9ef62455e021e8e.tar.gz chromium_src-6565395c162774ed5321a32ed9ef62455e021e8e.tar.bz2 |
Fixed memory problem in ProtocolHandlerRegistry unit tests.
This memory problem only occurred in tests. It happens because the
shell worker, which does stuff on the file thread and is held onto
by message loops, was outliving the delegate which it used.
Fix is to not pass in a delegate but the only piece of information
it needs (whether to fake failure or not).
BUG=90248
TEST=Automated tests and valgrind bots
Review URL: http://codereview.chromium.org/7461060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94023 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/custom_handlers')
-rw-r--r-- | chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc index 7e8b9ed..f18de6c 100644 --- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc +++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc @@ -110,13 +110,13 @@ class FakeProtocolClientWorker public: FakeProtocolClientWorker(ShellIntegration::DefaultWebClientObserver* observer, const std::string& protocol, - FakeDelegate* registry_delegate) + bool force_failure) : ShellIntegration::DefaultProtocolClientWorker(observer, protocol), - delegate_(registry_delegate) {} + force_failure_(force_failure) {} private: virtual ShellIntegration::DefaultWebClientState CheckIsDefault() { - if (delegate_->force_os_failure()) { + if (force_failure_) { return ShellIntegration::NOT_DEFAULT_WEB_CLIENT; } else { return ShellIntegration::IS_DEFAULT_WEB_CLIENT; @@ -126,7 +126,7 @@ class FakeProtocolClientWorker virtual void SetAsDefault() {} private: - FakeDelegate* delegate_; + bool force_failure_; }; ProtocolHandlerRegistry::DefaultClientObserver* @@ -137,7 +137,7 @@ ProtocolHandlerRegistry::DefaultClientObserver* ShellIntegration::DefaultProtocolClientWorker* FakeDelegate::CreateShellWorker( ShellIntegration::DefaultWebClientObserver* observer, const std::string& protocol) { - return new FakeProtocolClientWorker(observer, protocol, this); + return new FakeProtocolClientWorker(observer, protocol, force_os_failure_); } class NotificationCounter : public NotificationObserver { |