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

Side by Side Diff: chrome/browser/media_galleries/fileapi/readahead_file_stream_reader.cc

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/media_galleries/fileapi/readahead_file_stream_reader.h" 5 #include "chrome/browser/media_galleries/fileapi/readahead_file_stream_reader.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
11 #include "net/base/io_buffer.h" 11 #include "net/base/io_buffer.h"
12 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
13 13
14 using webkit_blob::FileStreamReader; 14 using storage::FileStreamReader;
15 15
16 namespace { 16 namespace {
17 17
18 const size_t kDesiredNumberOfBuffers = 2; // So we are always one buffer ahead. 18 const size_t kDesiredNumberOfBuffers = 2; // So we are always one buffer ahead.
19 const int kBufferSize = 1024*1024; // 1MB to minimize transaction costs. 19 const int kBufferSize = 1024*1024; // 1MB to minimize transaction costs.
20 20
21 } // namespace 21 } // namespace
22 22
23 ReadaheadFileStreamReader::ReadaheadFileStreamReader(FileStreamReader* source) 23 ReadaheadFileStreamReader::ReadaheadFileStreamReader(FileStreamReader* source)
24 : source_(source), 24 : source_(source),
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // Free the pending callback before running it, as the callback often 137 // Free the pending callback before running it, as the callback often
138 // dispatches another read. 138 // dispatches another read.
139 scoped_refptr<net::DrainableIOBuffer> sink = pending_sink_buffer_; 139 scoped_refptr<net::DrainableIOBuffer> sink = pending_sink_buffer_;
140 pending_sink_buffer_ = NULL; 140 pending_sink_buffer_ = NULL;
141 net::CompletionCallback completion_callback = pending_read_callback_; 141 net::CompletionCallback completion_callback = pending_read_callback_;
142 pending_read_callback_.Reset(); 142 pending_read_callback_.Reset();
143 143
144 completion_callback.Run(FinishReadFromCacheOrStoredError(sink)); 144 completion_callback.Run(FinishReadFromCacheOrStoredError(sink));
145 } 145 }
146 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698