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

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

Issue 1550593002: Switch to standard integer types in chrome/browser/, part 2 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 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 <stddef.h>
8
7 #include <algorithm> 9 #include <algorithm>
8 10
9 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
10 #include "base/numerics/safe_conversions.h" 12 #include "base/numerics/safe_conversions.h"
11 #include "net/base/io_buffer.h" 13 #include "net/base/io_buffer.h"
12 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
13 15
14 using storage::FileStreamReader; 16 using storage::FileStreamReader;
15 17
16 namespace { 18 namespace {
(...skipping 27 matching lines...) Expand all
44 if (result == net::ERR_IO_PENDING) { 46 if (result == net::ERR_IO_PENDING) {
45 DCHECK(!pending_sink_buffer_.get()); 47 DCHECK(!pending_sink_buffer_.get());
46 DCHECK(pending_read_callback_.is_null()); 48 DCHECK(pending_read_callback_.is_null());
47 pending_sink_buffer_ = sink; 49 pending_sink_buffer_ = sink;
48 pending_read_callback_ = callback; 50 pending_read_callback_ = callback;
49 } 51 }
50 52
51 return result; 53 return result;
52 } 54 }
53 55
54 int64 ReadaheadFileStreamReader::GetLength( 56 int64_t ReadaheadFileStreamReader::GetLength(
55 const net::Int64CompletionCallback& callback) { 57 const net::Int64CompletionCallback& callback) {
56 return source_->GetLength(callback); 58 return source_->GetLength(callback);
57 } 59 }
58 60
59 int ReadaheadFileStreamReader::FinishReadFromCacheOrStoredError( 61 int ReadaheadFileStreamReader::FinishReadFromCacheOrStoredError(
60 net::DrainableIOBuffer* sink) { 62 net::DrainableIOBuffer* sink) {
61 // If we don't have any ready cache, return the pending read code, or 63 // If we don't have any ready cache, return the pending read code, or
62 // the stored error code. 64 // the stored error code.
63 if (buffers_.empty()) { 65 if (buffers_.empty()) {
64 if (source_.get()) { 66 if (source_.get()) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // Free the pending callback before running it, as the callback often 140 // Free the pending callback before running it, as the callback often
139 // dispatches another read. 141 // dispatches another read.
140 scoped_refptr<net::DrainableIOBuffer> sink = pending_sink_buffer_; 142 scoped_refptr<net::DrainableIOBuffer> sink = pending_sink_buffer_;
141 pending_sink_buffer_ = NULL; 143 pending_sink_buffer_ = NULL;
142 net::CompletionCallback completion_callback = pending_read_callback_; 144 net::CompletionCallback completion_callback = pending_read_callback_;
143 pending_read_callback_.Reset(); 145 pending_read_callback_.Reset();
144 146
145 completion_callback.Run(FinishReadFromCacheOrStoredError(sink.get())); 147 completion_callback.Run(FinishReadFromCacheOrStoredError(sink.get()));
146 } 148 }
147 } 149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698