| 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 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1804 void QuotaManager::DeleteOnCorrectThread() const { | 1804 void QuotaManager::DeleteOnCorrectThread() const { |
| 1805 if (!io_thread_->BelongsToCurrentThread() && | 1805 if (!io_thread_->BelongsToCurrentThread() && |
| 1806 io_thread_->DeleteSoon(FROM_HERE, this)) { | 1806 io_thread_->DeleteSoon(FROM_HERE, this)) { |
| 1807 return; | 1807 return; |
| 1808 } | 1808 } |
| 1809 delete this; | 1809 delete this; |
| 1810 } | 1810 } |
| 1811 | 1811 |
| 1812 void QuotaManager::PostTaskAndReplyWithResultForDBThread( | 1812 void QuotaManager::PostTaskAndReplyWithResultForDBThread( |
| 1813 const tracked_objects::Location& from_here, | 1813 const tracked_objects::Location& from_here, |
| 1814 const base::Callback<bool(QuotaDatabase*)>& task, | 1814 base::Callback<bool(QuotaDatabase*)> task, |
| 1815 const base::Callback<void(bool)>& reply) { | 1815 base::Callback<void(bool)> reply) { |
| 1816 // Deleting manager will post another task to DB thread to delete | 1816 // Deleting manager will post another task to DB thread to delete |
| 1817 // |database_|, therefore we can be sure that database_ is alive when this | 1817 // |database_|, therefore we can be sure that database_ is alive when this |
| 1818 // task runs. | 1818 // task runs. |
| 1819 base::PostTaskAndReplyWithResult( | 1819 base::PostTaskAndReplyWithResult( |
| 1820 db_thread_.get(), | 1820 db_thread_.get(), from_here, |
| 1821 from_here, | 1821 base::Bind(std::move(task), base::Unretained(database_.get())), |
| 1822 base::Bind(task, base::Unretained(database_.get())), | 1822 std::move(reply)); |
| 1823 reply); | |
| 1824 } | 1823 } |
| 1825 | 1824 |
| 1826 // static | 1825 // static |
| 1827 int64_t QuotaManager::CallGetAmountOfFreeDiskSpace( | 1826 int64_t QuotaManager::CallGetAmountOfFreeDiskSpace( |
| 1828 GetVolumeInfoFn get_volume_info_fn, | 1827 GetVolumeInfoFn get_volume_info_fn, |
| 1829 const base::FilePath& profile_path) { | 1828 const base::FilePath& profile_path) { |
| 1830 // crbug.com/349708 | 1829 // crbug.com/349708 |
| 1831 TRACE_EVENT0("io", "CallSystemGetAmountOfFreeDiskSpace"); | 1830 TRACE_EVENT0("io", "CallSystemGetAmountOfFreeDiskSpace"); |
| 1832 if (!base::CreateDirectory(profile_path)) { | 1831 if (!base::CreateDirectory(profile_path)) { |
| 1833 LOG(WARNING) << "Create directory failed for path" << profile_path.value(); | 1832 LOG(WARNING) << "Create directory failed for path" << profile_path.value(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1855 int64_t total = base::SysInfo::AmountOfTotalDiskSpace(path); | 1854 int64_t total = base::SysInfo::AmountOfTotalDiskSpace(path); |
| 1856 if (total < 0) | 1855 if (total < 0) |
| 1857 return false; | 1856 return false; |
| 1858 | 1857 |
| 1859 *available_space = static_cast<uint64_t>(available); | 1858 *available_space = static_cast<uint64_t>(available); |
| 1860 *total_size = static_cast<uint64_t>(total); | 1859 *total_size = static_cast<uint64_t>(total); |
| 1861 return true; | 1860 return true; |
| 1862 } | 1861 } |
| 1863 | 1862 |
| 1864 } // namespace storage | 1863 } // namespace storage |
| OLD | NEW |