| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_QUOTA_QUOTA_MANAGER_H_ | 5 #ifndef WEBKIT_BROWSER_QUOTA_QUOTA_MANAGER_H_ |
| 6 #define WEBKIT_BROWSER_QUOTA_QUOTA_MANAGER_H_ | 6 #define WEBKIT_BROWSER_QUOTA_QUOTA_MANAGER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 427 |
| 428 DISALLOW_COPY_AND_ASSIGN(QuotaManager); | 428 DISALLOW_COPY_AND_ASSIGN(QuotaManager); |
| 429 }; | 429 }; |
| 430 | 430 |
| 431 struct QuotaManagerDeleter { | 431 struct QuotaManagerDeleter { |
| 432 static void Destruct(const QuotaManager* manager) { | 432 static void Destruct(const QuotaManager* manager) { |
| 433 manager->DeleteOnCorrectThread(); | 433 manager->DeleteOnCorrectThread(); |
| 434 } | 434 } |
| 435 }; | 435 }; |
| 436 | 436 |
| 437 // The proxy may be called and finally released on any thread. | |
| 438 class WEBKIT_STORAGE_BROWSER_EXPORT QuotaManagerProxy | |
| 439 : public base::RefCountedThreadSafe<QuotaManagerProxy> { | |
| 440 public: | |
| 441 typedef QuotaManager::GetUsageAndQuotaCallback | |
| 442 GetUsageAndQuotaCallback; | |
| 443 | |
| 444 virtual void RegisterClient(QuotaClient* client); | |
| 445 virtual void NotifyStorageAccessed(QuotaClient::ID client_id, | |
| 446 const GURL& origin, | |
| 447 StorageType type); | |
| 448 virtual void NotifyStorageModified(QuotaClient::ID client_id, | |
| 449 const GURL& origin, | |
| 450 StorageType type, | |
| 451 int64 delta); | |
| 452 virtual void NotifyOriginInUse(const GURL& origin); | |
| 453 virtual void NotifyOriginNoLongerInUse(const GURL& origin); | |
| 454 | |
| 455 virtual void SetUsageCacheEnabled(QuotaClient::ID client_id, | |
| 456 const GURL& origin, | |
| 457 StorageType type, | |
| 458 bool enabled); | |
| 459 virtual void GetUsageAndQuota( | |
| 460 base::SequencedTaskRunner* original_task_runner, | |
| 461 const GURL& origin, | |
| 462 StorageType type, | |
| 463 const GetUsageAndQuotaCallback& callback); | |
| 464 | |
| 465 // This method may only be called on the IO thread. | |
| 466 // It may return NULL if the manager has already been deleted. | |
| 467 QuotaManager* quota_manager() const; | |
| 468 | |
| 469 protected: | |
| 470 friend class QuotaManager; | |
| 471 friend class base::RefCountedThreadSafe<QuotaManagerProxy>; | |
| 472 | |
| 473 QuotaManagerProxy(QuotaManager* manager, | |
| 474 base::SingleThreadTaskRunner* io_thread); | |
| 475 virtual ~QuotaManagerProxy(); | |
| 476 | |
| 477 QuotaManager* manager_; // only accessed on the io thread | |
| 478 scoped_refptr<base::SingleThreadTaskRunner> io_thread_; | |
| 479 | |
| 480 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy); | |
| 481 }; | |
| 482 | |
| 483 } // namespace quota | 437 } // namespace quota |
| 484 | 438 |
| 485 #endif // WEBKIT_BROWSER_QUOTA_QUOTA_MANAGER_H_ | 439 #endif // WEBKIT_BROWSER_QUOTA_QUOTA_MANAGER_H_ |
| OLD | NEW |