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

Side by Side Diff: webkit/browser/fileapi/file_system_file_stream_reader.h

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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_
6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_
7
8 #include "base/bind.h"
9 #include "base/files/file.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/time/time.h"
12 #include "webkit/browser/blob/file_stream_reader.h"
13 #include "webkit/browser/fileapi/file_system_url.h"
14 #include "webkit/browser/webkit_storage_browser_export.h"
15 #include "webkit/common/blob/shareable_file_reference.h"
16
17 namespace base {
18 class FilePath;
19 class SequencedTaskRunner;
20 }
21
22 namespace content {
23 class FileSystemFileStreamReaderTest;
24 }
25
26 namespace fileapi {
27
28 class FileSystemContext;
29
30 // Generic FileStreamReader implementation for FileSystem files.
31 // Note: This generic implementation would work for any filesystems but
32 // remote filesystem should implement its own reader rather than relying
33 // on FileSystemOperation::GetSnapshotFile() which may force downloading
34 // the entire contents for remote files.
35 class WEBKIT_STORAGE_BROWSER_EXPORT_PRIVATE FileSystemFileStreamReader
36 : public NON_EXPORTED_BASE(webkit_blob::FileStreamReader) {
37 public:
38 virtual ~FileSystemFileStreamReader();
39
40 // FileStreamReader overrides.
41 virtual int Read(net::IOBuffer* buf, int buf_len,
42 const net::CompletionCallback& callback) OVERRIDE;
43 virtual int64 GetLength(
44 const net::Int64CompletionCallback& callback) OVERRIDE;
45
46 private:
47 friend class webkit_blob::FileStreamReader;
48 friend class content::FileSystemFileStreamReaderTest;
49
50 FileSystemFileStreamReader(FileSystemContext* file_system_context,
51 const FileSystemURL& url,
52 int64 initial_offset,
53 const base::Time& expected_modification_time);
54
55 int CreateSnapshot(const base::Closure& callback,
56 const net::CompletionCallback& error_callback);
57 void DidCreateSnapshot(
58 const base::Closure& callback,
59 const net::CompletionCallback& error_callback,
60 base::File::Error file_error,
61 const base::File::Info& file_info,
62 const base::FilePath& platform_path,
63 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref);
64
65 scoped_refptr<FileSystemContext> file_system_context_;
66 FileSystemURL url_;
67 const int64 initial_offset_;
68 const base::Time expected_modification_time_;
69 scoped_ptr<webkit_blob::FileStreamReader> local_file_reader_;
70 scoped_refptr<webkit_blob::ShareableFileReference> snapshot_ref_;
71 bool has_pending_create_snapshot_;
72 base::WeakPtrFactory<FileSystemFileStreamReader> weak_factory_;
73
74 DISALLOW_COPY_AND_ASSIGN(FileSystemFileStreamReader);
75 };
76
77 } // namespace fileapi
78
79 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/file_system_dir_url_request_job.cc ('k') | webkit/browser/fileapi/file_system_file_stream_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698