Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Unified Diff: chrome/test/base/testing_profile.h

Issue 2676303002: Remove some unnecessary calls to TestingProfile::DestroyHistoryService (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/base/testing_profile.h
diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h
index fc9918f690e79b7aa48eb8630878c69d71161f5b..5d9bd8a748a41176273dafb16a9e0dea4476b96a 100644
--- a/chrome/test/base/testing_profile.h
+++ b/chrome/test/base/testing_profile.h
@@ -178,6 +178,13 @@ class TestingProfile : public Profile {
// Creates the favicon service. Consequent calls would recreate the service.
void CreateFaviconService();
+ // !!!!!!!! WARNING: THIS IS GENERALLY NOT SAFE TO CALL! !!!!!!!!
+ // This bypasses the BrowserContextDependencyManager, and in particular, it
+ // destroys any previously-created HistoryService. That means any other
+ // KeyedServices that depend on HistoryService may be left with dangling
+ // pointers.
+ // Instead, use Builder::AddTestingFactory to inject your own factories.
+ // !!!!!!!! WARNING: THIS IS GENERALLY NOT SAFE TO CALL! !!!!!!!!
// Creates the history service. If |delete_file| is true, the history file is
// deleted first, then the HistoryService is created. As TestingProfile
// deletes the directory containing the files used by HistoryService, this
@@ -186,6 +193,12 @@ class TestingProfile : public Profile {
// for testing error conditions. Returns true on success.
bool CreateHistoryService(bool delete_file, bool no_db) WARN_UNUSED_RESULT;
+ // !!!!!!!! WARNING: THIS IS GENERALLY NOT SAFE TO CALL! !!!!!!!!
+ // This bypasses the BrowserContextDependencyManager and thus may leave other
+ // KeyedServices with dangling pointers; see above. It's also usually not
+ // necessary to explicitly destroy the HistoryService; it'll be destroyed
+ // along with the TestingProfile anyway.
+ // !!!!!!!! WARNING: THIS IS GENERALLY NOT SAFE TO CALL! !!!!!!!!
// Shuts down and nulls out the reference to HistoryService.
void DestroyHistoryService();

Powered by Google App Engine
This is Rietveld 408576698