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

Side by Side Diff: net/base/file_stream_context.h

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
« no previous file with comments | « net/base/file_stream.h ('k') | net/base/net_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This file defines FileStream::Context class. 5 // This file defines FileStream::Context class.
6 // The general design of FileStream is as follows: file_stream.h defines 6 // The general design of FileStream is as follows: file_stream.h defines
7 // FileStream class which basically is just an "wrapper" not containing any 7 // FileStream class which basically is just an "wrapper" not containing any
8 // specific implementation details. It re-routes all its method calls to 8 // specific implementation details. It re-routes all its method calls to
9 // the instance of FileStream::Context (FileStream holds a scoped_ptr to 9 // the instance of FileStream::Context (FileStream holds a scoped_ptr to
10 // FileStream::Context instance). Context was extracted into a different class 10 // FileStream::Context instance). Context was extracted into a different class
(...skipping 21 matching lines...) Expand all
32 #include "net/base/completion_callback.h" 32 #include "net/base/completion_callback.h"
33 #include "net/base/file_stream.h" 33 #include "net/base/file_stream.h"
34 #include "net/base/file_stream_metrics.h" 34 #include "net/base/file_stream_metrics.h"
35 #include "net/base/file_stream_whence.h" 35 #include "net/base/file_stream_whence.h"
36 #include "net/base/net_log.h" 36 #include "net/base/net_log.h"
37 37
38 #if defined(OS_POSIX) 38 #if defined(OS_POSIX)
39 #include <errno.h> 39 #include <errno.h>
40 #endif 40 #endif
41 41
42 namespace base {
42 class FilePath; 43 class FilePath;
44 }
43 45
44 namespace net { 46 namespace net {
45 47
46 class IOBuffer; 48 class IOBuffer;
47 49
48 #if defined(OS_WIN) 50 #if defined(OS_WIN)
49 class FileStream::Context : public MessageLoopForIO::IOHandler { 51 class FileStream::Context : public MessageLoopForIO::IOHandler {
50 #elif defined(OS_POSIX) 52 #elif defined(OS_POSIX)
51 class FileStream::Context { 53 class FileStream::Context {
52 #endif 54 #endif
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 92
91 //////////////////////////////////////////////////////////////////////////// 93 ////////////////////////////////////////////////////////////////////////////
92 // Platform-independent methods implemented in file_stream_context.cc. 94 // Platform-independent methods implemented in file_stream_context.cc.
93 //////////////////////////////////////////////////////////////////////////// 95 ////////////////////////////////////////////////////////////////////////////
94 96
95 // Destroys the context. It can be deleted in the method or deletion can be 97 // Destroys the context. It can be deleted in the method or deletion can be
96 // deferred if some asynchronous operation is now in progress or if file is 98 // deferred if some asynchronous operation is now in progress or if file is
97 // not closed yet. 99 // not closed yet.
98 void Orphan(); 100 void Orphan();
99 101
100 void OpenAsync(const FilePath& path, 102 void OpenAsync(const base::FilePath& path,
101 int open_flags, 103 int open_flags,
102 const CompletionCallback& callback); 104 const CompletionCallback& callback);
103 int OpenSync(const FilePath& path, int open_flags); 105 int OpenSync(const base::FilePath& path, int open_flags);
104 106
105 void CloseSync(); 107 void CloseSync();
106 108
107 void SeekAsync(Whence whence, 109 void SeekAsync(Whence whence,
108 int64 offset, 110 int64 offset,
109 const Int64CompletionCallback& callback); 111 const Int64CompletionCallback& callback);
110 int64 SeekSync(Whence whence, int64 offset); 112 int64 SeekSync(Whence whence, int64 offset);
111 113
112 void FlushAsync(const CompletionCallback& callback); 114 void FlushAsync(const CompletionCallback& callback);
113 int FlushSync(); 115 int FlushSync();
(...skipping 16 matching lines...) Expand all
130 //////////////////////////////////////////////////////////////////////////// 132 ////////////////////////////////////////////////////////////////////////////
131 133
132 struct OpenResult { 134 struct OpenResult {
133 base::PlatformFile file; 135 base::PlatformFile file;
134 int error_code; 136 int error_code;
135 }; 137 };
136 138
137 // Map system error into network error code and log it with |bound_net_log_|. 139 // Map system error into network error code and log it with |bound_net_log_|.
138 int RecordAndMapError(int error, FileErrorSource source) const; 140 int RecordAndMapError(int error, FileErrorSource source) const;
139 141
140 void BeginOpenEvent(const FilePath& path); 142 void BeginOpenEvent(const base::FilePath& path);
141 143
142 OpenResult OpenFileImpl(const FilePath& path, int open_flags); 144 OpenResult OpenFileImpl(const base::FilePath& path, int open_flags);
143 145
144 int ProcessOpenError(int error_code); 146 int ProcessOpenError(int error_code);
145 void OnOpenCompleted(const CompletionCallback& callback, OpenResult result); 147 void OnOpenCompleted(const CompletionCallback& callback, OpenResult result);
146 148
147 void CloseAndDelete(); 149 void CloseAndDelete();
148 void OnCloseCompleted(); 150 void OnCloseCompleted();
149 151
150 Int64CompletionCallback IntToInt64(const CompletionCallback& callback); 152 Int64CompletionCallback IntToInt64(const CompletionCallback& callback);
151 153
152 // Checks for IO error that probably happened in async methods. 154 // Checks for IO error that probably happened in async methods.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 FileErrorSource error_source_; 223 FileErrorSource error_source_;
222 #endif 224 #endif
223 225
224 DISALLOW_COPY_AND_ASSIGN(Context); 226 DISALLOW_COPY_AND_ASSIGN(Context);
225 }; 227 };
226 228
227 } // namespace net 229 } // namespace net
228 230
229 #endif // NET_BASE_FILE_STREAM_CONTEXT_H_ 231 #endif // NET_BASE_FILE_STREAM_CONTEXT_H_
230 232
OLDNEW
« no previous file with comments | « net/base/file_stream.h ('k') | net/base/net_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698