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

Unified Diff: base/path_service.cc

Issue 7087014: Support automatic javascript test registry in gtest when creating WebUI tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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: base/path_service.cc
diff --git a/base/path_service.cc b/base/path_service.cc
index e72ae7deff9af69156ab2ed994de7431009ca5d8..4ede8f6f5b1feed90c58fbda9347108083e9d643 100644
--- a/base/path_service.cc
+++ b/base/path_service.cc
@@ -266,3 +266,22 @@ void PathService::RegisterProvider(ProviderFunc func, int key_start,
#endif
path_data->providers = p;
}
+
+void PathService::UnregisterProvider(ProviderFunc provider) {
+ PathData* path_data = GetPathData();
+ DCHECK(path_data);
+
+ base::AutoLock scoped_lock(path_data->lock);
+
+ for(Provider** p = &path_data->providers; *p; p = &(*p)->next) {
+ if ((*p)->func == provider) {
+ for(int key = (*p)->key_start; key != (*p)->key_end; ++key) {
+ // Removed the computed path from our cache.
+ path_data->cache.erase(key);
+ }
+ *p = (*p)->next;
+ return;
+ }
+ }
+ NOTREACHED();
+}

Powered by Google App Engine
This is Rietveld 408576698