diff options
author | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-29 00:54:35 +0000 |
---|---|---|
committer | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-29 00:54:35 +0000 |
commit | ba4e52f352826c33876ab2c0ce0686bbe280af4a (patch) | |
tree | 6f95921c9e829c198e2b7054f8bad65ffb8befac | |
parent | dae2b82d7ae27065a2398f7a9f134564d2adf7cd (diff) | |
download | chromium_src-ba4e52f352826c33876ab2c0ce0686bbe280af4a.zip chromium_src-ba4e52f352826c33876ab2c0ce0686bbe280af4a.tar.gz chromium_src-ba4e52f352826c33876ab2c0ce0686bbe280af4a.tar.bz2 |
Fix a minor memory leak.
BUG=1340229
Review URL: http://codereview.chromium.org/8690
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4117 0039d316-1c4b-4281-b951-d872f2087c98
4 files changed, 6 insertions, 8 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc index 730b62b..59e9c6c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_bloom.cc @@ -44,7 +44,6 @@ static const int kMaxStalenessMinutes = 45; SafeBrowsingDatabaseBloom::SafeBrowsingDatabaseBloom() : db_(NULL), init_(false), - chunk_inserted_callback_(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(reset_factory_(this)), ALLOW_THIS_IN_INITIALIZER_LIST(resume_factory_(this)), did_resume_(false) { @@ -87,7 +86,7 @@ bool SafeBrowsingDatabaseBloom::Init(const std::wstring& filename, } init_ = true; - chunk_inserted_callback_ = chunk_inserted_callback; + chunk_inserted_callback_.reset(chunk_inserted_callback); return true; } @@ -405,7 +404,7 @@ void SafeBrowsingDatabaseBloom::InsertChunks(const std::string& list_name, delete chunks; - if (chunk_inserted_callback_) + if (chunk_inserted_callback_.get()) chunk_inserted_callback_->Run(); } diff --git a/chrome/browser/safe_browsing/safe_browsing_database_bloom.h b/chrome/browser/safe_browsing/safe_browsing_database_bloom.h index e470a64..9569a43 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_bloom.h +++ b/chrome/browser/safe_browsing/safe_browsing_database_bloom.h @@ -203,7 +203,7 @@ class SafeBrowsingDatabaseBloom : public SafeBrowsingDatabase { std::wstring filename_; // Called after an add/sub chunk is processed. - Callback0::Type* chunk_inserted_callback_; + scoped_ptr<Callback0::Type> chunk_inserted_callback_; // Used to schedule resetting the database because of corruption. ScopedRunnableMethodFactory<SafeBrowsingDatabaseBloom> reset_factory_; diff --git a/chrome/browser/safe_browsing/safe_browsing_database_impl.cc b/chrome/browser/safe_browsing/safe_browsing_database_impl.cc index db25ec7..9f47afd 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_impl.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_impl.cc @@ -64,7 +64,6 @@ SafeBrowsingDatabaseImpl::SafeBrowsingDatabaseImpl() transaction_count_(0), init_(false), asynchronous_(true), - chunk_inserted_callback_(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(process_factory_(this)), ALLOW_THIS_IN_INITIALIZER_LIST(bloom_read_factory_(this)), ALLOW_THIS_IN_INITIALIZER_LIST(bloom_write_factory_(this)), @@ -109,7 +108,7 @@ bool SafeBrowsingDatabaseImpl::Init(const std::wstring& filename, } init_ = true; - chunk_inserted_callback_ = chunk_inserted_callback; + chunk_inserted_callback_.reset(chunk_inserted_callback); return true; } @@ -543,7 +542,7 @@ bool SafeBrowsingDatabaseImpl::ProcessChunks() { } } - if (chunk_inserted_callback_) + if (chunk_inserted_callback_.get()) chunk_inserted_callback_->Run(); return true; diff --git a/chrome/browser/safe_browsing/safe_browsing_database_impl.h b/chrome/browser/safe_browsing/safe_browsing_database_impl.h index 4c46b75..4b47859 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_impl.h +++ b/chrome/browser/safe_browsing/safe_browsing_database_impl.h @@ -242,7 +242,7 @@ class SafeBrowsingDatabaseImpl : public SafeBrowsingDatabase { std::queue<AddDelWork> pending_add_del_; // Called after an add/sub chunk is processed. - Callback0::Type* chunk_inserted_callback_; + scoped_ptr<Callback0::Type> chunk_inserted_callback_; // Used to schedule small bits of work when writing to the database. ScopedRunnableMethodFactory<SafeBrowsingDatabaseImpl> process_factory_; |