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

Side by Side Diff: third_party/WebKit/Source/modules/webdatabase/QuotaTracker.cpp

Issue 2813433002: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in modules/webdatabase (Closed)
Patch Set: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in modules/webdatabase Created 3 years, 8 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
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698