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 "storage/browser/quota/quota_database.h" | 5 #include "storage/browser/quota/quota_database.h" |
6 | 6 |
| 7 #include <tuple> |
7 #include <vector> | 8 #include <vector> |
8 | 9 |
9 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
12 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
13 #include "sql/connection.h" | 14 #include "sql/connection.h" |
14 #include "sql/meta_table.h" | 15 #include "sql/meta_table.h" |
15 #include "sql/statement.h" | 16 #include "sql/statement.h" |
16 #include "sql/transaction.h" | 17 #include "sql/transaction.h" |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 | 787 |
787 if (!callback.Run(entry)) | 788 if (!callback.Run(entry)) |
788 return true; | 789 return true; |
789 } | 790 } |
790 | 791 |
791 return statement.Succeeded(); | 792 return statement.Succeeded(); |
792 } | 793 } |
793 | 794 |
794 bool operator<(const QuotaDatabase::QuotaTableEntry& lhs, | 795 bool operator<(const QuotaDatabase::QuotaTableEntry& lhs, |
795 const QuotaDatabase::QuotaTableEntry& rhs) { | 796 const QuotaDatabase::QuotaTableEntry& rhs) { |
796 if (lhs.host < rhs.host) return true; | 797 return std::tie(lhs.host, lhs.type, lhs.quota) < |
797 if (rhs.host < lhs.host) return false; | 798 std::tie(rhs.host, rhs.type, rhs.quota); |
798 if (lhs.type < rhs.type) return true; | |
799 if (rhs.type < lhs.type) return false; | |
800 return lhs.quota < rhs.quota; | |
801 } | 799 } |
802 | 800 |
803 bool operator<(const QuotaDatabase::OriginInfoTableEntry& lhs, | 801 bool operator<(const QuotaDatabase::OriginInfoTableEntry& lhs, |
804 const QuotaDatabase::OriginInfoTableEntry& rhs) { | 802 const QuotaDatabase::OriginInfoTableEntry& rhs) { |
805 if (lhs.origin < rhs.origin) return true; | 803 return std::tie(lhs.origin, lhs.type, lhs.used_count, lhs.last_access_time) < |
806 if (rhs.origin < lhs.origin) return false; | 804 std::tie(rhs.origin, rhs.type, rhs.used_count, rhs.last_access_time); |
807 if (lhs.type < rhs.type) return true; | |
808 if (rhs.type < lhs.type) return false; | |
809 if (lhs.used_count < rhs.used_count) return true; | |
810 if (rhs.used_count < lhs.used_count) return false; | |
811 return lhs.last_access_time < rhs.last_access_time; | |
812 } | 805 } |
813 | 806 |
814 } // namespace storage | 807 } // namespace storage |
OLD | NEW |