| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef WEBKIT_DATABASE_DATABASE_TRACKER_H_ | 5 #ifndef WEBKIT_DATABASE_DATABASE_TRACKER_H_ |
| 6 #define WEBKIT_DATABASE_DATABASE_TRACKER_H_ | 6 #define WEBKIT_DATABASE_DATABASE_TRACKER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 bool DeleteDatabase(const string16& origin_identifier, | 112 bool DeleteDatabase(const string16& origin_identifier, |
| 113 const string16& database_name); | 113 const string16& database_name); |
| 114 bool DeleteOrigin(const string16& origin_identifier); | 114 bool DeleteOrigin(const string16& origin_identifier); |
| 115 | 115 |
| 116 private: | 116 private: |
| 117 // Need this here to allow RefCountedThreadSafe to call ~DatabaseTracker(). | 117 // Need this here to allow RefCountedThreadSafe to call ~DatabaseTracker(). |
| 118 friend class base::RefCountedThreadSafe<DatabaseTracker>; | 118 friend class base::RefCountedThreadSafe<DatabaseTracker>; |
| 119 | 119 |
| 120 class CachedOriginInfo : public OriginInfo { | 120 class CachedOriginInfo : public OriginInfo { |
| 121 public: | 121 public: |
| 122 CachedOriginInfo() : OriginInfo(EmptyString16(), 0, 0) {} | 122 CachedOriginInfo() : OriginInfo(string16(), 0, 0) {} |
| 123 void SetOrigin(const string16& origin) { origin_ = origin; } | 123 void SetOrigin(const string16& origin) { origin_ = origin; } |
| 124 void SetQuota(int64 new_quota) { quota_ = new_quota; } | 124 void SetQuota(int64 new_quota) { quota_ = new_quota; } |
| 125 void SetDatabaseSize(const string16& database_name, int64 new_size) { | 125 void SetDatabaseSize(const string16& database_name, int64 new_size) { |
| 126 int64 old_size = database_sizes_[database_name]; | 126 int64 old_size = database_sizes_[database_name]; |
| 127 database_sizes_[database_name] = new_size; | 127 database_sizes_[database_name] = new_size; |
| 128 if (new_size != old_size) | 128 if (new_size != old_size) |
| 129 total_size_ += new_size - old_size; | 129 total_size_ += new_size - old_size; |
| 130 } | 130 } |
| 131 }; | 131 }; |
| 132 | 132 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 159 ObserverList<Observer> observers_; | 159 ObserverList<Observer> observers_; |
| 160 std::map<string16, CachedOriginInfo> origins_info_map_; | 160 std::map<string16, CachedOriginInfo> origins_info_map_; |
| 161 DatabaseConnections database_connections_; | 161 DatabaseConnections database_connections_; |
| 162 | 162 |
| 163 FRIEND_TEST(DatabaseTrackerTest, TestIt); | 163 FRIEND_TEST(DatabaseTrackerTest, TestIt); |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 } // namespace webkit_database | 166 } // namespace webkit_database |
| 167 | 167 |
| 168 #endif // WEBKIT_DATABASE_DATABASE_TRACKER_H_ | 168 #endif // WEBKIT_DATABASE_DATABASE_TRACKER_H_ |
| OLD | NEW |