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 "webkit/browser/fileapi/file_system_context.h" | 5 #include "webkit/browser/fileapi/file_system_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 // Additional mount points must be added before regular system-wide | 164 // Additional mount points must be added before regular system-wide |
165 // mount points. | 165 // mount points. |
166 if (external_mount_points) | 166 if (external_mount_points) |
167 url_crackers_.push_back(external_mount_points); | 167 url_crackers_.push_back(external_mount_points); |
168 url_crackers_.push_back(ExternalMountPoints::GetSystemInstance()); | 168 url_crackers_.push_back(ExternalMountPoints::GetSystemInstance()); |
169 url_crackers_.push_back(IsolatedContext::GetInstance()); | 169 url_crackers_.push_back(IsolatedContext::GetInstance()); |
170 } | 170 } |
171 | 171 |
172 bool FileSystemContext::DeleteDataForOriginOnFileThread( | 172 bool FileSystemContext::DeleteDataForOriginOnFileTaskRunner( |
173 const GURL& origin_url) { | 173 const GURL& origin_url) { |
174 DCHECK(default_file_task_runner()->RunsTasksOnCurrentThread()); | 174 DCHECK(default_file_task_runner()->RunsTasksOnCurrentThread()); |
175 DCHECK(origin_url == origin_url.GetOrigin()); | 175 DCHECK(origin_url == origin_url.GetOrigin()); |
176 | 176 |
177 bool success = true; | 177 bool success = true; |
178 for (FileSystemBackendMap::iterator iter = backend_map_.begin(); | 178 for (FileSystemBackendMap::iterator iter = backend_map_.begin(); |
179 iter != backend_map_.end(); | 179 iter != backend_map_.end(); |
180 ++iter) { | 180 ++iter) { |
181 FileSystemBackend* backend = iter->second; | 181 FileSystemBackend* backend = iter->second; |
182 if (!backend->GetQuotaUtil()) | 182 if (!backend->GetQuotaUtil()) |
183 continue; | 183 continue; |
184 if (backend->GetQuotaUtil()->DeleteOriginDataOnFileThread( | 184 if (backend->GetQuotaUtil()->DeleteOriginDataOnFileTaskRunner( |
185 this, quota_manager_proxy(), origin_url, iter->first) | 185 this, quota_manager_proxy(), origin_url, iter->first) |
186 != base::PLATFORM_FILE_OK) { | 186 != base::PLATFORM_FILE_OK) { |
187 // Continue the loop, but record the failure. | 187 // Continue the loop, but record the failure. |
188 success = false; | 188 success = false; |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 return success; | 192 return success; |
193 } | 193 } |
194 | 194 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 } | 360 } |
361 if (!backend->GetQuotaUtil()) { | 361 if (!backend->GetQuotaUtil()) { |
362 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); | 362 callback.Run(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); |
363 return; | 363 return; |
364 } | 364 } |
365 | 365 |
366 base::PostTaskAndReplyWithResult( | 366 base::PostTaskAndReplyWithResult( |
367 default_file_task_runner(), | 367 default_file_task_runner(), |
368 FROM_HERE, | 368 FROM_HERE, |
369 // It is safe to pass Unretained(quota_util) since context owns it. | 369 // It is safe to pass Unretained(quota_util) since context owns it. |
370 base::Bind(&FileSystemQuotaUtil::DeleteOriginDataOnFileThread, | 370 base::Bind(&FileSystemQuotaUtil::DeleteOriginDataOnFileTaskRunner, |
371 base::Unretained(backend->GetQuotaUtil()), | 371 base::Unretained(backend->GetQuotaUtil()), |
372 make_scoped_refptr(this), | 372 make_scoped_refptr(this), |
373 base::Unretained(quota_manager_proxy()), | 373 base::Unretained(quota_manager_proxy()), |
374 origin_url, | 374 origin_url, |
375 type), | 375 type), |
376 callback); | 376 callback); |
377 } | 377 } |
378 | 378 |
379 scoped_ptr<webkit_blob::FileStreamReader> | 379 scoped_ptr<webkit_blob::FileStreamReader> |
380 FileSystemContext::CreateFileStreamReader( | 380 FileSystemContext::CreateFileStreamReader( |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
563 } else if (parent != child) { | 563 } else if (parent != child) { |
564 bool result = parent.AppendRelativePath(child, &path); | 564 bool result = parent.AppendRelativePath(child, &path); |
565 DCHECK(result); | 565 DCHECK(result); |
566 } | 566 } |
567 | 567 |
568 operation_runner()->GetMetadata( | 568 operation_runner()->GetMetadata( |
569 url, base::Bind(&DidGetMetadataForResolveURL, path, callback, info)); | 569 url, base::Bind(&DidGetMetadataForResolveURL, path, callback, info)); |
570 } | 570 } |
571 | 571 |
572 } // namespace fileapi | 572 } // namespace fileapi |
OLD | NEW |