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 "chrome/browser/chromeos/drive/write_on_cache_file.h" | 5 #include "chrome/browser/chromeos/drive/write_on_cache_file.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/task_scheduler/post_task.h" | 9 #include "base/task_scheduler/post_task.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 void WriteOnCacheFileAfterOpenFile( | 33 void WriteOnCacheFileAfterOpenFile( |
34 const base::FilePath& drive_path, | 34 const base::FilePath& drive_path, |
35 const WriteOnCacheFileCallback& file_io_task_callback, | 35 const WriteOnCacheFileCallback& file_io_task_callback, |
36 const FileOperationCallback& reply, | 36 const FileOperationCallback& reply, |
37 FileError error, | 37 FileError error, |
38 const base::FilePath& local_cache_path, | 38 const base::FilePath& local_cache_path, |
39 const base::Closure& close_callback) { | 39 const base::Closure& close_callback) { |
40 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 40 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
41 | 41 |
42 base::PostTaskWithTraitsAndReply( | 42 base::PostTaskWithTraitsAndReply( |
43 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 43 FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING}, |
44 base::TaskPriority::USER_BLOCKING), | |
45 base::Bind(file_io_task_callback, error, local_cache_path), | 44 base::Bind(file_io_task_callback, error, local_cache_path), |
46 base::Bind(&RunCloseCallbackAndReplyTask, close_callback, reply, error)); | 45 base::Bind(&RunCloseCallbackAndReplyTask, close_callback, reply, error)); |
47 } | 46 } |
48 | 47 |
49 } // namespace | 48 } // namespace |
50 | 49 |
51 void WriteOnCacheFile(FileSystemInterface* file_system, | 50 void WriteOnCacheFile(FileSystemInterface* file_system, |
52 const base::FilePath& path, | 51 const base::FilePath& path, |
53 const std::string& mime_type, | 52 const std::string& mime_type, |
54 const WriteOnCacheFileCallback& callback) { | 53 const WriteOnCacheFileCallback& callback) { |
(...skipping 12 matching lines...) Expand all Loading... |
67 DCHECK(!reply.is_null()); | 66 DCHECK(!reply.is_null()); |
68 | 67 |
69 file_system->OpenFile( | 68 file_system->OpenFile( |
70 path, | 69 path, |
71 OPEN_OR_CREATE_FILE, | 70 OPEN_OR_CREATE_FILE, |
72 mime_type, | 71 mime_type, |
73 base::Bind(&WriteOnCacheFileAfterOpenFile, path, callback, reply)); | 72 base::Bind(&WriteOnCacheFileAfterOpenFile, path, callback, reply)); |
74 } | 73 } |
75 | 74 |
76 } // namespace drive | 75 } // namespace drive |
OLD | NEW |