OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/blob_storage/chrome_blob_storage_context.h" | 5 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 FilePath::FromUTF8Unsafe(base::GenerateGUID())); | 96 FilePath::FromUTF8Unsafe(base::GenerateGUID())); |
97 | 97 |
98 // Only populate the task runner if we're not off the record. This enables | 98 // Only populate the task runner if we're not off the record. This enables |
99 // paging/saving blob data to disk. | 99 // paging/saving blob data to disk. |
100 scoped_refptr<base::TaskRunner> file_task_runner; | 100 scoped_refptr<base::TaskRunner> file_task_runner; |
101 | 101 |
102 // If we're not incognito mode, schedule all of our file tasks to enable | 102 // If we're not incognito mode, schedule all of our file tasks to enable |
103 // disk on the storage context. | 103 // disk on the storage context. |
104 if (!context->IsOffTheRecord() && io_thread_valid) { | 104 if (!context->IsOffTheRecord() && io_thread_valid) { |
105 file_task_runner = base::CreateTaskRunnerWithTraits( | 105 file_task_runner = base::CreateTaskRunnerWithTraits( |
106 base::TaskTraits() | 106 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
107 .MayBlock() | 107 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}); |
108 .WithPriority(base::TaskPriority::BACKGROUND) | |
109 .WithShutdownBehavior( | |
110 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)); | |
111 // Removes our old blob directories if they exist. | 108 // Removes our old blob directories if they exist. |
112 BrowserThread::PostAfterStartupTask( | 109 BrowserThread::PostAfterStartupTask( |
113 FROM_HERE, file_task_runner, | 110 FROM_HERE, file_task_runner, |
114 base::Bind(&RemoveOldBlobStorageDirectories, | 111 base::Bind(&RemoveOldBlobStorageDirectories, |
115 base::Passed(&blob_storage_parent), blob_storage_dir)); | 112 base::Passed(&blob_storage_parent), blob_storage_dir)); |
116 } | 113 } |
117 | 114 |
118 if (io_thread_valid) { | 115 if (io_thread_valid) { |
119 BrowserThread::PostTask( | 116 BrowserThread::PostTask( |
120 BrowserThread::IO, FROM_HERE, | 117 BrowserThread::IO, FROM_HERE, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 if (!handle) | 213 if (!handle) |
217 continue; | 214 continue; |
218 // Ensure the blob and any attached shareable files survive until | 215 // Ensure the blob and any attached shareable files survive until |
219 // upload completion. The |body| takes ownership of |handle|. | 216 // upload completion. The |body| takes ownership of |handle|. |
220 const void* key = handle.get(); | 217 const void* key = handle.get(); |
221 body->SetUserData(key, std::move(handle)); | 218 body->SetUserData(key, std::move(handle)); |
222 } | 219 } |
223 } | 220 } |
224 | 221 |
225 } // namespace content | 222 } // namespace content |
OLD | NEW |