| OLD | NEW |
| 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 "android_webview/browser/net/input_stream_reader.h" | 5 #include "android_webview/browser/net/input_stream_reader.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/input_stream.h" | 7 #include "android_webview/browser/input_stream.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // number of bytes. | 80 // number of bytes. |
| 81 if (byte_range.IsValid() && byte_range.first_byte_position() > 0) { | 81 if (byte_range.IsValid() && byte_range.first_byte_position() > 0) { |
| 82 int64_t bytes_to_skip = byte_range.first_byte_position(); | 82 int64_t bytes_to_skip = byte_range.first_byte_position(); |
| 83 do { | 83 do { |
| 84 int64_t skipped = 0; | 84 int64_t skipped = 0; |
| 85 if (!stream_->Skip(bytes_to_skip, &skipped)) | 85 if (!stream_->Skip(bytes_to_skip, &skipped)) |
| 86 return net::ERR_FAILED; | 86 return net::ERR_FAILED; |
| 87 | 87 |
| 88 if (skipped <= 0) | 88 if (skipped <= 0) |
| 89 return net::ERR_REQUEST_RANGE_NOT_SATISFIABLE; | 89 return net::ERR_REQUEST_RANGE_NOT_SATISFIABLE; |
| 90 DCHECK(skipped <= bytes_to_skip); | 90 DCHECK_LE(skipped, bytes_to_skip); |
| 91 | 91 |
| 92 bytes_to_skip -= skipped; | 92 bytes_to_skip -= skipped; |
| 93 } while (bytes_to_skip > 0); | 93 } while (bytes_to_skip > 0); |
| 94 } | 94 } |
| 95 return net::OK; | 95 return net::OK; |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace android_webview | 98 } // namespace android_webview |
| OLD | NEW |