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

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

Issue 8451009: HQP Refactoring (in Preparation for SQLite Cache) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/command_line.h"
13 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
14 #include "base/file_util.h" 13 #include "base/file_util.h"
15 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
17 #include "base/message_loop.h" 16 #include "base/message_loop.h"
18 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
19 #include "base/string_util.h" 18 #include "base/string_util.h"
20 #include "base/time.h" 19 #include "base/time.h"
21 #include "chrome/browser/autocomplete/history_url_provider.h" 20 #include "chrome/browser/autocomplete/history_url_provider.h"
22 #include "chrome/browser/bookmarks/bookmark_service.h" 21 #include "chrome/browser/bookmarks/bookmark_service.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 backend_destroy_message_loop_(NULL), 210 backend_destroy_message_loop_(NULL),
212 backend_destroy_task_(NULL), 211 backend_destroy_task_(NULL),
213 segment_queried_(false), 212 segment_queried_(false),
214 bookmark_service_(bookmark_service) { 213 bookmark_service_(bookmark_service) {
215 } 214 }
216 215
217 HistoryBackend::~HistoryBackend() { 216 HistoryBackend::~HistoryBackend() {
218 DCHECK(!scheduled_commit_) << "Deleting without cleanup"; 217 DCHECK(!scheduled_commit_) << "Deleting without cleanup";
219 ReleaseDBTasks(); 218 ReleaseDBTasks();
220 219
221 // First close the databases before optionally running the "destroy" task. 220 // Close the databases before optionally running the "destroy" task.
222 if (db_.get()) { 221 if (db_.get()) {
223 // Commit the long-running transaction. 222 // Commit the long-running transaction.
224 db_->CommitTransaction(); 223 db_->CommitTransaction();
225 db_.reset(); 224 db_.reset();
226 } 225 }
227 if (thumbnail_db_.get()) { 226 if (thumbnail_db_.get()) {
228 thumbnail_db_->CommitTransaction(); 227 thumbnail_db_->CommitTransaction();
229 thumbnail_db_.reset(); 228 thumbnail_db_.reset();
230 } 229 }
231 if (archived_db_.get()) { 230 if (archived_db_.get()) {
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 } 877 }
879 878
880 bool typed_url_changed = false; 879 bool typed_url_changed = false;
881 std::vector<URLRow> changed_urls; 880 std::vector<URLRow> changed_urls;
882 for (size_t i = 0; i < redirects->size(); i++) { 881 for (size_t i = 0; i < redirects->size(); i++) {
883 URLRow row; 882 URLRow row;
884 URLID row_id = db_->GetRowForURL(redirects->at(i), &row); 883 URLID row_id = db_->GetRowForURL(redirects->at(i), &row);
885 if (row_id && row.title() != title) { 884 if (row_id && row.title() != title) {
886 row.set_title(title); 885 row.set_title(title);
887 db_->UpdateURLRow(row_id, row); 886 db_->UpdateURLRow(row_id, row);
887 row.id_ = row_id;
888 changed_urls.push_back(row); 888 changed_urls.push_back(row);
889 if (row.typed_count() > 0) 889 if (row.typed_count() > 0)
890 typed_url_changed = true; 890 typed_url_changed = true;
891 } 891 }
892 } 892 }
893 893
894 // Broadcast notifications for typed URLs that have changed. This will 894 // Broadcast notifications for typed URLs that have changed. This will
895 // update the in-memory database. 895 // update the in-memory database.
896 // 896 //
897 // TODO(brettw) bug 1140020: Broadcast for all changes (not just typed), 897 // TODO(brettw) bug 1140020: Broadcast for all changes (not just typed),
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after
2316 break; 2316 break;
2317 } 2317 }
2318 } 2318 }
2319 } 2319 }
2320 UMA_HISTOGRAM_TIMES("History.GetFavIconFromDB", // historical name 2320 UMA_HISTOGRAM_TIMES("History.GetFavIconFromDB", // historical name
2321 TimeTicks::Now() - beginning_time); 2321 TimeTicks::Now() - beginning_time);
2322 return success; 2322 return success;
2323 } 2323 }
2324 2324
2325 } // namespace history 2325 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/history_backend.h ('k') | chrome/browser/history/history_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698