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

Side by Side Diff: android_webview/browser/net/input_stream_reader.cc

Issue 337473004: aw: Use comparison DCHECKs where appropriate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 (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
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
OLDNEW
« no previous file with comments | « android_webview/browser/browser_view_renderer.cc ('k') | android_webview/browser/net_disk_cache_remover.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698