diff options
author | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 03:15:46 +0000 |
---|---|---|
committer | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 03:15:46 +0000 |
commit | c4ca3b454d7a68dd8841d0b2f03f0f81c3cc2a7d (patch) | |
tree | c1bbbec351a1e14fd11a4f03e3c144f699dc90ad /webkit/fileapi/file_system_file_stream_reader.h | |
parent | db6d8b31654e460ea7a048ead545c5803dce0c2f (diff) | |
download | chromium_src-c4ca3b454d7a68dd8841d0b2f03f0f81c3cc2a7d.zip chromium_src-c4ca3b454d7a68dd8841d0b2f03f0f81c3cc2a7d.tar.gz chromium_src-c4ca3b454d7a68dd8841d0b2f03f0f81c3cc2a7d.tar.bz2 |
Rename webkit_blob::FileReader to FileStreamReader.
The name was confusion: it does not directly correspond to FileReader in File API, (which is implemented by WebCore::FileReader).
BUG=128483
TEST=Existing file/blob tests.
Review URL: https://chromiumcodereview.appspot.com/10447083
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139724 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_file_stream_reader.h')
-rw-r--r-- | webkit/fileapi/file_system_file_stream_reader.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/webkit/fileapi/file_system_file_stream_reader.h b/webkit/fileapi/file_system_file_stream_reader.h new file mode 100644 index 0000000..f7727ad --- /dev/null +++ b/webkit/fileapi/file_system_file_stream_reader.h @@ -0,0 +1,68 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_ +#define WEBKIT_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_ +#pragma once + +#include "base/bind.h" +#include "base/memory/ref_counted.h" +#include "base/platform_file.h" +#include "googleurl/src/gurl.h" +#include "webkit/blob/file_stream_reader.h" + +class FilePath; + +namespace base { +class SequencedTaskRunner; +} + +namespace webkit_blob { +class LocalFileStreamReader; +class ShareableFileReference; +} + +namespace fileapi { + +class FileSystemContext; + +// TODO(kinaba,satorux): This generic implementation would work for any +// filesystems but remote filesystem should implement its own reader +// rather than relying on FileSystemOperation::GetSnapshotFile() which +// may force downloading the entire contents for remote files. +class FileSystemFileStreamReader : public webkit_blob::FileStreamReader { + public: + // Creates a new FileReader for a filesystem URL |url| form |initial_offset|. + FileSystemFileStreamReader(FileSystemContext* file_system_context, + const GURL& url, + int64 initial_offset); + virtual ~FileSystemFileStreamReader(); + + // FileReader override. + virtual int Read(net::IOBuffer* buf, int buf_len, + const net::CompletionCallback& callback) OVERRIDE; + + private: + void DidCreateSnapshot( + const base::Closure& read_closure, + const net::CompletionCallback& callback, + base::PlatformFileError file_error, + const base::PlatformFileInfo& file_info, + const FilePath& platform_path, + const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref); + + scoped_refptr<FileSystemContext> file_system_context_; + const GURL url_; + const int64 initial_offset_; + scoped_ptr<webkit_blob::LocalFileStreamReader> local_file_reader_; + scoped_refptr<webkit_blob::ShareableFileReference> snapshot_ref_; + bool has_pending_create_snapshot_; + base::WeakPtrFactory<FileSystemFileStreamReader> weak_factory_; + + DISALLOW_COPY_AND_ASSIGN(FileSystemFileStreamReader); +}; + +} // namespace fileapi + +#endif // WEBKIT_FILEAPI_FILE_SYSTEM_FILE_STREAM_READER_H_ |