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

Unified Diff: components/sync/engine/attachments/in_memory_attachment_store.cc

Issue 2915453002: Deprecate NonThreadSafe in components/sync in favor of SequenceChecker. (Closed)
Patch Set: fix comment Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: components/sync/engine/attachments/in_memory_attachment_store.cc
diff --git a/components/sync/engine/attachments/in_memory_attachment_store.cc b/components/sync/engine/attachments/in_memory_attachment_store.cc
index 7a82b557276b99887384f8ea185b8e6c04975564..0af71baf104e007d9b4002356599d239e3c5ec15 100644
--- a/components/sync/engine/attachments/in_memory_attachment_store.cc
+++ b/components/sync/engine/attachments/in_memory_attachment_store.cc
@@ -28,14 +28,16 @@ InMemoryAttachmentStore::InMemoryAttachmentStore(
const scoped_refptr<base::SequencedTaskRunner>& callback_task_runner)
: AttachmentStoreBackend(callback_task_runner) {
// Object is created on one thread but used on another.
- DetachFromThread();
+ DETACH_FROM_SEQUENCE(sequence_checker_);
}
-InMemoryAttachmentStore::~InMemoryAttachmentStore() {}
+InMemoryAttachmentStore::~InMemoryAttachmentStore() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+}
void InMemoryAttachmentStore::Init(
const AttachmentStore::InitCallback& callback) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
PostCallback(base::Bind(callback, AttachmentStore::SUCCESS));
}
@@ -43,7 +45,7 @@ void InMemoryAttachmentStore::Read(
AttachmentStore::Component component,
const AttachmentIdList& ids,
const AttachmentStore::ReadCallback& callback) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
AttachmentStore::Result result_code = AttachmentStore::SUCCESS;
std::unique_ptr<AttachmentMap> result_map(new AttachmentMap);
std::unique_ptr<AttachmentIdList> unavailable_attachments(
@@ -70,7 +72,7 @@ void InMemoryAttachmentStore::Write(
AttachmentStore::Component component,
const AttachmentList& attachments,
const AttachmentStore::WriteCallback& callback) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
for (const auto& attachment : attachments) {
attachments_.insert(std::make_pair(attachment.GetId(),
AttachmentEntry(attachment, component)));
@@ -80,7 +82,7 @@ void InMemoryAttachmentStore::Write(
void InMemoryAttachmentStore::SetReference(AttachmentStore::Component component,
const AttachmentIdList& ids) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
for (const auto& id : ids) {
AttachmentEntryMap::iterator attachments_iter = attachments_.find(id);
if (attachments_iter != attachments_.end()) {
@@ -93,7 +95,7 @@ void InMemoryAttachmentStore::DropReference(
AttachmentStore::Component component,
const AttachmentIdList& ids,
const AttachmentStore::DropCallback& callback) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
AttachmentStore::Result result = AttachmentStore::SUCCESS;
for (const auto& id : ids) {
AttachmentEntryMap::iterator attachments_iter = attachments_.find(id);
@@ -112,7 +114,7 @@ void InMemoryAttachmentStore::ReadMetadataById(
AttachmentStore::Component component,
const AttachmentIdList& ids,
const AttachmentStore::ReadMetadataCallback& callback) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
AttachmentStore::Result result_code = AttachmentStore::SUCCESS;
std::unique_ptr<AttachmentMetadataList> metadata_list(
new AttachmentMetadataList());
@@ -136,7 +138,7 @@ void InMemoryAttachmentStore::ReadMetadataById(
void InMemoryAttachmentStore::ReadMetadata(
AttachmentStore::Component component,
const AttachmentStore::ReadMetadataCallback& callback) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
AttachmentStore::Result result_code = AttachmentStore::SUCCESS;
std::unique_ptr<AttachmentMetadataList> metadata_list(
new AttachmentMetadataList());

Powered by Google App Engine
This is Rietveld 408576698