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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 return false; | 469 return false; |
470 } | 470 } |
471 | 471 |
472 // Start a long-running transaction. | 472 // Start a long-running transaction. |
473 db_->BeginTransaction(); | 473 db_->BeginTransaction(); |
474 | 474 |
475 return true; | 475 return true; |
476 } | 476 } |
477 | 477 |
478 bool QuotaDatabase::EnsureDatabaseVersion() { | 478 bool QuotaDatabase::EnsureDatabaseVersion() { |
479 static const size_t kTableCount = ARRAYSIZE_UNSAFE(kTables); | 479 static const size_t kTableCount = arraysize(kTables); |
480 static const size_t kIndexCount = ARRAYSIZE_UNSAFE(kIndexes); | 480 static const size_t kIndexCount = arraysize(kIndexes); |
481 if (!sql::MetaTable::DoesTableExist(db_.get())) | 481 if (!sql::MetaTable::DoesTableExist(db_.get())) |
482 return CreateSchema(db_.get(), meta_table_.get(), | 482 return CreateSchema(db_.get(), meta_table_.get(), |
483 kCurrentVersion, kCompatibleVersion, | 483 kCurrentVersion, kCompatibleVersion, |
484 kTables, kTableCount, | 484 kTables, kTableCount, |
485 kIndexes, kIndexCount); | 485 kIndexes, kIndexCount); |
486 | 486 |
487 if (!meta_table_->Init(db_.get(), kCurrentVersion, kCompatibleVersion)) | 487 if (!meta_table_->Init(db_.get(), kCurrentVersion, kCompatibleVersion)) |
488 return false; | 488 return false; |
489 | 489 |
490 if (meta_table_->GetCompatibleVersionNumber() > kCurrentVersion) { | 490 if (meta_table_->GetCompatibleVersionNumber() > kCurrentVersion) { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 if (lhs.origin < rhs.origin) return true; | 648 if (lhs.origin < rhs.origin) return true; |
649 if (rhs.origin < lhs.origin) return false; | 649 if (rhs.origin < lhs.origin) return false; |
650 if (lhs.type < rhs.type) return true; | 650 if (lhs.type < rhs.type) return true; |
651 if (rhs.type < lhs.type) return false; | 651 if (rhs.type < lhs.type) return false; |
652 if (lhs.used_count < rhs.used_count) return true; | 652 if (lhs.used_count < rhs.used_count) return true; |
653 if (rhs.used_count < lhs.used_count) return false; | 653 if (rhs.used_count < lhs.used_count) return false; |
654 return lhs.last_access_time < rhs.last_access_time; | 654 return lhs.last_access_time < rhs.last_access_time; |
655 } | 655 } |
656 | 656 |
657 } // namespace storage | 657 } // namespace storage |
OLD | NEW |