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

Side by Side Diff: chrome/browser/chromeos/drive/local_file_reader.cc

Issue 323683002: net: FileStream cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add DCHECK, fix ASSERT message Created 6 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/chromeos/drive/local_file_reader.h" 5 #include "chrome/browser/chromeos/drive/local_file_reader.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/sequenced_task_runner.h" 9 #include "base/sequenced_task_runner.h"
10 #include "net/base/completion_callback.h" 10 #include "net/base/completion_callback.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 int rv = file_stream_.Read(in_buffer, buffer_length, callback); 45 int rv = file_stream_.Read(in_buffer, buffer_length, callback);
46 DCHECK_EQ(rv, net::ERR_IO_PENDING); 46 DCHECK_EQ(rv, net::ERR_IO_PENDING);
47 } 47 }
48 48
49 void LocalFileReader::DidOpen(const net::CompletionCallback& callback, 49 void LocalFileReader::DidOpen(const net::CompletionCallback& callback,
50 int64 offset, 50 int64 offset,
51 int error) { 51 int error) {
52 if (error != net::OK) 52 if (error != net::OK)
53 return callback.Run(error); 53 return callback.Run(error);
54 54
55 int rv = file_stream_.Seek(net::FROM_BEGIN, offset, 55 int rv = file_stream_.Seek(base::File::FROM_BEGIN, offset,
56 Bind(&LocalFileReader::DidSeek, 56 Bind(&LocalFileReader::DidSeek,
57 weak_ptr_factory_.GetWeakPtr(), 57 weak_ptr_factory_.GetWeakPtr(),
58 callback, offset)); 58 callback, offset));
59 DCHECK_EQ(rv, net::ERR_IO_PENDING); 59 DCHECK_EQ(rv, net::ERR_IO_PENDING);
60 } 60 }
61 61
62 void LocalFileReader::DidSeek(const net::CompletionCallback& callback, 62 void LocalFileReader::DidSeek(const net::CompletionCallback& callback,
63 int64 offset, 63 int64 offset,
64 int64 error) { 64 int64 error) {
65 callback.Run(error == offset ? net::OK : net::ERR_FAILED); 65 callback.Run(error == offset ? net::OK : net::ERR_FAILED);
66 } 66 }
67 67
68 } // namespace util 68 } // namespace util
69 } // namespace drive 69 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698