OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 OriginQuotaManager::OriginQuotaManager() | 38 OriginQuotaManager::OriginQuotaManager() |
39 #ifndef NDEBUG | 39 #ifndef NDEBUG |
40 : m_usageRecordGuardLocked(false) | 40 : m_usageRecordGuardLocked(false) |
41 #endif | 41 #endif |
42 { | 42 { |
43 } | 43 } |
44 | 44 |
| 45 bool OriginQuotaManager::tryLock() |
| 46 { |
| 47 bool locked = m_usageRecordGuard.tryLock(); |
| 48 #ifndef NDEBUG |
| 49 if (locked) |
| 50 m_usageRecordGuardLocked = true; |
| 51 else |
| 52 ASSERT(m_usageRecordGuardLocked); |
| 53 #endif |
| 54 return locked; |
| 55 } |
| 56 |
45 void OriginQuotaManager::lock() | 57 void OriginQuotaManager::lock() |
46 { | 58 { |
47 m_usageRecordGuard.lock(); | 59 m_usageRecordGuard.lock(); |
48 #ifndef NDEBUG | 60 #ifndef NDEBUG |
49 m_usageRecordGuardLocked = true; | 61 m_usageRecordGuardLocked = true; |
50 #endif | 62 #endif |
51 } | 63 } |
52 | 64 |
53 void OriginQuotaManager::unlock() | 65 void OriginQuotaManager::unlock() |
54 { | 66 { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 128 |
117 OriginUsageRecord* usageRecord = m_usageMap.get(origin); | 129 OriginUsageRecord* usageRecord = m_usageMap.get(origin); |
118 ASSERT(usageRecord); | 130 ASSERT(usageRecord); |
119 | 131 |
120 return usageRecord->diskUsage(); | 132 return usageRecord->diskUsage(); |
121 } | 133 } |
122 | 134 |
123 } | 135 } |
124 | 136 |
125 #endif // ENABLE(DATABASE) | 137 #endif // ENABLE(DATABASE) |
OLD | NEW |