| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } | 44 } |
| 45 | 45 |
| 46 void QuotaTracker::GetDatabaseSizeAndSpaceAvailableToOrigin( | 46 void QuotaTracker::GetDatabaseSizeAndSpaceAvailableToOrigin( |
| 47 SecurityOrigin* origin, | 47 SecurityOrigin* origin, |
| 48 const String& database_name, | 48 const String& database_name, |
| 49 unsigned long long* database_size, | 49 unsigned long long* database_size, |
| 50 unsigned long long* space_available) { | 50 unsigned long long* space_available) { |
| 51 // Extra scope to unlock prior to potentially calling Platform. | 51 // Extra scope to unlock prior to potentially calling Platform. |
| 52 { | 52 { |
| 53 MutexLocker lock_data(data_guard_); | 53 MutexLocker lock_data(data_guard_); |
| 54 ASSERT(database_sizes_.Contains(origin->ToRawString())); | 54 DCHECK(database_sizes_.Contains(origin->ToRawString())); |
| 55 HashMap<String, SizeMap>::const_iterator it = | 55 HashMap<String, SizeMap>::const_iterator it = |
| 56 database_sizes_.Find(origin->ToRawString()); | 56 database_sizes_.Find(origin->ToRawString()); |
| 57 ASSERT(it->value.Contains(database_name)); | 57 DCHECK(it->value.Contains(database_name)); |
| 58 *database_size = it->value.at(database_name); | 58 *database_size = it->value.at(database_name); |
| 59 | 59 |
| 60 if (space_available_to_origins_.Contains(origin->ToRawString())) { | 60 if (space_available_to_origins_.Contains(origin->ToRawString())) { |
| 61 *space_available = space_available_to_origins_.at(origin->ToRawString()); | 61 *space_available = space_available_to_origins_.at(origin->ToRawString()); |
| 62 return; | 62 return; |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 // The embedder hasn't pushed this value to us, so we pull it as needed. | 66 // The embedder hasn't pushed this value to us, so we pull it as needed. |
| 67 *space_available = Platform::Current()->DatabaseGetSpaceAvailableForOrigin( | 67 *space_available = Platform::Current()->DatabaseGetSpaceAvailableForOrigin( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 83 MutexLocker lock_data(data_guard_); | 83 MutexLocker lock_data(data_guard_); |
| 84 space_available_to_origins_.Set(origin->ToRawString(), space_available); | 84 space_available_to_origins_.Set(origin->ToRawString(), space_available); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void QuotaTracker::ResetSpaceAvailableToOrigin(SecurityOrigin* origin) { | 87 void QuotaTracker::ResetSpaceAvailableToOrigin(SecurityOrigin* origin) { |
| 88 MutexLocker lock_data(data_guard_); | 88 MutexLocker lock_data(data_guard_); |
| 89 space_available_to_origins_.erase(origin->ToRawString()); | 89 space_available_to_origins_.erase(origin->ToRawString()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace blink | 92 } // namespace blink |
| OLD | NEW |