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