Couple of prospective fix for memory test flakiness: addref/release the url request context getter appropriately; fix a leak.
Passing as a straight pointer without addreffing was copied from the previous spellchecker impl. Using .release() instead of = NULL was a plain old mistake.
BUG=none
TEST=memory test flakiness goes away hopefully?
Review URL: http://codereview.chromium.org/379015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31529 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc
index 9f62d39..112375a 100644
--- a/chrome/browser/profile.cc
+++ b/chrome/browser/profile.cc
@@ -1321,7 +1321,7 @@
bool notify = false;
if (spellcheck_host_.get()) {
spellcheck_host_->UnsetObserver();
- spellcheck_host_.release();
+ spellcheck_host_ = NULL;
spellcheck_host_ready_ = false;
notify = true;
}
diff --git a/chrome/browser/spellcheck_host.cc b/chrome/browser/spellcheck_host.cc
index 91a1a9c..c9fea3ecf 100644
--- a/chrome/browser/spellcheck_host.cc
+++ b/chrome/browser/spellcheck_host.cc
@@ -220,7 +220,7 @@
GURL url = GURL(std::string(kDownloadServerUrl) + WideToUTF8(
l10n_util::ToLower(bdict_file_.BaseName().ToWStringHack())));
fetcher_.reset(new URLFetcher(url, URLFetcher::GET, this));
- fetcher_->set_request_context(request_context_getter_);
+ fetcher_->set_request_context(request_context_getter_.get());
tried_to_download_ = true;
fetcher_->Start();
}
diff --git a/chrome/browser/spellcheck_host.h b/chrome/browser/spellcheck_host.h
index 6b0f316..8c2ef55 100644
--- a/chrome/browser/spellcheck_host.h
+++ b/chrome/browser/spellcheck_host.h
@@ -13,6 +13,7 @@
#include "base/ref_counted.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/browser/net/url_request_context_getter.h"
class SpellCheckHost : public base::RefCountedThreadSafe<SpellCheckHost,
ChromeThread::DeleteOnFileThread>,
@@ -94,7 +95,7 @@
bool tried_to_download_;
// Used for downloading the dictionary file.
- URLRequestContextGetter* request_context_getter_;
+ scoped_refptr<URLRequestContextGetter> request_context_getter_;
// Used for downloading the dictionary file.
scoped_ptr<URLFetcher> fetcher_;