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

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. 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 return false; 307 return false;
308 default: 308 default:
309 NOTREACHED(); 309 NOTREACHED();
310 } 310 }
311 return true; 311 return true;
312 } 312 }
313 313
314 scoped_ptr<storage::FileStreamReader> FileSystemBackend::CreateFileStreamReader( 314 scoped_ptr<storage::FileStreamReader> FileSystemBackend::CreateFileStreamReader(
315 const storage::FileSystemURL& url, 315 const storage::FileSystemURL& url,
316 int64 offset, 316 int64 offset,
317 int64 length,
317 const base::Time& expected_modification_time, 318 const base::Time& expected_modification_time,
318 storage::FileSystemContext* context) const { 319 storage::FileSystemContext* context) const {
319 DCHECK(url.is_valid()); 320 DCHECK(url.is_valid());
320 321
321 if (!IsAccessAllowed(url)) 322 if (!IsAccessAllowed(url))
322 return scoped_ptr<storage::FileStreamReader>(); 323 return scoped_ptr<storage::FileStreamReader>();
323 324
324 switch (url.type()) { 325 switch (url.type()) {
325 case storage::kFileSystemTypeDrive: 326 case storage::kFileSystemTypeDrive:
326 return drive_delegate_->CreateFileStreamReader( 327 return drive_delegate_->CreateFileStreamReader(
327 url, offset, expected_modification_time, context); 328 url, offset, length, expected_modification_time, context);
328 case storage::kFileSystemTypeProvided: 329 case storage::kFileSystemTypeProvided:
329 return file_system_provider_delegate_->CreateFileStreamReader( 330 return file_system_provider_delegate_->CreateFileStreamReader(
330 url, offset, expected_modification_time, context); 331 url, offset, length, expected_modification_time, context);
331 case storage::kFileSystemTypeNativeLocal: 332 case storage::kFileSystemTypeNativeLocal:
332 case storage::kFileSystemTypeRestrictedNativeLocal: 333 case storage::kFileSystemTypeRestrictedNativeLocal:
333 return scoped_ptr<storage::FileStreamReader>( 334 return scoped_ptr<storage::FileStreamReader>(
334 storage::FileStreamReader::CreateForFileSystemFile( 335 storage::FileStreamReader::CreateForFileSystemFile(
335 context, url, offset, expected_modification_time)); 336 context, url, offset, expected_modification_time));
336 case storage::kFileSystemTypeDeviceMediaAsFileStorage: 337 case storage::kFileSystemTypeDeviceMediaAsFileStorage:
337 return mtp_delegate_->CreateFileStreamReader( 338 return mtp_delegate_->CreateFileStreamReader(
338 url, offset, expected_modification_time, context); 339 url, offset, length, expected_modification_time, context);
339 default: 340 default:
340 NOTREACHED(); 341 NOTREACHED();
341 } 342 }
342 return scoped_ptr<storage::FileStreamReader>(); 343 return scoped_ptr<storage::FileStreamReader>();
343 } 344 }
344 345
345 scoped_ptr<storage::FileStreamWriter> FileSystemBackend::CreateFileStreamWriter( 346 scoped_ptr<storage::FileStreamWriter> FileSystemBackend::CreateFileStreamWriter(
346 const storage::FileSystemURL& url, 347 const storage::FileSystemURL& url,
347 int64 offset, 348 int64 offset,
348 storage::FileSystemContext* context) const { 349 storage::FileSystemContext* context) const {
(...skipping 27 matching lines...) Expand all
376 } 377 }
377 378
378 bool FileSystemBackend::GetVirtualPath( 379 bool FileSystemBackend::GetVirtualPath(
379 const base::FilePath& filesystem_path, 380 const base::FilePath& filesystem_path,
380 base::FilePath* virtual_path) { 381 base::FilePath* virtual_path) {
381 return mount_points_->GetVirtualPath(filesystem_path, virtual_path) || 382 return mount_points_->GetVirtualPath(filesystem_path, virtual_path) ||
382 system_mount_points_->GetVirtualPath(filesystem_path, virtual_path); 383 system_mount_points_->GetVirtualPath(filesystem_path, virtual_path);
383 } 384 }
384 385
385 } // namespace chromeos 386 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698