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

Side by Side Diff: net/base/file_stream.cc

Issue 649763002: git cl format the second third of the net/base directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 #include "net/base/file_stream.h" 5 #include "net/base/file_stream.h"
6 6
7 #include "net/base/file_stream_context.h" 7 #include "net/base/file_stream_context.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 FileStream::FileStream(const scoped_refptr<base::TaskRunner>& task_runner) 12 FileStream::FileStream(const scoped_refptr<base::TaskRunner>& task_runner)
13 : context_(new Context(task_runner)) { 13 : context_(new Context(task_runner)) {
14 } 14 }
15 15
16 FileStream::FileStream(base::File file, 16 FileStream::FileStream(base::File file,
17 const scoped_refptr<base::TaskRunner>& task_runner) 17 const scoped_refptr<base::TaskRunner>& task_runner)
18 : context_(new Context(file.Pass(), task_runner)) { 18 : context_(new Context(file.Pass(), task_runner)) {
19 } 19 }
20 20
21 FileStream::~FileStream() { 21 FileStream::~FileStream() {
22 context_.release()->Orphan(); 22 context_.release()->Orphan();
23 } 23 }
24 24
25 int FileStream::Open(const base::FilePath& path, int open_flags, 25 int FileStream::Open(const base::FilePath& path,
26 int open_flags,
26 const CompletionCallback& callback) { 27 const CompletionCallback& callback) {
27 if (IsOpen()) { 28 if (IsOpen()) {
28 DLOG(FATAL) << "File is already open!"; 29 DLOG(FATAL) << "File is already open!";
29 return ERR_UNEXPECTED; 30 return ERR_UNEXPECTED;
30 } 31 }
31 32
32 DCHECK(open_flags & base::File::FLAG_ASYNC); 33 DCHECK(open_flags & base::File::FLAG_ASYNC);
33 context_->Open(path, open_flags, callback); 34 context_->Open(path, open_flags, callback);
34 return ERR_IO_PENDING; 35 return ERR_IO_PENDING;
35 } 36 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 82
82 context_->Flush(callback); 83 context_->Flush(callback);
83 return ERR_IO_PENDING; 84 return ERR_IO_PENDING;
84 } 85 }
85 86
86 const base::File& FileStream::GetFileForTesting() const { 87 const base::File& FileStream::GetFileForTesting() const {
87 return context_->file(); 88 return context_->file();
88 } 89 }
89 90
90 } // namespace net 91 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698