| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 23 matching lines...) Expand all Loading... |
| 34 #include "modules/ModulesExport.h" | 34 #include "modules/ModulesExport.h" |
| 35 #include "platform/weborigin/SecurityOrigin.h" | 35 #include "platform/weborigin/SecurityOrigin.h" |
| 36 #include "wtf/HashMap.h" | 36 #include "wtf/HashMap.h" |
| 37 #include "wtf/ThreadingPrimitives.h" | 37 #include "wtf/ThreadingPrimitives.h" |
| 38 #include "wtf/text/StringHash.h" | 38 #include "wtf/text/StringHash.h" |
| 39 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class MODULES_EXPORT QuotaTracker { | 43 class MODULES_EXPORT QuotaTracker { |
| 44 WTF_MAKE_FAST_ALLOCATED(QuotaTracker); |
| 45 WTF_MAKE_NONCOPYABLE(QuotaTracker); |
| 44 public: | 46 public: |
| 45 static QuotaTracker& instance(); | 47 static QuotaTracker& instance(); |
| 46 | 48 |
| 47 void getDatabaseSizeAndSpaceAvailableToOrigin( | 49 void getDatabaseSizeAndSpaceAvailableToOrigin( |
| 48 const String& originIdentifier, const String& databaseName, | 50 const String& originIdentifier, const String& databaseName, |
| 49 unsigned long long* databaseSize, unsigned long long* spaceAvailable); | 51 unsigned long long* databaseSize, unsigned long long* spaceAvailable); |
| 50 void updateDatabaseSize( | 52 void updateDatabaseSize( |
| 51 const String& originIdentifier, const String& databaseName, | 53 const String& originIdentifier, const String& databaseName, |
| 52 unsigned long long databaseSize); | 54 unsigned long long databaseSize); |
| 53 void updateSpaceAvailableToOrigin(const String& originIdentifier, unsigned l
ong long spaceAvailable); | 55 void updateSpaceAvailableToOrigin(const String& originIdentifier, unsigned l
ong long spaceAvailable); |
| 54 void resetSpaceAvailableToOrigin(const String& originIdentifier); | 56 void resetSpaceAvailableToOrigin(const String& originIdentifier); |
| 55 | 57 |
| 56 private: | 58 private: |
| 57 QuotaTracker() { } | 59 QuotaTracker() { } |
| 58 | 60 |
| 59 typedef HashMap<String, unsigned long long> SizeMap; | 61 typedef HashMap<String, unsigned long long> SizeMap; |
| 60 SizeMap m_spaceAvailableToOrigins; | 62 SizeMap m_spaceAvailableToOrigins; |
| 61 HashMap<String, SizeMap> m_databaseSizes; | 63 HashMap<String, SizeMap> m_databaseSizes; |
| 62 Mutex m_dataGuard; | 64 Mutex m_dataGuard; |
| 63 }; | 65 }; |
| 64 | 66 |
| 65 } | 67 } |
| 66 | 68 |
| 67 #endif // QuotaTracker_h | 69 #endif // QuotaTracker_h |
| OLD | NEW |