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

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

Issue 458753006: Fix use after free bug by calling GetTokenService in Core's ctor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update TSP comment (CANDIDATE). Created 6 years, 4 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 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/threading/non_thread_safe.h" 9 #include "base/threading/non_thread_safe.h"
10 #include "google_apis/gaia/gaia_constants.h" 10 #include "google_apis/gaia/gaia_constants.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 owner_->DeleteUploadStateFor(attachment_.GetId().GetProto().unique_id()); 205 owner_->DeleteUploadStateFor(attachment_.GetId().GetProto().unique_id());
206 return; 206 return;
207 } 207 }
208 208
209 AttachmentUploaderImpl::AttachmentUploaderImpl( 209 AttachmentUploaderImpl::AttachmentUploaderImpl(
210 const GURL& sync_service_url, 210 const GURL& sync_service_url,
211 const scoped_refptr<net::URLRequestContextGetter>& 211 const scoped_refptr<net::URLRequestContextGetter>&
212 url_request_context_getter, 212 url_request_context_getter,
213 const std::string& account_id, 213 const std::string& account_id,
214 const OAuth2TokenService::ScopeSet& scopes, 214 const OAuth2TokenService::ScopeSet& scopes,
215 scoped_ptr<OAuth2TokenServiceRequest::TokenServiceProvider> 215 const scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider>&
216 token_service_provider) 216 token_service_provider)
217 : sync_service_url_(sync_service_url), 217 : sync_service_url_(sync_service_url),
218 url_request_context_getter_(url_request_context_getter), 218 url_request_context_getter_(url_request_context_getter),
219 account_id_(account_id), 219 account_id_(account_id),
220 scopes_(scopes), 220 scopes_(scopes),
221 token_service_provider_(token_service_provider.Pass()) { 221 token_service_provider_(token_service_provider) {
222 DCHECK(CalledOnValidThread()); 222 DCHECK(CalledOnValidThread());
223 DCHECK(!account_id.empty()); 223 DCHECK(!account_id.empty());
224 DCHECK(!scopes.empty()); 224 DCHECK(!scopes.empty());
225 DCHECK(token_service_provider_); 225 DCHECK(token_service_provider_);
226 } 226 }
227 227
228 AttachmentUploaderImpl::~AttachmentUploaderImpl() { 228 AttachmentUploaderImpl::~AttachmentUploaderImpl() {
229 DCHECK(CalledOnValidThread()); 229 DCHECK(CalledOnValidThread());
230 } 230 }
231 231
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 GURL::Replacements replacements; 269 GURL::Replacements replacements;
270 replacements.SetPathStr(path); 270 replacements.SetPathStr(path);
271 return sync_service_url.ReplaceComponents(replacements); 271 return sync_service_url.ReplaceComponents(replacements);
272 } 272 }
273 273
274 void AttachmentUploaderImpl::DeleteUploadStateFor(const UniqueId& unique_id) { 274 void AttachmentUploaderImpl::DeleteUploadStateFor(const UniqueId& unique_id) {
275 state_map_.erase(unique_id); 275 state_map_.erase(unique_id);
276 } 276 }
277 277
278 } // namespace syncer 278 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698