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

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: 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 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 // http://crbug.com/96860 is fixed. 342 // http://crbug.com/96860 is fixed.
343 if ((t == content::PAGE_TRANSITION_TYPED || 343 if ((t == content::PAGE_TRANSITION_TYPED ||
344 t == content::PAGE_TRANSITION_AUTO_BOOKMARK) && 344 t == content::PAGE_TRANSITION_AUTO_BOOKMARK) &&
345 (transition_type & content::PAGE_TRANSITION_FORWARD_BACK) == 0) { 345 (transition_type & content::PAGE_TRANSITION_FORWARD_BACK) == 0) {
346 // If so, create or get the segment. 346 // If so, create or get the segment.
347 std::string segment_name = db_->ComputeSegmentName(url); 347 std::string segment_name = db_->ComputeSegmentName(url);
348 URLID url_id = db_->GetRowForURL(url, NULL); 348 URLID url_id = db_->GetRowForURL(url, NULL);
349 if (!url_id) 349 if (!url_id)
350 return 0; 350 return 0;
351 351
352 if (!(segment_id = db_->GetSegmentNamed(segment_name))) { 352 segment_id = db_->GetSegmentNamed(segment_name);
353 if (!(segment_id = db_->CreateSegment(url_id, segment_name))) { 353 if (!segment_id) {
354 segment_id = db_->CreateSegment(url_id, segment_name);
355 if (!segment_id) {
354 NOTREACHED(); 356 NOTREACHED();
355 return 0; 357 return 0;
356 } 358 }
357 } else { 359 } else {
358 // Note: if we update an existing segment, we update the url used to 360 // Note: if we update an existing segment, we update the url used to
359 // represent that segment in order to minimize stale most visited 361 // represent that segment in order to minimize stale most visited
360 // images. 362 // images.
361 db_->UpdateSegmentRepresentationURL(segment_id, url_id); 363 db_->UpdateSegmentRepresentationURL(segment_id, url_id);
362 } 364 }
363 } else { 365 } else {
364 // Note: it is possible there is no segment ID set for this visit chain. 366 // Note: it is possible there is no segment ID set for this visit chain.
365 // This can happen if the initial navigation wasn't AUTO_BOOKMARK or 367 // This can happen if the initial navigation wasn't AUTO_BOOKMARK or
366 // TYPED. (For example GENERATED). In this case this visit doesn't count 368 // TYPED. (For example GENERATED). In this case this visit doesn't count
367 // toward any segment. 369 // toward any segment.
368 if (!(segment_id = GetLastSegmentID(from_visit))) 370 segment_id = GetLastSegmentID(from_visit);
371 if (!segment_id)
369 return 0; 372 return 0;
370 } 373 }
371 374
372 // Set the segment in the visit. 375 // Set the segment in the visit.
373 if (!db_->SetSegmentID(visit_id, segment_id)) { 376 if (!db_->SetSegmentID(visit_id, segment_id)) {
374 NOTREACHED(); 377 NOTREACHED();
375 return 0; 378 return 0;
376 } 379 }
377 380
378 // Finally, increase the counter for that segment / day. 381 // Finally, increase the counter for that segment / day.
(...skipping 2364 matching lines...) Expand 10 before | Expand all | Expand 10 after
2743 int rank = kPageVisitStatsMaxTopSites; 2746 int rank = kPageVisitStatsMaxTopSites;
2744 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); 2747 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url);
2745 if (it != most_visited_urls_map_.end()) 2748 if (it != most_visited_urls_map_.end())
2746 rank = (*it).second; 2749 rank = (*it).second;
2747 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", 2750 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank",
2748 rank, kPageVisitStatsMaxTopSites + 1); 2751 rank, kPageVisitStatsMaxTopSites + 1);
2749 } 2752 }
2750 #endif 2753 #endif
2751 2754
2752 } // namespace history 2755 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_install_error.cc ('k') | chrome/browser/prerender/prerender_local_predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698