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

Unified Diff: chrome/browser/prerender/prerender_local_predictor.cc

Issue 368133005: Fixes for re-enabling more MSVC level 4 warnings: chrome/browser/ edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review comment Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/history/history_backend.cc ('k') | chrome/browser/safe_browsing/safe_browsing_store_file.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_local_predictor.cc
diff --git a/chrome/browser/prerender/prerender_local_predictor.cc b/chrome/browser/prerender/prerender_local_predictor.cc
index 7f6a25b9d8e31a14df0a80cdc4d40bc56069214c..2e451e94c0fb0563987931cb9981a9def3b2db0b 100644
--- a/chrome/browser/prerender/prerender_local_predictor.cc
+++ b/chrome/browser/prerender/prerender_local_predictor.cc
@@ -839,9 +839,11 @@ bool PrerenderLocalPredictor::ApplyParsedPrerenderServiceResponse(
if (!list->GetDictionary(i, &d))
return false;
string url;
+ if (!d->GetString("url", &url) || !GURL(url).is_valid())
+ return false;
double priority;
- if (!d->GetString("url", &url) || !d->GetDouble("likelihood", &priority)
- || !GURL(url).is_valid()) {
+ if (!d->GetDouble("likelihood", &priority) || priority < 0.0 ||
+ priority > 1.0) {
return false;
}
int in_index_timed_out = 0;
@@ -851,8 +853,8 @@ bool PrerenderLocalPredictor::ApplyParsedPrerenderServiceResponse(
!d->GetInteger("in_index", &in_index)) {
return false;
}
- if (priority < 0.0 || priority > 1.0 || in_index < 0 || in_index > 1 ||
- in_index_timed_out < 0 || in_index_timed_out > 1) {
+ if (in_index < 0 || in_index > 1 || in_index_timed_out < 0 ||
+ in_index_timed_out > 1) {
return false;
}
if (in_index_timed_out == 1)
@@ -860,7 +862,7 @@ bool PrerenderLocalPredictor::ApplyParsedPrerenderServiceResponse(
info->MaybeAddCandidateURLFromService(GURL(url),
priority,
in_index == 1,
- (1 - in_index_timed_out) == 1);
+ !in_index_timed_out);
}
if (list->GetSize() > 0)
RecordEvent(EVENT_PRERENDER_SERIVCE_RETURNED_HINTING_CANDIDATES);
« no previous file with comments | « chrome/browser/history/history_backend.cc ('k') | chrome/browser/safe_browsing/safe_browsing_store_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698