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_manager.h" | 5 #include "storage/browser/quota/quota_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 void QuotaManager::DeleteOnCorrectThread() const { | 1631 void QuotaManager::DeleteOnCorrectThread() const { |
1632 if (!io_thread_->BelongsToCurrentThread() && | 1632 if (!io_thread_->BelongsToCurrentThread() && |
1633 io_thread_->DeleteSoon(FROM_HERE, this)) { | 1633 io_thread_->DeleteSoon(FROM_HERE, this)) { |
1634 return; | 1634 return; |
1635 } | 1635 } |
1636 delete this; | 1636 delete this; |
1637 } | 1637 } |
1638 | 1638 |
1639 void QuotaManager::PostTaskAndReplyWithResultForDBThread( | 1639 void QuotaManager::PostTaskAndReplyWithResultForDBThread( |
1640 const tracked_objects::Location& from_here, | 1640 const tracked_objects::Location& from_here, |
1641 const base::Callback<bool(QuotaDatabase*)>& task, | 1641 base::Callback<bool(QuotaDatabase*)> task, |
1642 const base::Callback<void(bool)>& reply) { | 1642 base::Callback<void(bool)> reply) { |
1643 // Deleting manager will post another task to DB thread to delete | 1643 // Deleting manager will post another task to DB thread to delete |
1644 // |database_|, therefore we can be sure that database_ is alive when this | 1644 // |database_|, therefore we can be sure that database_ is alive when this |
1645 // task runs. | 1645 // task runs. |
1646 base::PostTaskAndReplyWithResult( | 1646 base::PostTaskAndReplyWithResult( |
1647 db_thread_.get(), | 1647 db_thread_.get(), from_here, |
1648 from_here, | 1648 base::Bind(std::move(task), base::Unretained(database_.get())), |
1649 base::Bind(task, base::Unretained(database_.get())), | 1649 std::move(reply)); |
1650 reply); | |
1651 } | 1650 } |
1652 | 1651 |
1653 // static | 1652 // static |
1654 std::tuple<int64_t, int64_t> QuotaManager::CallGetVolumeInfo( | 1653 std::tuple<int64_t, int64_t> QuotaManager::CallGetVolumeInfo( |
1655 GetVolumeInfoFn get_volume_info_fn, | 1654 GetVolumeInfoFn get_volume_info_fn, |
1656 const base::FilePath& path) { | 1655 const base::FilePath& path) { |
1657 // crbug.com/349708 | 1656 // crbug.com/349708 |
1658 TRACE_EVENT0("io", "CallGetVolumeInfo"); | 1657 TRACE_EVENT0("io", "CallGetVolumeInfo"); |
1659 if (!base::CreateDirectory(path)) { | 1658 if (!base::CreateDirectory(path)) { |
1660 LOG(WARNING) << "Create directory failed for path" << path.value(); | 1659 LOG(WARNING) << "Create directory failed for path" << path.value(); |
(...skipping 16 matching lines...) Expand all Loading... |
1677 } | 1676 } |
1678 | 1677 |
1679 // static | 1678 // static |
1680 std::tuple<int64_t, int64_t> QuotaManager::GetVolumeInfo( | 1679 std::tuple<int64_t, int64_t> QuotaManager::GetVolumeInfo( |
1681 const base::FilePath& path) { | 1680 const base::FilePath& path) { |
1682 return std::make_tuple(base::SysInfo::AmountOfTotalDiskSpace(path), | 1681 return std::make_tuple(base::SysInfo::AmountOfTotalDiskSpace(path), |
1683 base::SysInfo::AmountOfFreeDiskSpace(path)); | 1682 base::SysInfo::AmountOfFreeDiskSpace(path)); |
1684 } | 1683 } |
1685 | 1684 |
1686 } // namespace storage | 1685 } // namespace storage |
OLD | NEW |