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

Side by Side Diff: chrome/browser/history/history_backend.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: 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 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 "chrome/browser/history/history_backend.h" 5 #include "chrome/browser/history/history_backend.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 // http://crbug.com/96860 is fixed. 301 // http://crbug.com/96860 is fixed.
302 if ((t == content::PAGE_TRANSITION_TYPED || 302 if ((t == content::PAGE_TRANSITION_TYPED ||
303 t == content::PAGE_TRANSITION_AUTO_BOOKMARK) && 303 t == content::PAGE_TRANSITION_AUTO_BOOKMARK) &&
304 (transition_type & content::PAGE_TRANSITION_FORWARD_BACK) == 0) { 304 (transition_type & content::PAGE_TRANSITION_FORWARD_BACK) == 0) {
305 // If so, create or get the segment. 305 // If so, create or get the segment.
306 std::string segment_name = db_->ComputeSegmentName(url); 306 std::string segment_name = db_->ComputeSegmentName(url);
307 URLID url_id = db_->GetRowForURL(url, NULL); 307 URLID url_id = db_->GetRowForURL(url, NULL);
308 if (!url_id) 308 if (!url_id)
309 return 0; 309 return 0;
310 310
311 if (!(segment_id = db_->GetSegmentNamed(segment_name))) { 311 segment_id = db_->GetSegmentNamed(segment_name);
312 if (!(segment_id = db_->CreateSegment(url_id, segment_name))) { 312 if (!segment_id) {
313 segment_id = db_->CreateSegment(url_id, segment_name);
314 if (!segment_id) {
313 NOTREACHED(); 315 NOTREACHED();
314 return 0; 316 return 0;
315 } 317 }
316 } else { 318 } else {
317 // Note: if we update an existing segment, we update the url used to 319 // Note: if we update an existing segment, we update the url used to
318 // represent that segment in order to minimize stale most visited 320 // represent that segment in order to minimize stale most visited
319 // images. 321 // images.
320 db_->UpdateSegmentRepresentationURL(segment_id, url_id); 322 db_->UpdateSegmentRepresentationURL(segment_id, url_id);
321 } 323 }
322 } else { 324 } else {
323 // Note: it is possible there is no segment ID set for this visit chain. 325 // Note: it is possible there is no segment ID set for this visit chain.
324 // This can happen if the initial navigation wasn't AUTO_BOOKMARK or 326 // This can happen if the initial navigation wasn't AUTO_BOOKMARK or
325 // TYPED. (For example GENERATED). In this case this visit doesn't count 327 // TYPED. (For example GENERATED). In this case this visit doesn't count
326 // toward any segment. 328 // toward any segment.
327 if (!(segment_id = GetLastSegmentID(from_visit))) 329 segment_id = GetLastSegmentID(from_visit);
330 if (!segment_id)
328 return 0; 331 return 0;
329 } 332 }
330 333
331 // Set the segment in the visit. 334 // Set the segment in the visit.
332 if (!db_->SetSegmentID(visit_id, segment_id)) { 335 if (!db_->SetSegmentID(visit_id, segment_id)) {
333 NOTREACHED(); 336 NOTREACHED();
334 return 0; 337 return 0;
335 } 338 }
336 339
337 // Finally, increase the counter for that segment / day. 340 // Finally, increase the counter for that segment / day.
(...skipping 2376 matching lines...) Expand 10 before | Expand all | Expand 10 after
2714 int rank = kPageVisitStatsMaxTopSites; 2717 int rank = kPageVisitStatsMaxTopSites;
2715 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); 2718 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url);
2716 if (it != most_visited_urls_map_.end()) 2719 if (it != most_visited_urls_map_.end())
2717 rank = (*it).second; 2720 rank = (*it).second;
2718 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", 2721 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank",
2719 rank, kPageVisitStatsMaxTopSites + 1); 2722 rank, kPageVisitStatsMaxTopSites + 1);
2720 } 2723 }
2721 #endif 2724 #endif
2722 2725
2723 } // namespace history 2726 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698