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