OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "base/path_service.h" | 5 #include "base/path_service.h" |
6 | 6 |
7 #ifdef OS_WIN | 7 #ifdef OS_WIN |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 p = new Provider; | 259 p = new Provider; |
260 p->is_static = false; | 260 p->is_static = false; |
261 p->func = func; | 261 p->func = func; |
262 p->next = path_data->providers; | 262 p->next = path_data->providers; |
263 #ifndef NDEBUG | 263 #ifndef NDEBUG |
264 p->key_start = key_start; | 264 p->key_start = key_start; |
265 p->key_end = key_end; | 265 p->key_end = key_end; |
266 #endif | 266 #endif |
267 path_data->providers = p; | 267 path_data->providers = p; |
268 } | 268 } |
| 269 |
| 270 void PathService::UnregisterProvider(ProviderFunc provider) { |
| 271 PathData* path_data = GetPathData(); |
| 272 DCHECK(path_data); |
| 273 |
| 274 base::AutoLock scoped_lock(path_data->lock); |
| 275 |
| 276 for(Provider** p = &path_data->providers; *p; p = &(*p)->next) { |
| 277 if ((*p)->func == provider) { |
| 278 for(int key = (*p)->key_start; key != (*p)->key_end; ++key) { |
| 279 // Removed the computed path from our cache. |
| 280 path_data->cache.erase(key); |
| 281 } |
| 282 *p = (*p)->next; |
| 283 return; |
| 284 } |
| 285 } |
| 286 NOTREACHED(); |
| 287 } |
OLD | NEW |