Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: chrome/browser/chromeos/fileapi/file_system_backend.cc

Issue 470323003: [fsp] Improve performance for reading small chunks of data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed a dcheck. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/fileapi/file_system_backend.h" 5 #include "chrome/browser/chromeos/fileapi/file_system_backend.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/chromeos/fileapi/file_access_permissions.h" 10 #include "chrome/browser/chromeos/fileapi/file_access_permissions.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 default: 304 default:
305 NOTREACHED(); 305 NOTREACHED();
306 } 306 }
307 return true; 307 return true;
308 } 308 }
309 309
310 scoped_ptr<webkit_blob::FileStreamReader> 310 scoped_ptr<webkit_blob::FileStreamReader>
311 FileSystemBackend::CreateFileStreamReader( 311 FileSystemBackend::CreateFileStreamReader(
312 const fileapi::FileSystemURL& url, 312 const fileapi::FileSystemURL& url,
313 int64 offset, 313 int64 offset,
314 int64 length,
314 const base::Time& expected_modification_time, 315 const base::Time& expected_modification_time,
315 fileapi::FileSystemContext* context) const { 316 fileapi::FileSystemContext* context) const {
316 DCHECK(url.is_valid()); 317 DCHECK(url.is_valid());
317 318
318 if (!IsAccessAllowed(url)) 319 if (!IsAccessAllowed(url))
319 return scoped_ptr<webkit_blob::FileStreamReader>(); 320 return scoped_ptr<webkit_blob::FileStreamReader>();
320 321
321 switch (url.type()) { 322 switch (url.type()) {
322 case fileapi::kFileSystemTypeDrive: 323 case fileapi::kFileSystemTypeDrive:
323 return drive_delegate_->CreateFileStreamReader( 324 return drive_delegate_->CreateFileStreamReader(
324 url, offset, expected_modification_time, context); 325 url, offset, length, expected_modification_time, context);
325 case fileapi::kFileSystemTypeProvided: 326 case fileapi::kFileSystemTypeProvided:
326 return file_system_provider_delegate_->CreateFileStreamReader( 327 return file_system_provider_delegate_->CreateFileStreamReader(
327 url, offset, expected_modification_time, context); 328 url, offset, length, expected_modification_time, context);
328 case fileapi::kFileSystemTypeNativeLocal: 329 case fileapi::kFileSystemTypeNativeLocal:
329 case fileapi::kFileSystemTypeRestrictedNativeLocal: 330 case fileapi::kFileSystemTypeRestrictedNativeLocal:
330 return scoped_ptr<webkit_blob::FileStreamReader>( 331 return scoped_ptr<webkit_blob::FileStreamReader>(
331 webkit_blob::FileStreamReader::CreateForFileSystemFile( 332 webkit_blob::FileStreamReader::CreateForFileSystemFile(
332 context, url, offset, expected_modification_time)); 333 context, url, offset, expected_modification_time));
333 case fileapi::kFileSystemTypeDeviceMediaAsFileStorage: 334 case fileapi::kFileSystemTypeDeviceMediaAsFileStorage:
334 return mtp_delegate_->CreateFileStreamReader( 335 return mtp_delegate_->CreateFileStreamReader(
335 url, offset, expected_modification_time, context); 336 url, offset, length, expected_modification_time, context);
336 default: 337 default:
337 NOTREACHED(); 338 NOTREACHED();
338 } 339 }
339 return scoped_ptr<webkit_blob::FileStreamReader>(); 340 return scoped_ptr<webkit_blob::FileStreamReader>();
340 } 341 }
341 342
342 scoped_ptr<fileapi::FileStreamWriter> 343 scoped_ptr<fileapi::FileStreamWriter>
343 FileSystemBackend::CreateFileStreamWriter( 344 FileSystemBackend::CreateFileStreamWriter(
344 const fileapi::FileSystemURL& url, 345 const fileapi::FileSystemURL& url,
345 int64 offset, 346 int64 offset,
(...skipping 26 matching lines...) Expand all
372 } 373 }
373 374
374 bool FileSystemBackend::GetVirtualPath( 375 bool FileSystemBackend::GetVirtualPath(
375 const base::FilePath& filesystem_path, 376 const base::FilePath& filesystem_path,
376 base::FilePath* virtual_path) { 377 base::FilePath* virtual_path) {
377 return mount_points_->GetVirtualPath(filesystem_path, virtual_path) || 378 return mount_points_->GetVirtualPath(filesystem_path, virtual_path) ||
378 system_mount_points_->GetVirtualPath(filesystem_path, virtual_path); 379 system_mount_points_->GetVirtualPath(filesystem_path, virtual_path);
379 } 380 }
380 381
381 } // namespace chromeos 382 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698