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

Side by Side Diff: android_webview/native/state_serializer.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/state_serializer.h" 5 #include "android_webview/native/state_serializer.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 Pickle* pickle) { 43 Pickle* pickle) {
44 DCHECK(pickle); 44 DCHECK(pickle);
45 45
46 if (!internal::WriteHeaderToPickle(pickle)) 46 if (!internal::WriteHeaderToPickle(pickle))
47 return false; 47 return false;
48 48
49 const content::NavigationController& controller = 49 const content::NavigationController& controller =
50 web_contents.GetController(); 50 web_contents.GetController();
51 const int entry_count = controller.GetEntryCount(); 51 const int entry_count = controller.GetEntryCount();
52 const int selected_entry = controller.GetCurrentEntryIndex(); 52 const int selected_entry = controller.GetCurrentEntryIndex();
53 DCHECK(entry_count >= 0); 53 DCHECK_GE(entry_count, 0);
54 DCHECK(selected_entry >= -1); // -1 is valid 54 DCHECK_GE(selected_entry, -1); // -1 is valid
55 DCHECK(selected_entry < entry_count); 55 DCHECK_LT(selected_entry, entry_count);
56 56
57 if (!pickle->WriteInt(entry_count)) 57 if (!pickle->WriteInt(entry_count))
58 return false; 58 return false;
59 59
60 if (!pickle->WriteInt(selected_entry)) 60 if (!pickle->WriteInt(selected_entry))
61 return false; 61 return false;
62 62
63 for (int i = 0; i < entry_count; ++i) { 63 for (int i = 0; i < entry_count; ++i) {
64 if (!internal::WriteNavigationEntryToPickle(*controller.GetEntryAtIndex(i), 64 if (!internal::WriteNavigationEntryToPickle(*controller.GetEntryAtIndex(i),
65 pickle)) 65 pickle))
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 return false; 281 return false;
282 entry->SetHttpStatusCode(http_status_code); 282 entry->SetHttpStatusCode(http_status_code);
283 } 283 }
284 284
285 return true; 285 return true;
286 } 286 }
287 287
288 } // namespace internal 288 } // namespace internal
289 289
290 } // namespace android_webview 290 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/input_stream_impl.cc ('k') | android_webview/renderer/aw_render_view_ext.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698