OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/file_manager/snapshot_manager.h" | 5 #include "chrome/browser/chromeos/file_manager/snapshot_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/sys_info.h" | 8 #include "base/sys_info.h" |
9 #include "base/task_scheduler/post_task.h" | 9 #include "base/task_scheduler/post_task.h" |
10 #include "chrome/browser/chromeos/file_manager/app_id.h" | 10 #include "chrome/browser/chromeos/file_manager/app_id.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 const GetNecessaryFreeSpaceCallback& callback, | 41 const GetNecessaryFreeSpaceCallback& callback, |
42 base::File::Error result, | 42 base::File::Error result, |
43 const base::File::Info& file_info) { | 43 const base::File::Info& file_info) { |
44 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 44 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
45 if (result != base::File::FILE_OK) { | 45 if (result != base::File::FILE_OK) { |
46 callback.Run(-1); | 46 callback.Run(-1); |
47 return; | 47 return; |
48 } | 48 } |
49 | 49 |
50 base::PostTaskWithTraitsAndReplyWithResult( | 50 base::PostTaskWithTraitsAndReplyWithResult( |
51 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 51 FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING}, |
52 base::TaskPriority::USER_BLOCKING), | |
53 base::Bind(&ComputeSpaceNeedToBeFreedAfterGetMetadataAsync, path, | 52 base::Bind(&ComputeSpaceNeedToBeFreedAfterGetMetadataAsync, path, |
54 file_info.size), | 53 file_info.size), |
55 callback); | 54 callback); |
56 } | 55 } |
57 | 56 |
58 // Part of ComputeSpaceNeedToBeFreed. | 57 // Part of ComputeSpaceNeedToBeFreed. |
59 void GetMetadataOnIOThread(const base::FilePath& path, | 58 void GetMetadataOnIOThread(const base::FilePath& path, |
60 scoped_refptr<storage::FileSystemContext> context, | 59 scoped_refptr<storage::FileSystemContext> context, |
61 const storage::FileSystemURL& url, | 60 const storage::FileSystemURL& url, |
62 const GetNecessaryFreeSpaceCallback& callback) { | 61 const GetNecessaryFreeSpaceCallback& callback) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 if (result != base::File::FILE_OK) { | 205 if (result != base::File::FILE_OK) { |
207 callback.Run(base::FilePath()); | 206 callback.Run(base::FilePath()); |
208 return; | 207 return; |
209 } | 208 } |
210 | 209 |
211 file_refs_.push_back(FileReferenceWithSizeInfo(file_ref, file_info.size)); | 210 file_refs_.push_back(FileReferenceWithSizeInfo(file_ref, file_info.size)); |
212 callback.Run(platform_path); | 211 callback.Run(platform_path); |
213 } | 212 } |
214 | 213 |
215 } // namespace file_manager | 214 } // namespace file_manager |
OLD | NEW |