OLD | NEW |
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 #include "chrome/browser/download/download_path_reservation_tracker.h" | 5 #include "chrome/browser/download/download_path_reservation_tracker.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // call. Neither should happen. | 282 // call. Neither should happen. |
283 NOTREACHED(); | 283 NOTREACHED(); |
284 } | 284 } |
285 } | 285 } |
286 | 286 |
287 // Called on the FILE thread to remove the path reservation associated with | 287 // Called on the FILE thread to remove the path reservation associated with |
288 // |key|. | 288 // |key|. |
289 void RevokeReservation(ReservationKey key) { | 289 void RevokeReservation(ReservationKey key) { |
290 DCHECK_CURRENTLY_ON(BrowserThread::FILE); | 290 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
291 DCHECK(g_reservation_map != NULL); | 291 DCHECK(g_reservation_map != NULL); |
292 DCHECK(ContainsKey(*g_reservation_map, key)); | 292 DCHECK(base::ContainsKey(*g_reservation_map, key)); |
293 g_reservation_map->erase(key); | 293 g_reservation_map->erase(key); |
294 if (g_reservation_map->size() == 0) { | 294 if (g_reservation_map->size() == 0) { |
295 // No more reservations. Delete map. | 295 // No more reservations. Delete map. |
296 delete g_reservation_map; | 296 delete g_reservation_map; |
297 g_reservation_map = NULL; | 297 g_reservation_map = NULL; |
298 } | 298 } |
299 } | 299 } |
300 | 300 |
301 void RunGetReservedPathCallback( | 301 void RunGetReservedPathCallback( |
302 const DownloadPathReservationTracker::ReservedPathCallback& callback, | 302 const DownloadPathReservationTracker::ReservedPathCallback& callback, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 base::Bind(&RunGetReservedPathCallback, | 398 base::Bind(&RunGetReservedPathCallback, |
399 callback, | 399 callback, |
400 base::Owned(reserved_path))); | 400 base::Owned(reserved_path))); |
401 } | 401 } |
402 | 402 |
403 // static | 403 // static |
404 bool DownloadPathReservationTracker::IsPathInUseForTesting( | 404 bool DownloadPathReservationTracker::IsPathInUseForTesting( |
405 const base::FilePath& path) { | 405 const base::FilePath& path) { |
406 return IsPathInUse(path); | 406 return IsPathInUse(path); |
407 } | 407 } |
OLD | NEW |