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

Unified Diff: net/base/file_stream.h

Issue 189393002: net: Update FileStream to use base::File instead of PlatformFile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: net/base/file_stream.h
diff --git a/net/base/file_stream.h b/net/base/file_stream.h
index 9fe274759c7fac560acbdc0050b382ac0ac01db1..da62937ced99610a92744b2b736a8e9f3fd490c7 100644
--- a/net/base/file_stream.h
+++ b/net/base/file_stream.h
@@ -10,6 +10,7 @@
#ifndef NET_BASE_FILE_STREAM_H_
#define NET_BASE_FILE_STREAM_H_
+#include "base/files/file.h"
#include "base/platform_file.h"
#include "base/task_runner.h"
#include "net/base/completion_callback.h"
@@ -45,14 +46,23 @@ class NET_EXPORT FileStream {
// Uses |task_runner| for asynchronous operations.
// Note: the new FileStream object takes ownership of the PlatformFile and
// will close it on destruction.
+ // This constructor is deprecated.
+ // TODO(rvargas): remove all references to PlatformFile.
FileStream(base::PlatformFile file,
int flags,
net::NetLog* net_log,
const scoped_refptr<base::TaskRunner>& task_runner);
// Same as above, but runs async tasks in base::WorkerPool.
+ // This constructor is deprecated.
FileStream(base::PlatformFile file, int flags, net::NetLog* net_log);
+ // Non-deprecated versions of the previous two constructors.
+ FileStream(base::File file,
+ net::NetLog* net_log,
+ const scoped_refptr<base::TaskRunner>& task_runner);
+ FileStream(base::File file, net::NetLog* net_log);
+
// The underlying file is closed automatically.
virtual ~FileStream();
@@ -239,22 +249,18 @@ class NET_EXPORT FileStream {
void SetBoundNetLogSource(const net::BoundNetLog& owner_bound_net_log);
// Returns the underlying platform file for testing.
- base::PlatformFile GetPlatformFileForTesting();
+ const base::File& GetFileForTesting() const;
private:
class Context;
- bool is_async() const { return !!(open_flags_ & base::PLATFORM_FILE_ASYNC); }
-
- int open_flags_;
net::BoundNetLog bound_net_log_;
- // Context performing I/O operations. It was extracted into separate class
+ // Context performing I/O operations. It was extracted into a separate class
// to perform asynchronous operations because FileStream can be destroyed
- // before completion of async operation. Also if async FileStream is destroyed
- // without explicit closing file should be closed asynchronously without
- // delaying FileStream's destructor. To perform all that separate object is
- // necessary.
+ // before completion of an async operation. Also if a FileStream is destroyed
+ // without explicitly calling Close, the file should be closed asynchronously
+ // without delaying FileStream's destructor.
scoped_ptr<Context> context_;
DISALLOW_COPY_AND_ASSIGN(FileStream);
« no previous file with comments | « base/files/file_unittest.cc ('k') | net/base/file_stream.cc » ('j') | net/base/file_stream.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698