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

Side by Side Diff: android_webview/native/input_stream_impl.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/native/input_stream_impl.h" 5 #include "android_webview/native/input_stream_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 // Disable "Warnings treated as errors" for input_stream_jni as it's a Java 8 // Disable "Warnings treated as errors" for input_stream_jni as it's a Java
9 // system class and we have to generate C++ hooks for all methods in the class 9 // system class and we have to generate C++ hooks for all methods in the class
10 // even if they're unused. 10 // even if they're unused.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 DCHECK_GE(remaining_length, transfer_length); 117 DCHECK_GE(remaining_length, transfer_length);
118 env->GetByteArrayRegion(buffer, 0, transfer_length, 118 env->GetByteArrayRegion(buffer, 0, transfer_length,
119 reinterpret_cast<jbyte*>(dest_write_ptr)); 119 reinterpret_cast<jbyte*>(dest_write_ptr));
120 if (ClearException(env)) 120 if (ClearException(env))
121 return false; 121 return false;
122 122
123 remaining_length -= transfer_length; 123 remaining_length -= transfer_length;
124 dest_write_ptr += transfer_length; 124 dest_write_ptr += transfer_length;
125 } 125 }
126 // bytes_read can be strictly less than the req. length if EOF is encountered. 126 // bytes_read can be strictly less than the req. length if EOF is encountered.
127 DCHECK(remaining_length >= 0 && remaining_length <= length); 127 DCHECK_GE(remaining_length, 0);
128 DCHECK_LE(remaining_length, length);
128 *bytes_read = length - remaining_length; 129 *bytes_read = length - remaining_length;
129 return true; 130 return true;
130 } 131 }
131 132
132 } // namespace android_webview 133 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_web_resource_response_impl.cc ('k') | android_webview/native/state_serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698