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

Side by Side Diff: components/browser_context_keyed_service/browser_context_dependency_manager.h

Issue 159763004: Eliminate potential for flaky crash in BCKSFactory::SetTestingFactory(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_MANA GER_H_ 5 #ifndef COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_MANA GER_H_
6 #define COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_MANA GER_H_ 6 #define COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_MANA GER_H_
7 7
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "components/browser_context_keyed_service/browser_context_keyed_service _export.h" 9 #include "components/browser_context_keyed_service/browser_context_keyed_service _export.h"
10 #include "components/browser_context_keyed_service/dependency_graph.h" 10 #include "components/browser_context_keyed_service/dependency_graph.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 // Called by each BrowserContext to alert us that we should destroy services 62 // Called by each BrowserContext to alert us that we should destroy services
63 // associated with it. 63 // associated with it.
64 void DestroyBrowserContextServices(content::BrowserContext* context); 64 void DestroyBrowserContextServices(content::BrowserContext* context);
65 65
66 #ifndef NDEBUG 66 #ifndef NDEBUG
67 // Debugging assertion called as part of GetServiceForBrowserContext in debug 67 // Debugging assertion called as part of GetServiceForBrowserContext in debug
68 // mode. This will NOTREACHED() whenever the user is trying to access a stale 68 // mode. This will NOTREACHED() whenever the user is trying to access a stale
69 // BrowserContext*. 69 // BrowserContext*.
70 void AssertBrowserContextWasntDestroyed(content::BrowserContext* context); 70 void AssertBrowserContextWasntDestroyed(content::BrowserContext* context);
71
72 // Indicates that |context| is live (i.e., not stale). Called as a safeguard
73 // against |AssertBrowserContextWasntDestroyed()| checks going off due to
74 // |context| aliasing a BrowserContext instance from a prior test.
75 void MarkBrowserContextLiveForTesting(content::BrowserContext* context);
71 #endif 76 #endif
72 77
73 static BrowserContextDependencyManager* GetInstance(); 78 static BrowserContextDependencyManager* GetInstance();
74 79
75 private: 80 private:
76 friend class BrowserContextDependencyManagerUnittests; 81 friend class BrowserContextDependencyManagerUnittests;
77 friend struct DefaultSingletonTraits<BrowserContextDependencyManager>; 82 friend struct DefaultSingletonTraits<BrowserContextDependencyManager>;
78 83
79 // Helper function used by CreateBrowserContextServices[ForTest]. 84 // Helper function used by CreateBrowserContextServices[ForTest].
80 void DoCreateBrowserContextServices(content::BrowserContext* context, 85 void DoCreateBrowserContextServices(content::BrowserContext* context,
(...skipping 11 matching lines...) Expand all
92 #ifndef NDEBUG 97 #ifndef NDEBUG
93 // A list of context objects that have gone through the Shutdown() 98 // A list of context objects that have gone through the Shutdown()
94 // phase. These pointers are most likely invalid, but we keep track of their 99 // phase. These pointers are most likely invalid, but we keep track of their
95 // locations in memory so we can nicely assert if we're asked to do anything 100 // locations in memory so we can nicely assert if we're asked to do anything
96 // with them. 101 // with them.
97 std::set<content::BrowserContext*> dead_context_pointers_; 102 std::set<content::BrowserContext*> dead_context_pointers_;
98 #endif 103 #endif
99 }; 104 };
100 105
101 #endif // COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_M ANAGER_H_ 106 #endif // COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_M ANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698