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

Side by Side Diff: webkit/blob/local_file_reader.cc

Issue 10065011: Use LocalFileReader in FileSystemURLRequestJob (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 (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 "webkit/blob/local_file_reader.h" 5 #include "webkit/blob/local_file_reader.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/file_util_proxy.h" 8 #include "base/file_util_proxy.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 void DidSeekFile(const LocalFileReader::OpenFileStreamCallback& callback, 65 void DidSeekFile(const LocalFileReader::OpenFileStreamCallback& callback,
66 scoped_ptr<net::FileStream> stream_impl, 66 scoped_ptr<net::FileStream> stream_impl,
67 int64 initial_offset, 67 int64 initial_offset,
68 int64 new_offset) { 68 int64 new_offset) {
69 int result = net::OK; 69 int result = net::OK;
70 if (new_offset < 0) 70 if (new_offset < 0)
71 result = static_cast<int>(new_offset); 71 result = static_cast<int>(new_offset);
72 else if (new_offset != initial_offset) 72 else if (new_offset != initial_offset)
73 result = net::ERR_FAILED; 73 result = net::ERR_REQUEST_RANGE_NOT_SATISFIABLE;
74 callback.Run(result, stream_impl.Pass()); 74 callback.Run(result, stream_impl.Pass());
75 } 75 }
76 76
77 void EmptyCompletionCallback(int) {} 77 void EmptyCompletionCallback(int) {}
78 78
79 } // namespace 79 } // namespace
80 80
81 // A helper class to open, verify and seek a file stream for a given path. 81 // A helper class to open, verify and seek a file stream for a given path.
82 class LocalFileReader::OpenFileStreamHelper { 82 class LocalFileReader::OpenFileStreamHelper {
83 public: 83 public:
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 return; 207 return;
208 } 208 }
209 DCHECK(stream_impl.get()); 209 DCHECK(stream_impl.get());
210 stream_impl_ = stream_impl.Pass(); 210 stream_impl_ = stream_impl.Pass();
211 const int read_error = stream_impl_->Read(buf, buf_len, callback); 211 const int read_error = stream_impl_->Read(buf, buf_len, callback);
212 if (read_error != net::ERR_IO_PENDING) 212 if (read_error != net::ERR_IO_PENDING)
213 callback.Run(read_error); 213 callback.Run(read_error);
214 } 214 }
215 215
216 } // namespace webkit_blob 216 } // namespace webkit_blob
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698