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 #include "webkit/browser/quota/quota_manager.h" | 5 #include "webkit/browser/quota/quota_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <deque> | 8 #include <deque> |
9 #include <functional> | 9 #include <functional> |
10 #include <set> | 10 #include <set> |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 base::Time modified_since, | 702 base::Time modified_since, |
703 QuotaDatabase* database) { | 703 QuotaDatabase* database) { |
704 DCHECK(database); | 704 DCHECK(database); |
705 return database->GetOriginsModifiedSince(type, &origins_, modified_since); | 705 return database->GetOriginsModifiedSince(type, &origins_, modified_since); |
706 } | 706 } |
707 | 707 |
708 void DidGetModifiedSince(const base::WeakPtr<QuotaManager>& manager, | 708 void DidGetModifiedSince(const base::WeakPtr<QuotaManager>& manager, |
709 const GetOriginsCallback& callback, | 709 const GetOriginsCallback& callback, |
710 StorageType type, | 710 StorageType type, |
711 bool success) { | 711 bool success) { |
712 if (!manager) { | 712 if (!manager.get()) { |
713 // The operation was aborted. | 713 // The operation was aborted. |
714 callback.Run(std::set<GURL>(), type); | 714 callback.Run(std::set<GURL>(), type); |
715 return; | 715 return; |
716 } | 716 } |
717 manager->DidDatabaseWork(success); | 717 manager->DidDatabaseWork(success); |
718 callback.Run(origins_, type); | 718 callback.Run(origins_, type); |
719 } | 719 } |
720 | 720 |
721 private: | 721 private: |
722 std::set<GURL> origins_; | 722 std::set<GURL> origins_; |
723 }; | 723 }; |
724 | 724 |
725 class QuotaManager::DumpQuotaTableHelper { | 725 class QuotaManager::DumpQuotaTableHelper { |
726 public: | 726 public: |
727 bool DumpQuotaTableOnDBThread(QuotaDatabase* database) { | 727 bool DumpQuotaTableOnDBThread(QuotaDatabase* database) { |
728 DCHECK(database); | 728 DCHECK(database); |
729 return database->DumpQuotaTable( | 729 return database->DumpQuotaTable( |
730 new TableCallback(base::Bind(&DumpQuotaTableHelper::AppendEntry, | 730 new TableCallback(base::Bind(&DumpQuotaTableHelper::AppendEntry, |
731 base::Unretained(this)))); | 731 base::Unretained(this)))); |
732 } | 732 } |
733 | 733 |
734 void DidDumpQuotaTable(const base::WeakPtr<QuotaManager>& manager, | 734 void DidDumpQuotaTable(const base::WeakPtr<QuotaManager>& manager, |
735 const DumpQuotaTableCallback& callback, | 735 const DumpQuotaTableCallback& callback, |
736 bool success) { | 736 bool success) { |
737 if (!manager) { | 737 if (!manager.get()) { |
738 // The operation was aborted. | 738 // The operation was aborted. |
739 callback.Run(QuotaTableEntries()); | 739 callback.Run(QuotaTableEntries()); |
740 return; | 740 return; |
741 } | 741 } |
742 manager->DidDatabaseWork(success); | 742 manager->DidDatabaseWork(success); |
743 callback.Run(entries_); | 743 callback.Run(entries_); |
744 } | 744 } |
745 | 745 |
746 private: | 746 private: |
747 typedef QuotaDatabase::QuotaTableCallback TableCallback; | 747 typedef QuotaDatabase::QuotaTableCallback TableCallback; |
(...skipping 11 matching lines...) Expand all Loading... |
759 bool DumpOriginInfoTableOnDBThread(QuotaDatabase* database) { | 759 bool DumpOriginInfoTableOnDBThread(QuotaDatabase* database) { |
760 DCHECK(database); | 760 DCHECK(database); |
761 return database->DumpOriginInfoTable( | 761 return database->DumpOriginInfoTable( |
762 new TableCallback(base::Bind(&DumpOriginInfoTableHelper::AppendEntry, | 762 new TableCallback(base::Bind(&DumpOriginInfoTableHelper::AppendEntry, |
763 base::Unretained(this)))); | 763 base::Unretained(this)))); |
764 } | 764 } |
765 | 765 |
766 void DidDumpOriginInfoTable(const base::WeakPtr<QuotaManager>& manager, | 766 void DidDumpOriginInfoTable(const base::WeakPtr<QuotaManager>& manager, |
767 const DumpOriginInfoTableCallback& callback, | 767 const DumpOriginInfoTableCallback& callback, |
768 bool success) { | 768 bool success) { |
769 if (!manager) { | 769 if (!manager.get()) { |
770 // The operation was aborted. | 770 // The operation was aborted. |
771 callback.Run(OriginInfoTableEntries()); | 771 callback.Run(OriginInfoTableEntries()); |
772 return; | 772 return; |
773 } | 773 } |
774 manager->DidDatabaseWork(success); | 774 manager->DidDatabaseWork(success); |
775 callback.Run(entries_); | 775 callback.Run(entries_); |
776 } | 776 } |
777 | 777 |
778 private: | 778 private: |
779 typedef QuotaDatabase::OriginInfoTableCallback TableCallback; | 779 typedef QuotaDatabase::OriginInfoTableCallback TableCallback; |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1656 | 1656 |
1657 QuotaManagerProxy::QuotaManagerProxy( | 1657 QuotaManagerProxy::QuotaManagerProxy( |
1658 QuotaManager* manager, base::SingleThreadTaskRunner* io_thread) | 1658 QuotaManager* manager, base::SingleThreadTaskRunner* io_thread) |
1659 : manager_(manager), io_thread_(io_thread) { | 1659 : manager_(manager), io_thread_(io_thread) { |
1660 } | 1660 } |
1661 | 1661 |
1662 QuotaManagerProxy::~QuotaManagerProxy() { | 1662 QuotaManagerProxy::~QuotaManagerProxy() { |
1663 } | 1663 } |
1664 | 1664 |
1665 } // namespace quota | 1665 } // namespace quota |
OLD | NEW |