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

Side by Side Diff: sync/internal_api/attachments/attachment_uploader_impl.cc

Issue 1866243002: Convert //sync from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sync/internal_api/public/attachments/attachment_uploader_impl.h" 5 #include "sync/internal_api/public/attachments/attachment_uploader_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 void StopAndReportResult(const UploadResult& result, 100 void StopAndReportResult(const UploadResult& result,
101 const AttachmentId& attachment_id); 101 const AttachmentId& attachment_id);
102 102
103 bool is_stopped_; 103 bool is_stopped_;
104 GURL upload_url_; 104 GURL upload_url_;
105 const scoped_refptr<net::URLRequestContextGetter>& 105 const scoped_refptr<net::URLRequestContextGetter>&
106 url_request_context_getter_; 106 url_request_context_getter_;
107 Attachment attachment_; 107 Attachment attachment_;
108 UploadCallbackList user_callbacks_; 108 UploadCallbackList user_callbacks_;
109 scoped_ptr<net::URLFetcher> fetcher_; 109 std::unique_ptr<net::URLFetcher> fetcher_;
110 std::string account_id_; 110 std::string account_id_;
111 OAuth2TokenService::ScopeSet scopes_; 111 OAuth2TokenService::ScopeSet scopes_;
112 std::string access_token_; 112 std::string access_token_;
113 std::string raw_store_birthday_; 113 std::string raw_store_birthday_;
114 OAuth2TokenServiceRequest::TokenServiceProvider* token_service_provider_; 114 OAuth2TokenServiceRequest::TokenServiceProvider* token_service_provider_;
115 // Pointer to the AttachmentUploaderImpl that owns this object. 115 // Pointer to the AttachmentUploaderImpl that owns this object.
116 base::WeakPtr<AttachmentUploaderImpl> owner_; 116 base::WeakPtr<AttachmentUploaderImpl> owner_;
117 scoped_ptr<OAuth2TokenServiceRequest> access_token_request_; 117 std::unique_ptr<OAuth2TokenServiceRequest> access_token_request_;
118 ModelType model_type_; 118 ModelType model_type_;
119 119
120 DISALLOW_COPY_AND_ASSIGN(UploadState); 120 DISALLOW_COPY_AND_ASSIGN(UploadState);
121 }; 121 };
122 122
123 AttachmentUploaderImpl::UploadState::UploadState( 123 AttachmentUploaderImpl::UploadState::UploadState(
124 const GURL& upload_url, 124 const GURL& upload_url,
125 const scoped_refptr<net::URLRequestContextGetter>& 125 const scoped_refptr<net::URLRequestContextGetter>&
126 url_request_context_getter, 126 url_request_context_getter,
127 const Attachment& attachment, 127 const Attachment& attachment,
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 ->Equals(iter->second->GetAttachment().GetData())); 318 ->Equals(iter->second->GetAttachment().GetData()));
319 iter->second->AddUserCallback(callback); 319 iter->second->AddUserCallback(callback);
320 return; 320 return;
321 } else { 321 } else {
322 // It's stopped so we can't use it. Delete it. 322 // It's stopped so we can't use it. Delete it.
323 state_map_.erase(iter); 323 state_map_.erase(iter);
324 } 324 }
325 } 325 }
326 326
327 const GURL url = GetURLForAttachmentId(sync_service_url_, attachment_id); 327 const GURL url = GetURLForAttachmentId(sync_service_url_, attachment_id);
328 scoped_ptr<UploadState> upload_state(new UploadState( 328 std::unique_ptr<UploadState> upload_state(new UploadState(
329 url, url_request_context_getter_, attachment, callback, account_id_, 329 url, url_request_context_getter_, attachment, callback, account_id_,
330 scopes_, token_service_provider_.get(), raw_store_birthday_, 330 scopes_, token_service_provider_.get(), raw_store_birthday_,
331 weak_ptr_factory_.GetWeakPtr(), model_type_)); 331 weak_ptr_factory_.GetWeakPtr(), model_type_));
332 state_map_.add(unique_id, std::move(upload_state)); 332 state_map_.add(unique_id, std::move(upload_state));
333 } 333 }
334 334
335 // Static. 335 // Static.
336 GURL AttachmentUploaderImpl::GetURLForAttachmentId( 336 GURL AttachmentUploaderImpl::GetURLForAttachmentId(
337 const GURL& sync_service_url, 337 const GURL& sync_service_url,
338 const AttachmentId& attachment_id) { 338 const AttachmentId& attachment_id) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 "%s: %s", kSyncStoreBirthday, encoded_store_birthday.c_str())); 393 "%s: %s", kSyncStoreBirthday, encoded_store_birthday.c_str()));
394 394
395 // Use field number to pass ModelType because it's stable and we have server 395 // Use field number to pass ModelType because it's stable and we have server
396 // code to decode it. 396 // code to decode it.
397 const int field_number = GetSpecificsFieldNumberFromModelType(model_type); 397 const int field_number = GetSpecificsFieldNumberFromModelType(model_type);
398 fetcher->AddExtraRequestHeader( 398 fetcher->AddExtraRequestHeader(
399 base::StringPrintf("%s: %d", kSyncDataTypeId, field_number)); 399 base::StringPrintf("%s: %d", kSyncDataTypeId, field_number));
400 } 400 }
401 401
402 } // namespace syncer 402 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698