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

Unified Diff: components/sync/engine_impl/attachments/attachment_uploader_impl.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_impl/attachments/attachment_uploader_impl.cc
diff --git a/components/sync/engine_impl/attachments/attachment_uploader_impl.cc b/components/sync/engine_impl/attachments/attachment_uploader_impl.cc
index 7ff3d63b1072667ab7dbca4fc40e333997c4dda7..ce3be82fe8297e88c905fd640ff3190241956b19 100644
--- a/components/sync/engine_impl/attachments/attachment_uploader_impl.cc
+++ b/components/sync/engine_impl/attachments/attachment_uploader_impl.cc
@@ -41,9 +41,9 @@ const char kSyncDataTypeId[] = "X-Sync-Data-Type-Id";
namespace syncer {
// Encapsulates all the state associated with a single upload.
-class AttachmentUploaderImpl::UploadState : public net::URLFetcherDelegate,
- public OAuth2TokenService::Consumer,
- public base::NonThreadSafe {
+class AttachmentUploaderImpl::UploadState
+ : public net::URLFetcherDelegate,
+ public OAuth2TokenService::Consumer {
public:
// Construct an UploadState.
//
@@ -117,6 +117,8 @@ class AttachmentUploaderImpl::UploadState : public net::URLFetcherDelegate,
std::unique_ptr<OAuth2TokenServiceRequest> access_token_request_;
ModelType model_type_;
+ SEQUENCE_CHECKER(sequence_checker_);
+
DISALLOW_COPY_AND_ASSIGN(UploadState);
};
@@ -156,25 +158,25 @@ AttachmentUploaderImpl::UploadState::UploadState(
AttachmentUploaderImpl::UploadState::~UploadState() {}
bool AttachmentUploaderImpl::UploadState::IsStopped() const {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return is_stopped_;
}
void AttachmentUploaderImpl::UploadState::AddUserCallback(
const UploadCallback& user_callback) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!is_stopped_);
user_callbacks_.push_back(user_callback);
}
const Attachment& AttachmentUploaderImpl::UploadState::GetAttachment() {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return attachment_;
}
void AttachmentUploaderImpl::UploadState::OnURLFetchComplete(
const net::URLFetcher* source) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (is_stopped_) {
return;
}
@@ -207,7 +209,7 @@ void AttachmentUploaderImpl::UploadState::OnGetTokenSuccess(
const OAuth2TokenService::Request* request,
const std::string& access_token,
const base::Time& expiration_time) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (is_stopped_) {
return;
}
@@ -266,7 +268,7 @@ void AttachmentUploaderImpl::UploadState::OnGetTokenSuccess(
void AttachmentUploaderImpl::UploadState::OnGetTokenFailure(
const OAuth2TokenService::Request* request,
const GoogleServiceAuthError& error) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (is_stopped_) {
return;
}
@@ -319,7 +321,7 @@ AttachmentUploaderImpl::AttachmentUploaderImpl(
raw_store_birthday_(store_birthday),
model_type_(model_type),
weak_ptr_factory_(this) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!account_id.empty());
DCHECK(!scopes.empty());
DCHECK(token_service_provider_.get());
@@ -327,12 +329,12 @@ AttachmentUploaderImpl::AttachmentUploaderImpl(
}
AttachmentUploaderImpl::~AttachmentUploaderImpl() {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
void AttachmentUploaderImpl::UploadAttachment(const Attachment& attachment,
const UploadCallback& callback) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
const AttachmentId attachment_id = attachment.GetId();
const std::string unique_id = attachment_id.GetProto().unique_id();
DCHECK(!unique_id.empty());

Powered by Google App Engine
This is Rietveld 408576698