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

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

Issue 206073006: 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);
46 45
47 // Opens |file_path_| and if it succeeds, proceeds to InitiateSeek(). 46 // Opens |file_path_| and if it succeeds, proceeds to InitiateSeek().
48 // If failed, the error code is returned by calling |error_callback|. 47 // If failed, the error code is returned by calling |error_callback|.
49 int InitiateOpen(const net::CompletionCallback& error_callback, 48 int InitiateOpen(const net::CompletionCallback& error_callback,
50 const base::Closure& main_operation); 49 const base::Closure& main_operation);
51 void DidOpen(const net::CompletionCallback& error_callback, 50 void DidOpen(const net::CompletionCallback& error_callback,
52 const base::Closure& main_operation, 51 const base::Closure& main_operation,
53 int result); 52 int result);
54 53
55 // Seeks to |initial_offset_| and proceeds to |main_operation| if it succeeds. 54 // Seeks to |initial_offset_| and proceeds to |main_operation| if it succeeds.
(...skipping 16 matching lines...) Expand all
72 // Flushes asynchronously to the file. 71 // Flushes asynchronously to the file.
73 int InitiateFlush(const net::CompletionCallback& callback); 72 int InitiateFlush(const net::CompletionCallback& callback);
74 void DidFlush(const net::CompletionCallback& callback, int result); 73 void DidFlush(const net::CompletionCallback& callback, int result);
75 74
76 // Stops the in-flight operation and calls |cancel_callback_| if it has been 75 // Stops the in-flight operation and calls |cancel_callback_| if it has been
77 // set by Cancel() for the current operation. 76 // set by Cancel() for the current operation.
78 bool CancelIfRequested(); 77 bool CancelIfRequested();
79 78
80 // Initialization parameters. 79 // Initialization parameters.
81 const base::FilePath file_path_; 80 const base::FilePath file_path_;
82 OpenOrCreate open_or_create_;
83 const int64 initial_offset_; 81 const int64 initial_offset_;
84 scoped_refptr<base::TaskRunner> task_runner_; 82 scoped_refptr<base::TaskRunner> task_runner_;
85 83
86 // Current states of the operation. 84 // Current states of the operation.
87 bool has_pending_operation_; 85 bool has_pending_operation_;
88 scoped_ptr<net::FileStream> stream_impl_; 86 scoped_ptr<net::FileStream> stream_impl_;
89 net::CompletionCallback cancel_callback_; 87 net::CompletionCallback cancel_callback_;
90 88
91 base::WeakPtrFactory<LocalFileStreamWriter> weak_factory_; 89 base::WeakPtrFactory<LocalFileStreamWriter> weak_factory_;
92 DISALLOW_COPY_AND_ASSIGN(LocalFileStreamWriter); 90 DISALLOW_COPY_AND_ASSIGN(LocalFileStreamWriter);
93 }; 91 };
94 92
95 } // namespace fileapi 93 } // namespace fileapi
96 94
97 #endif // WEBKIT_BROWSER_FILEAPI_LOCAL_FILE_STREAM_WRITER_H_ 95 #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