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

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: Rebased. Created 6 years, 3 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 return false; 312 return false;
313 default: 313 default:
314 NOTREACHED(); 314 NOTREACHED();
315 } 315 }
316 return true; 316 return true;
317 } 317 }
318 318
319 scoped_ptr<storage::FileStreamReader> FileSystemBackend::CreateFileStreamReader( 319 scoped_ptr<storage::FileStreamReader> FileSystemBackend::CreateFileStreamReader(
320 const storage::FileSystemURL& url, 320 const storage::FileSystemURL& url,
321 int64 offset, 321 int64 offset,
322 int64 max_bytes_to_read,
322 const base::Time& expected_modification_time, 323 const base::Time& expected_modification_time,
323 storage::FileSystemContext* context) const { 324 storage::FileSystemContext* context) const {
324 DCHECK(url.is_valid()); 325 DCHECK(url.is_valid());
325 326
326 if (!IsAccessAllowed(url)) 327 if (!IsAccessAllowed(url))
327 return scoped_ptr<storage::FileStreamReader>(); 328 return scoped_ptr<storage::FileStreamReader>();
328 329
329 switch (url.type()) { 330 switch (url.type()) {
330 case storage::kFileSystemTypeDrive: 331 case storage::kFileSystemTypeDrive:
331 return drive_delegate_->CreateFileStreamReader( 332 return drive_delegate_->CreateFileStreamReader(
332 url, offset, expected_modification_time, context); 333 url, offset, max_bytes_to_read, expected_modification_time, context);
333 case storage::kFileSystemTypeProvided: 334 case storage::kFileSystemTypeProvided:
334 return file_system_provider_delegate_->CreateFileStreamReader( 335 return file_system_provider_delegate_->CreateFileStreamReader(
335 url, offset, expected_modification_time, context); 336 url, offset, max_bytes_to_read, expected_modification_time, context);
336 case storage::kFileSystemTypeNativeLocal: 337 case storage::kFileSystemTypeNativeLocal:
337 case storage::kFileSystemTypeRestrictedNativeLocal: 338 case storage::kFileSystemTypeRestrictedNativeLocal:
338 return scoped_ptr<storage::FileStreamReader>( 339 return scoped_ptr<storage::FileStreamReader>(
339 storage::FileStreamReader::CreateForFileSystemFile( 340 storage::FileStreamReader::CreateForFileSystemFile(
340 context, url, offset, expected_modification_time)); 341 context, url, offset, expected_modification_time));
341 case storage::kFileSystemTypeDeviceMediaAsFileStorage: 342 case storage::kFileSystemTypeDeviceMediaAsFileStorage:
342 return mtp_delegate_->CreateFileStreamReader( 343 return mtp_delegate_->CreateFileStreamReader(
343 url, offset, expected_modification_time, context); 344 url, offset, max_bytes_to_read, expected_modification_time, context);
344 default: 345 default:
345 NOTREACHED(); 346 NOTREACHED();
346 } 347 }
347 return scoped_ptr<storage::FileStreamReader>(); 348 return scoped_ptr<storage::FileStreamReader>();
348 } 349 }
349 350
350 scoped_ptr<storage::FileStreamWriter> FileSystemBackend::CreateFileStreamWriter( 351 scoped_ptr<storage::FileStreamWriter> FileSystemBackend::CreateFileStreamWriter(
351 const storage::FileSystemURL& url, 352 const storage::FileSystemURL& url,
352 int64 offset, 353 int64 offset,
353 storage::FileSystemContext* context) const { 354 storage::FileSystemContext* context) const {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 case storage::kFileSystemTypeRestrictedNativeLocal: 411 case storage::kFileSystemTypeRestrictedNativeLocal:
411 callback.Run(GURL()); 412 callback.Run(GURL());
412 return; 413 return;
413 default: 414 default:
414 NOTREACHED(); 415 NOTREACHED();
415 } 416 }
416 callback.Run(GURL()); 417 callback.Run(GURL());
417 } 418 }
418 419
419 } // namespace chromeos 420 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698