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

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: Fix compile 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
« no previous file with comments | « no previous file | components/browser_context_keyed_service/browser_context_dependency_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Marks |context| as live (i.e., not stale). This method can be called as a
73 // safeguard against |AssertBrowserContextWasntDestroyed()| checks going off
74 // due to |context| aliasing a BrowserContext instance from a prior test
75 // (i.e., 0xWhatever might be created, be destroyed, and then a new
76 // BrowserContext object might be created at 0xWhatever).
77 void MarkBrowserContextLiveForTesting(content::BrowserContext* context);
71 #endif 78 #endif
72 79
73 static BrowserContextDependencyManager* GetInstance(); 80 static BrowserContextDependencyManager* GetInstance();
74 81
75 private: 82 private:
76 friend class BrowserContextDependencyManagerUnittests; 83 friend class BrowserContextDependencyManagerUnittests;
77 friend struct DefaultSingletonTraits<BrowserContextDependencyManager>; 84 friend struct DefaultSingletonTraits<BrowserContextDependencyManager>;
78 85
79 // Helper function used by CreateBrowserContextServices[ForTest]. 86 // Helper function used by CreateBrowserContextServices[ForTest].
80 void DoCreateBrowserContextServices(content::BrowserContext* context, 87 void DoCreateBrowserContextServices(content::BrowserContext* context,
(...skipping 11 matching lines...) Expand all
92 #ifndef NDEBUG 99 #ifndef NDEBUG
93 // A list of context objects that have gone through the Shutdown() 100 // 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 101 // 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 102 // locations in memory so we can nicely assert if we're asked to do anything
96 // with them. 103 // with them.
97 std::set<content::BrowserContext*> dead_context_pointers_; 104 std::set<content::BrowserContext*> dead_context_pointers_;
98 #endif 105 #endif
99 }; 106 };
100 107
101 #endif // COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_M ANAGER_H_ 108 #endif // COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_M ANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | components/browser_context_keyed_service/browser_context_dependency_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698