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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reader.cc

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/file_system_provider/fileapi/file_stream_reade r.h" 5 #include "chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reade r.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/files/file.h" 8 #include "base/files/file.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "chrome/browser/chromeos/file_system_provider/fileapi/provider_async_fi le_util.h" 10 #include "chrome/browser/chromeos/file_system_provider/fileapi/provider_async_fi le_util.h"
(...skipping 15 matching lines...) Expand all
26 26
27 // Converts net::CompletionCallback to net::Int64CompletionCallback. 27 // Converts net::CompletionCallback to net::Int64CompletionCallback.
28 void Int64ToIntCompletionCallback(net::CompletionCallback callback, 28 void Int64ToIntCompletionCallback(net::CompletionCallback callback,
29 int64 result) { 29 int64 result) {
30 callback.Run(static_cast<int>(result)); 30 callback.Run(static_cast<int>(result));
31 } 31 }
32 32
33 // Opens a file for reading and calls the completion callback. Must be called 33 // Opens a file for reading and calls the completion callback. Must be called
34 // on UI thread. 34 // on UI thread.
35 void OpenFileOnUIThread( 35 void OpenFileOnUIThread(
36 const fileapi::FileSystemURL& url, 36 const storage::FileSystemURL& url,
37 const FileStreamReader::OpenFileCompletedCallback& callback) { 37 const FileStreamReader::OpenFileCompletedCallback& callback) {
38 DCHECK_CURRENTLY_ON(BrowserThread::UI); 38 DCHECK_CURRENTLY_ON(BrowserThread::UI);
39 39
40 util::FileSystemURLParser parser(url); 40 util::FileSystemURLParser parser(url);
41 if (!parser.Parse()) { 41 if (!parser.Parse()) {
42 callback.Run(base::WeakPtr<ProvidedFileSystemInterface>(), 42 callback.Run(base::WeakPtr<ProvidedFileSystemInterface>(),
43 base::FilePath(), 43 base::FilePath(),
44 0 /* file_handle */, 44 0 /* file_handle */,
45 base::File::FILE_ERROR_SECURITY); 45 base::File::FILE_ERROR_SECURITY);
46 return; 46 return;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 const ProvidedFileSystemInterface::GetMetadataCallback& callback, 134 const ProvidedFileSystemInterface::GetMetadataCallback& callback,
135 const EntryMetadata& metadata, 135 const EntryMetadata& metadata,
136 base::File::Error result) { 136 base::File::Error result) {
137 DCHECK_CURRENTLY_ON(BrowserThread::UI); 137 DCHECK_CURRENTLY_ON(BrowserThread::UI);
138 BrowserThread::PostTask( 138 BrowserThread::PostTask(
139 BrowserThread::IO, FROM_HERE, base::Bind(callback, metadata, result)); 139 BrowserThread::IO, FROM_HERE, base::Bind(callback, metadata, result));
140 } 140 }
141 141
142 } // namespace 142 } // namespace
143 143
144 FileStreamReader::FileStreamReader(fileapi::FileSystemContext* context, 144 FileStreamReader::FileStreamReader(storage::FileSystemContext* context,
145 const fileapi::FileSystemURL& url, 145 const storage::FileSystemURL& url,
146 int64 initial_offset, 146 int64 initial_offset,
147 const base::Time& expected_modification_time) 147 const base::Time& expected_modification_time)
148 : url_(url), 148 : url_(url),
149 current_offset_(initial_offset), 149 current_offset_(initial_offset),
150 current_length_(0), 150 current_length_(0),
151 expected_modification_time_(expected_modification_time), 151 expected_modification_time_(expected_modification_time),
152 state_(NOT_INITIALIZED), 152 state_(NOT_INITIALIZED),
153 file_handle_(0), 153 file_handle_(0),
154 weak_ptr_factory_(this) { 154 weak_ptr_factory_(this) {
155 } 155 }
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 callback.Run(net::ERR_UPLOAD_FILE_CHANGED); 422 callback.Run(net::ERR_UPLOAD_FILE_CHANGED);
423 return; 423 return;
424 } 424 }
425 425
426 DCHECK_EQ(base::File::FILE_OK, result); 426 DCHECK_EQ(base::File::FILE_OK, result);
427 callback.Run(metadata.size); 427 callback.Run(metadata.size);
428 } 428 }
429 429
430 } // namespace file_system_provider 430 } // namespace file_system_provider
431 } // namespace chromeos 431 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698