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

Side by Side Diff: chrome/browser/history/history_backend.cc

Issue 22305002: NULL check before calling thumbnail_db_ method. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 if (!archived_db_->Init(archived_name)) { 652 if (!archived_db_->Init(archived_name)) {
653 LOG(WARNING) << "Could not initialize the archived database."; 653 LOG(WARNING) << "Could not initialize the archived database.";
654 archived_db_.reset(); 654 archived_db_.reset();
655 } 655 }
656 656
657 // Generate the history and thumbnail database metrics only after performing 657 // Generate the history and thumbnail database metrics only after performing
658 // any migration work. 658 // any migration work.
659 if (base::RandInt(1, 100) == 50) { 659 if (base::RandInt(1, 100) == 50) {
660 // Only do this computation sometimes since it can be expensive. 660 // Only do this computation sometimes since it can be expensive.
661 db_->ComputeDatabaseMetrics(history_name); 661 db_->ComputeDatabaseMetrics(history_name);
662 thumbnail_db_->ComputeDatabaseMetrics(); 662 if (thumbnail_db_)
663 thumbnail_db_->ComputeDatabaseMetrics();
663 } 664 }
664 665
665 // Tell the expiration module about all the nice databases we made. This must 666 // Tell the expiration module about all the nice databases we made. This must
666 // happen before db_->Init() is called since the callback ForceArchiveHistory 667 // happen before db_->Init() is called since the callback ForceArchiveHistory
667 // may need to expire stuff. 668 // may need to expire stuff.
668 // 669 //
669 // *sigh*, this can all be cleaned up when that migration code is removed. 670 // *sigh*, this can all be cleaned up when that migration code is removed.
670 // The main DB initialization should intuitively be first (not that it 671 // The main DB initialization should intuitively be first (not that it
671 // actually matters) and the expirer should be set last. 672 // actually matters) and the expirer should be set last.
672 expirer_.SetDatabases(db_.get(), archived_db_.get(), 673 expirer_.SetDatabases(db_.get(), archived_db_.get(),
(...skipping 2326 matching lines...) Expand 10 before | Expand all | Expand 10 after
2999 int rank = kPageVisitStatsMaxTopSites; 3000 int rank = kPageVisitStatsMaxTopSites;
3000 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url); 3001 std::map<GURL, int>::const_iterator it = most_visited_urls_map_.find(url);
3001 if (it != most_visited_urls_map_.end()) 3002 if (it != most_visited_urls_map_.end())
3002 rank = (*it).second; 3003 rank = (*it).second;
3003 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank", 3004 UMA_HISTOGRAM_ENUMERATION("History.TopSitesVisitsByRank",
3004 rank, kPageVisitStatsMaxTopSites + 1); 3005 rank, kPageVisitStatsMaxTopSites + 1);
3005 } 3006 }
3006 #endif 3007 #endif
3007 3008
3008 } // namespace history 3009 } // namespace history
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698