OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_master.h" | 5 #include "chrome/browser/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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // | 158 // |
159 // The builder will store the fingerprints for those URLs, and then marshalls | 159 // The builder will store the fingerprints for those URLs, and then marshalls |
160 // back to the main thread where the VisitedLinkMaster will be notified. The | 160 // back to the main thread where the VisitedLinkMaster will be notified. The |
161 // master then replaces its table with a new table containing the computed | 161 // master then replaces its table with a new table containing the computed |
162 // fingerprints. | 162 // fingerprints. |
163 // | 163 // |
164 // The builder must remain active while the history system is using it. | 164 // The builder must remain active while the history system is using it. |
165 // Sometimes, the master will be deleted before the rebuild is complete, in | 165 // Sometimes, the master will be deleted before the rebuild is complete, in |
166 // which case it notifies the builder via DisownMaster(). The builder will | 166 // which case it notifies the builder via DisownMaster(). The builder will |
167 // delete itself once rebuilding is complete, and not execute any callback. | 167 // delete itself once rebuilding is complete, and not execute any callback. |
168 class VisitedLinkMaster::TableBuilder : | 168 class VisitedLinkMaster::TableBuilder : public HistoryService::URLEnumerator, |
169 public HistoryService::URLEnumerator, | 169 public base::RefCounted<TableBuilder> { |
170 public base::RefCountedThreadSafe<TableBuilder> { | |
171 public: | 170 public: |
172 TableBuilder(VisitedLinkMaster* master, | 171 TableBuilder(VisitedLinkMaster* master, |
173 const uint8 salt[LINK_SALT_LENGTH]); | 172 const uint8 salt[LINK_SALT_LENGTH]); |
174 | 173 |
175 // Called on the main thread when the master is being destroyed. This will | 174 // Called on the main thread when the master is being destroyed. This will |
176 // prevent a crash when the query completes and the master is no longer | 175 // prevent a crash when the query completes and the master is no longer |
177 // around. We can not actually do anything but mark this fact, since the | 176 // around. We can not actually do anything but mark this fact, since the |
178 // table will be being rebuilt simultaneously on the other thread. | 177 // table will be being rebuilt simultaneously on the other thread. |
179 void DisownMaster(); | 178 void DisownMaster(); |
180 | 179 |
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 } | 1029 } |
1031 | 1030 |
1032 void VisitedLinkMaster::TableBuilder::OnCompleteMainThread() { | 1031 void VisitedLinkMaster::TableBuilder::OnCompleteMainThread() { |
1033 if (master_) | 1032 if (master_) |
1034 master_->OnTableRebuildComplete(success_, fingerprints_); | 1033 master_->OnTableRebuildComplete(success_, fingerprints_); |
1035 | 1034 |
1036 // WILL (generally) DELETE THIS! This balances the AddRef in | 1035 // WILL (generally) DELETE THIS! This balances the AddRef in |
1037 // VisitedLinkMaster::RebuildTableFromHistory. | 1036 // VisitedLinkMaster::RebuildTableFromHistory. |
1038 Release(); | 1037 Release(); |
1039 } | 1038 } |
OLD | NEW |