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

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

Issue 839143002: Roll Chrome into Mojo. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase Created 5 years, 11 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
« no previous file with comments | « mojo/tools/roll/cc_strip_video.patch ('k') | net/base/file_stream_context_win.cc » ('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 #include "net/base/file_stream.h" 5 #include "net/base/file_stream.h"
6 6
7 #include "base/profiler/scoped_tracker.h"
7 #include "net/base/file_stream_context.h" 8 #include "net/base/file_stream_context.h"
8 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
9 10
10 namespace net { 11 namespace net {
11 12
12 FileStream::FileStream(const scoped_refptr<base::TaskRunner>& task_runner) 13 FileStream::FileStream(const scoped_refptr<base::TaskRunner>& task_runner)
13 : context_(new Context(task_runner)) { 14 : context_(new Context(task_runner)) {
14 } 15 }
15 16
16 FileStream::FileStream(base::File file, 17 FileStream::FileStream(base::File file,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 if (!IsOpen()) 50 if (!IsOpen())
50 return ERR_UNEXPECTED; 51 return ERR_UNEXPECTED;
51 52
52 context_->Seek(whence, offset, callback); 53 context_->Seek(whence, offset, callback);
53 return ERR_IO_PENDING; 54 return ERR_IO_PENDING;
54 } 55 }
55 56
56 int FileStream::Read(IOBuffer* buf, 57 int FileStream::Read(IOBuffer* buf,
57 int buf_len, 58 int buf_len,
58 const CompletionCallback& callback) { 59 const CompletionCallback& callback) {
60 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed.
61 tracked_objects::ScopedTracker tracking_profile(
62 FROM_HERE_WITH_EXPLICIT_FUNCTION("423948 FileStream::Read"));
63
59 if (!IsOpen()) 64 if (!IsOpen())
60 return ERR_UNEXPECTED; 65 return ERR_UNEXPECTED;
61 66
62 // read(..., 0) will return 0, which indicates end-of-file. 67 // read(..., 0) will return 0, which indicates end-of-file.
63 DCHECK_GT(buf_len, 0); 68 DCHECK_GT(buf_len, 0);
64 69
65 return context_->Read(buf, buf_len, callback); 70 return context_->Read(buf, buf_len, callback);
66 } 71 }
67 72
68 int FileStream::Write(IOBuffer* buf, 73 int FileStream::Write(IOBuffer* buf,
(...skipping 12 matching lines...) Expand all
81 86
82 context_->Flush(callback); 87 context_->Flush(callback);
83 return ERR_IO_PENDING; 88 return ERR_IO_PENDING;
84 } 89 }
85 90
86 const base::File& FileStream::GetFileForTesting() const { 91 const base::File& FileStream::GetFileForTesting() const {
87 return context_->file(); 92 return context_->file();
88 } 93 }
89 94
90 } // namespace net 95 } // namespace net
OLDNEW
« no previous file with comments | « mojo/tools/roll/cc_strip_video.patch ('k') | net/base/file_stream_context_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698