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

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

Issue 206083004: Revert of Revert of Add a parameter to FileStreamWriter::CreateForLocalFile to allow creating new (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 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 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 #ifndef WEBKIT_BROWSER_FILEAPI_LOCAL_FILE_STREAM_WRITER_H_ 5 #ifndef WEBKIT_BROWSER_FILEAPI_LOCAL_FILE_STREAM_WRITER_H_
6 #define WEBKIT_BROWSER_FILEAPI_LOCAL_FILE_STREAM_WRITER_H_ 6 #define WEBKIT_BROWSER_FILEAPI_LOCAL_FILE_STREAM_WRITER_H_
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 23 matching lines...) Expand all
34 virtual int Write(net::IOBuffer* buf, int buf_len, 34 virtual int Write(net::IOBuffer* buf, int buf_len,
35 const net::CompletionCallback& callback) OVERRIDE; 35 const net::CompletionCallback& callback) OVERRIDE;
36 virtual int Cancel(const net::CompletionCallback& callback) OVERRIDE; 36 virtual int Cancel(const net::CompletionCallback& callback) OVERRIDE;
37 virtual int Flush(const net::CompletionCallback& callback) OVERRIDE; 37 virtual int Flush(const net::CompletionCallback& callback) OVERRIDE;
38 38
39 private: 39 private:
40 friend class FileStreamWriter; 40 friend class FileStreamWriter;
41 friend class LocalFileStreamWriterTest; 41 friend class LocalFileStreamWriterTest;
42 LocalFileStreamWriter(base::TaskRunner* task_runner, 42 LocalFileStreamWriter(base::TaskRunner* task_runner,
43 const base::FilePath& file_path, 43 const base::FilePath& file_path,
44 int64 initial_offset); 44 int64 initial_offset,
45 OpenOrCreate open_or_create);
45 46
46 // Opens |file_path_| and if it succeeds, proceeds to InitiateSeek(). 47 // Opens |file_path_| and if it succeeds, proceeds to InitiateSeek().
47 // If failed, the error code is returned by calling |error_callback|. 48 // If failed, the error code is returned by calling |error_callback|.
48 int InitiateOpen(const net::CompletionCallback& error_callback, 49 int InitiateOpen(const net::CompletionCallback& error_callback,
49 const base::Closure& main_operation); 50 const base::Closure& main_operation);
50 void DidOpen(const net::CompletionCallback& error_callback, 51 void DidOpen(const net::CompletionCallback& error_callback,
51 const base::Closure& main_operation, 52 const base::Closure& main_operation,
52 int result); 53 int result);
53 54
54 // Seeks to |initial_offset_| and proceeds to |main_operation| if it succeeds. 55 // Seeks to |initial_offset_| and proceeds to |main_operation| if it succeeds.
(...skipping 16 matching lines...) Expand all
71 // Flushes asynchronously to the file. 72 // Flushes asynchronously to the file.
72 int InitiateFlush(const net::CompletionCallback& callback); 73 int InitiateFlush(const net::CompletionCallback& callback);
73 void DidFlush(const net::CompletionCallback& callback, int result); 74 void DidFlush(const net::CompletionCallback& callback, int result);
74 75
75 // Stops the in-flight operation and calls |cancel_callback_| if it has been 76 // Stops the in-flight operation and calls |cancel_callback_| if it has been
76 // set by Cancel() for the current operation. 77 // set by Cancel() for the current operation.
77 bool CancelIfRequested(); 78 bool CancelIfRequested();
78 79
79 // Initialization parameters. 80 // Initialization parameters.
80 const base::FilePath file_path_; 81 const base::FilePath file_path_;
82 OpenOrCreate open_or_create_;
81 const int64 initial_offset_; 83 const int64 initial_offset_;
82 scoped_refptr<base::TaskRunner> task_runner_; 84 scoped_refptr<base::TaskRunner> task_runner_;
83 85
84 // Current states of the operation. 86 // Current states of the operation.
85 bool has_pending_operation_; 87 bool has_pending_operation_;
86 scoped_ptr<net::FileStream> stream_impl_; 88 scoped_ptr<net::FileStream> stream_impl_;
87 net::CompletionCallback cancel_callback_; 89 net::CompletionCallback cancel_callback_;
88 90
89 base::WeakPtrFactory<LocalFileStreamWriter> weak_factory_; 91 base::WeakPtrFactory<LocalFileStreamWriter> weak_factory_;
90 DISALLOW_COPY_AND_ASSIGN(LocalFileStreamWriter); 92 DISALLOW_COPY_AND_ASSIGN(LocalFileStreamWriter);
91 }; 93 };
92 94
93 } // namespace fileapi 95 } // namespace fileapi
94 96
95 #endif // WEBKIT_BROWSER_FILEAPI_LOCAL_FILE_STREAM_WRITER_H_ 97 #endif // WEBKIT_BROWSER_FILEAPI_LOCAL_FILE_STREAM_WRITER_H_
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/isolated_file_system_backend.cc ('k') | webkit/browser/fileapi/local_file_stream_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698