| 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/fileapi/file_system_context.h" | 5 #include "webkit/fileapi/file_system_context.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 if (!CrackFileSystemURL(url, &origin_url, &file_system_type, &file_path)) | 173 if (!CrackFileSystemURL(url, &origin_url, &file_system_type, &file_path)) |
| 174 return NULL; | 174 return NULL; |
| 175 FileSystemMountPointProvider* mount_point_provider = | 175 FileSystemMountPointProvider* mount_point_provider = |
| 176 GetMountPointProvider(file_system_type); | 176 GetMountPointProvider(file_system_type); |
| 177 if (!mount_point_provider) | 177 if (!mount_point_provider) |
| 178 return NULL; | 178 return NULL; |
| 179 return mount_point_provider->CreateFileSystemOperation( | 179 return mount_point_provider->CreateFileSystemOperation( |
| 180 origin_url, file_system_type, file_path, this); | 180 origin_url, file_system_type, file_path, this); |
| 181 } | 181 } |
| 182 | 182 |
| 183 webkit_blob::FileReader* FileSystemContext::CreateFileReader( | 183 webkit_blob::FileStreamReader* FileSystemContext::CreateFileStreamReader( |
| 184 const GURL& url, | 184 const GURL& url, |
| 185 int64 offset) { | 185 int64 offset) { |
| 186 GURL origin_url; | 186 GURL origin_url; |
| 187 FileSystemType file_system_type = kFileSystemTypeUnknown; | 187 FileSystemType file_system_type = kFileSystemTypeUnknown; |
| 188 FilePath file_path; | 188 FilePath file_path; |
| 189 if (!CrackFileSystemURL(url, &origin_url, &file_system_type, &file_path)) | 189 if (!CrackFileSystemURL(url, &origin_url, &file_system_type, &file_path)) |
| 190 return NULL; | 190 return NULL; |
| 191 FileSystemMountPointProvider* mount_point_provider = | 191 FileSystemMountPointProvider* mount_point_provider = |
| 192 GetMountPointProvider(file_system_type); | 192 GetMountPointProvider(file_system_type); |
| 193 if (!mount_point_provider) | 193 if (!mount_point_provider) |
| 194 return NULL; | 194 return NULL; |
| 195 return mount_point_provider->CreateFileReader(url, offset, this); | 195 return mount_point_provider->CreateFileStreamReader(url, offset, this); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void FileSystemContext::RegisterMountPointProvider( | 198 void FileSystemContext::RegisterMountPointProvider( |
| 199 FileSystemType type, | 199 FileSystemType type, |
| 200 FileSystemMountPointProvider* provider) { | 200 FileSystemMountPointProvider* provider) { |
| 201 DCHECK(provider); | 201 DCHECK(provider); |
| 202 DCHECK(provider_map_.find(type) == provider_map_.end()); | 202 DCHECK(provider_map_.find(type) == provider_map_.end()); |
| 203 provider_map_[type] = provider; | 203 provider_map_[type] = provider; |
| 204 } | 204 } |
| 205 | 205 |
| 206 FileSystemContext::~FileSystemContext() {} | 206 FileSystemContext::~FileSystemContext() {} |
| 207 | 207 |
| 208 void FileSystemContext::DeleteOnCorrectThread() const { | 208 void FileSystemContext::DeleteOnCorrectThread() const { |
| 209 if (!io_task_runner_->RunsTasksOnCurrentThread() && | 209 if (!io_task_runner_->RunsTasksOnCurrentThread() && |
| 210 io_task_runner_->DeleteSoon(FROM_HERE, this)) { | 210 io_task_runner_->DeleteSoon(FROM_HERE, this)) { |
| 211 return; | 211 return; |
| 212 } | 212 } |
| 213 STLDeleteContainerPairSecondPointers(provider_map_.begin(), | 213 STLDeleteContainerPairSecondPointers(provider_map_.begin(), |
| 214 provider_map_.end()); | 214 provider_map_.end()); |
| 215 delete this; | 215 delete this; |
| 216 } | 216 } |
| 217 | 217 |
| 218 } // namespace fileapi | 218 } // namespace fileapi |
| OLD | NEW |