Index: chrome/browser/visitedlink/visitedlink_master.cc |
=================================================================== |
--- chrome/browser/visitedlink/visitedlink_master.cc (revision 116082) |
+++ chrome/browser/visitedlink/visitedlink_master.cc (working copy) |
@@ -242,6 +242,14 @@ |
return AddFingerprint(fingerprint, true); |
} |
+void VisitedLinkMaster::PostIOTask(const tracked_objects::Location& from_here, |
+ const base::Closure& task) { |
+ base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); |
+ if (sequence_token_.is_null()) |
+ sequence_token_ = pool->GetSequenceToken(); |
+ pool->PostSequencedWorkerTask(sequence_token_, from_here, task); |
+} |
+ |
void VisitedLinkMaster::AddURL(const GURL& url) { |
Hash index = TryToAddURL(url); |
if (!table_builder_ && index != null_hash_) { |
@@ -480,10 +488,7 @@ |
hash_table_, table_length_ * sizeof(Fingerprint)); |
// The hash table may have shrunk, so make sure this is the end. |
- BrowserThread::PostTask( |
- BrowserThread::FILE, |
- FROM_HERE, |
- base::Bind(base::IgnoreResult(&TruncateFile), file_)); |
+ PostIOTask(FROM_HERE, base::Bind(base::IgnoreResult(&TruncateFile), file_)); |
return true; |
} |
@@ -673,11 +678,7 @@ |
} |
if (!file_) |
return; |
- |
- BrowserThread::PostTask( |
- BrowserThread::FILE, |
- FROM_HERE, |
- base::Bind(base::IgnoreResult(&fclose), file_)); |
+ PostIOTask(FROM_HERE, base::Bind(base::IgnoreResult(&fclose), file_)); |
} |
bool VisitedLinkMaster::ResizeTableIfNecessary() { |
@@ -860,9 +861,7 @@ |
#ifndef NDEBUG |
posted_asynchronous_operation_ = true; |
#endif |
- |
- BrowserThread::PostTask( |
- BrowserThread::FILE, FROM_HERE, |
+ PostIOTask(FROM_HERE, |
base::Bind(&AsyncWrite, file, offset, |
std::string(static_cast<const char*>(data), data_size))); |
} |