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

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

Issue 251012: Assert that thread-safe reference counting is used with... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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) 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
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 : public HistoryService::URLEnumerator, 168 class VisitedLinkMaster::TableBuilder :
169 public base::RefCounted<TableBuilder> { 169 public HistoryService::URLEnumerator,
170 public base::RefCountedThreadSafe<TableBuilder> {
170 public: 171 public:
171 TableBuilder(VisitedLinkMaster* master, 172 TableBuilder(VisitedLinkMaster* master,
172 const uint8 salt[LINK_SALT_LENGTH]); 173 const uint8 salt[LINK_SALT_LENGTH]);
173 174
174 // Called on the main thread when the master is being destroyed. This will 175 // Called on the main thread when the master is being destroyed. This will
175 // prevent a crash when the query completes and the master is no longer 176 // prevent a crash when the query completes and the master is no longer
176 // around. We can not actually do anything but mark this fact, since the 177 // around. We can not actually do anything but mark this fact, since the
177 // table will be being rebuilt simultaneously on the other thread. 178 // table will be being rebuilt simultaneously on the other thread.
178 void DisownMaster(); 179 void DisownMaster();
179 180
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 } 1030 }
1030 1031
1031 void VisitedLinkMaster::TableBuilder::OnCompleteMainThread() { 1032 void VisitedLinkMaster::TableBuilder::OnCompleteMainThread() {
1032 if (master_) 1033 if (master_)
1033 master_->OnTableRebuildComplete(success_, fingerprints_); 1034 master_->OnTableRebuildComplete(success_, fingerprints_);
1034 1035
1035 // WILL (generally) DELETE THIS! This balances the AddRef in 1036 // WILL (generally) DELETE THIS! This balances the AddRef in
1036 // VisitedLinkMaster::RebuildTableFromHistory. 1037 // VisitedLinkMaster::RebuildTableFromHistory.
1037 Release(); 1038 Release();
1038 } 1039 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_crash_handler_host_linux.cc ('k') | chrome/common/extensions/extension_error_reporter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698