diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-15 20:33:14 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-15 20:33:14 +0000 |
commit | b3186d020039b47b57a41a2f64ad10d0059a9e20 (patch) | |
tree | f32e503aec28706df6ab9ee021d5820a569abead /chrome/browser | |
parent | 081a65a887ebaa5eaf079b2bc7822c4c2e0670fc (diff) | |
download | chromium_src-b3186d020039b47b57a41a2f64ad10d0059a9e20.zip chromium_src-b3186d020039b47b57a41a2f64ad10d0059a9e20.tar.gz chromium_src-b3186d020039b47b57a41a2f64ad10d0059a9e20.tar.bz2 |
Fix unittest bustage due to NULL pointer deref (only in unittest mode, I hope).
Also commit some comment changes which were supposed to go in my original patch but missed it.
TBR=sky
BUG=1291
Review URL: http://codereview.chromium.org/2870
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2233 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/profile.h | 20 | ||||
-rw-r--r-- | chrome/browser/template_url_model.cc | 8 | ||||
-rw-r--r-- | chrome/browser/template_url_model.h | 2 |
3 files changed, 18 insertions, 12 deletions
diff --git a/chrome/browser/profile.h b/chrome/browser/profile.h index 83dcdec..2d7dbac 100644 --- a/chrome/browser/profile.h +++ b/chrome/browser/profile.h @@ -69,13 +69,13 @@ class Profile { // Create a new profile given a path. static Profile* CreateProfile(const std::wstring& path); - // Returns the request context for the "default" profile. This is a temporary - // measure while we still only support 1 profile. Consumers of this will need - // to figure out what to do when we start having multiple profiles. This may - // be called from any thread. + // Returns the request context for the "default" profile. This may be called + // from any thread. This CAN return NULL if a first request context has not + // yet been created. If necessary, listen on the UI thread for + // NOTIFY_DEFAULT_REQUEST_CONTEXT_AVAILABLE. // - // This object is NOT THREADSAFE and must be used and destroyed only on the - // I/O thread. + // The returned object is ref'd by the profile. Callers who AddRef() it (to + // keep it alive longer than the profile) must Release() it on the I/O thread. static URLRequestContext* GetDefaultRequestContext(); // Returns the path of the directory where this profile's data is stored. @@ -135,10 +135,12 @@ class Profile { virtual DownloadManager* GetDownloadManager() = 0; virtual bool HasCreatedDownloadManager() const = 0; - // Returns the request context information associated with this profile. + // Returns the request context information associated with this profile. Call + // this only on the UI thread, since it can send notifications that should + // happen on the UI thread. // - // This object is NOT THREADSAFE and must be used and destroyed only on the - // I/O thread. + // The returned object is ref'd by the profile. Callers who AddRef() it (to + // keep it alive longer than the profile) must Release() it on the I/O thread. virtual URLRequestContext* GetRequestContext() = 0; // Returns the session service for this profile. This may return NULL. If diff --git a/chrome/browser/template_url_model.cc b/chrome/browser/template_url_model.cc index 8a2be29..b10d08d 100644 --- a/chrome/browser/template_url_model.cc +++ b/chrome/browser/template_url_model.cc @@ -135,9 +135,11 @@ void TemplateURLModel::Init(const Initializer* initializers, // Request a server check for the correct Google URL if Google is the default // search engine. const TemplateURL* default_provider = GetDefaultSearchProvider(); - const TemplateURLRef* default_provider_ref = default_provider->url(); - if (default_provider_ref && default_provider_ref->HasGoogleBaseURLs()) - GoogleURLTracker::RequestServerCheck(); + if (default_provider) { + const TemplateURLRef* default_provider_ref = default_provider->url(); + if (default_provider_ref && default_provider_ref->HasGoogleBaseURLs()) + GoogleURLTracker::RequestServerCheck(); + } } // static diff --git a/chrome/browser/template_url_model.h b/chrome/browser/template_url_model.h index ff97d37..d540f89 100644 --- a/chrome/browser/template_url_model.h +++ b/chrome/browser/template_url_model.h @@ -156,6 +156,8 @@ class TemplateURLModel : public WebDataServiceConsumer, // Returns the default search provider. If the TemplateURLModel hasn't been // loaded, the default search provider is pulled from preferences. + // + // NOTE: At least in unittest mode, this may return NULL. const TemplateURL* GetDefaultSearchProvider(); // Observers used to listen for changes to the model. |