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

Side by Side Diff: chrome/browser/visitedlink/visitedlink_master.cc

Issue 10830297: Revert 151419 - Replace HistoryQuickProvider protobuf-based caching with an SQLite-based database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | « chrome/browser/history/url_index_private_data_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Deleted: svn:mergeinfo
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/visitedlink/visitedlink_master.h" 5 #include "chrome/browser/visitedlink/visitedlink_master.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <io.h> 9 #include <io.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 TableBuilder(VisitedLinkMaster* master, 140 TableBuilder(VisitedLinkMaster* master,
141 const uint8 salt[LINK_SALT_LENGTH]); 141 const uint8 salt[LINK_SALT_LENGTH]);
142 142
143 // Called on the main thread when the master is being destroyed. This will 143 // Called on the main thread when the master is being destroyed. This will
144 // prevent a crash when the query completes and the master is no longer 144 // prevent a crash when the query completes and the master is no longer
145 // around. We can not actually do anything but mark this fact, since the 145 // around. We can not actually do anything but mark this fact, since the
146 // table will be being rebuilt simultaneously on the other thread. 146 // table will be being rebuilt simultaneously on the other thread.
147 void DisownMaster(); 147 void DisownMaster();
148 148
149 // HistoryService::URLEnumerator 149 // HistoryService::URLEnumerator
150 virtual void OnURL(const history::URLRow& url_row); 150 virtual void OnURL(const GURL& url);
151 virtual void OnComplete(bool succeed); 151 virtual void OnComplete(bool succeed);
152 152
153 private: 153 private:
154 friend class base::RefCountedThreadSafe<TableBuilder>; 154 friend class base::RefCountedThreadSafe<TableBuilder>;
155 155
156 ~TableBuilder() {} 156 ~TableBuilder() {}
157 157
158 // OnComplete mashals to this function on the main thread to do the 158 // OnComplete mashals to this function on the main thread to do the
159 // notification. 159 // notification.
160 void OnCompleteMainThread(); 160 void OnCompleteMainThread();
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 fingerprints_.reserve(4096); 946 fingerprints_.reserve(4096);
947 memcpy(salt_, salt, LINK_SALT_LENGTH * sizeof(uint8)); 947 memcpy(salt_, salt, LINK_SALT_LENGTH * sizeof(uint8));
948 } 948 }
949 949
950 // TODO(brettw): Do we want to try to cancel the request if this happens? It 950 // TODO(brettw): Do we want to try to cancel the request if this happens? It
951 // could delay shutdown if there are a lot of URLs. 951 // could delay shutdown if there are a lot of URLs.
952 void VisitedLinkMaster::TableBuilder::DisownMaster() { 952 void VisitedLinkMaster::TableBuilder::DisownMaster() {
953 master_ = NULL; 953 master_ = NULL;
954 } 954 }
955 955
956 void VisitedLinkMaster::TableBuilder::OnURL(const history::URLRow& url_row) { 956 void VisitedLinkMaster::TableBuilder::OnURL(const GURL& url) {
957 const GURL& url((url_row.url()));
958 if (!url.is_empty()) { 957 if (!url.is_empty()) {
959 fingerprints_.push_back(VisitedLinkMaster::ComputeURLFingerprint( 958 fingerprints_.push_back(VisitedLinkMaster::ComputeURLFingerprint(
960 url.spec().data(), url.spec().length(), salt_)); 959 url.spec().data(), url.spec().length(), salt_));
961 } 960 }
962 } 961 }
963 962
964 void VisitedLinkMaster::TableBuilder::OnComplete(bool success) { 963 void VisitedLinkMaster::TableBuilder::OnComplete(bool success) {
965 success_ = success; 964 success_ = success;
966 DLOG_IF(WARNING, !success) << "Unable to rebuild visited links"; 965 DLOG_IF(WARNING, !success) << "Unable to rebuild visited links";
967 966
968 // Marshal to the main thread to notify the VisitedLinkMaster that the 967 // Marshal to the main thread to notify the VisitedLinkMaster that the
969 // rebuild is complete. 968 // rebuild is complete.
970 BrowserThread::PostTask( 969 BrowserThread::PostTask(
971 BrowserThread::UI, FROM_HERE, 970 BrowserThread::UI, FROM_HERE,
972 base::Bind(&TableBuilder::OnCompleteMainThread, this)); 971 base::Bind(&TableBuilder::OnCompleteMainThread, this));
973 } 972 }
974 973
975 void VisitedLinkMaster::TableBuilder::OnCompleteMainThread() { 974 void VisitedLinkMaster::TableBuilder::OnCompleteMainThread() {
976 if (master_) 975 if (master_)
977 master_->OnTableRebuildComplete(success_, fingerprints_); 976 master_->OnTableRebuildComplete(success_, fingerprints_);
978 977
979 // WILL (generally) DELETE THIS! This balances the AddRef in 978 // WILL (generally) DELETE THIS! This balances the AddRef in
980 // VisitedLinkMaster::RebuildTableFromHistory. 979 // VisitedLinkMaster::RebuildTableFromHistory.
981 Release(); 980 Release();
982 } 981 }
OLDNEW
« no previous file with comments | « chrome/browser/history/url_index_private_data_unittest.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698