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

Side by Side Diff: sync/internal_api/attachments/attachment_downloader_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_downloader_impl.h" 5 #include "sync/internal_api/public/attachments/attachment_downloader_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 "net/base/load_flags.h" 9 #include "net/base/load_flags.h"
10 #include "net/http/http_status_code.h" 10 #include "net/http/http_status_code.h"
(...skipping 23 matching lines...) Expand all
34 const AttachmentUrl& attachment_url) 34 const AttachmentUrl& attachment_url)
35 : attachment_id(attachment_id), attachment_url(attachment_url) { 35 : attachment_id(attachment_id), attachment_url(attachment_url) {
36 } 36 }
37 37
38 AttachmentDownloaderImpl::AttachmentDownloaderImpl( 38 AttachmentDownloaderImpl::AttachmentDownloaderImpl(
39 const GURL& sync_service_url, 39 const GURL& sync_service_url,
40 const scoped_refptr<net::URLRequestContextGetter>& 40 const scoped_refptr<net::URLRequestContextGetter>&
41 url_request_context_getter, 41 url_request_context_getter,
42 const std::string& account_id, 42 const std::string& account_id,
43 const OAuth2TokenService::ScopeSet& scopes, 43 const OAuth2TokenService::ScopeSet& scopes,
44 scoped_ptr<OAuth2TokenServiceRequest::TokenServiceProvider> 44 const scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider>&
45 token_service_provider) 45 token_service_provider)
46 : OAuth2TokenService::Consumer("attachment-downloader-impl"), 46 : OAuth2TokenService::Consumer("attachment-downloader-impl"),
47 sync_service_url_(sync_service_url), 47 sync_service_url_(sync_service_url),
48 url_request_context_getter_(url_request_context_getter), 48 url_request_context_getter_(url_request_context_getter),
49 account_id_(account_id), 49 account_id_(account_id),
50 oauth2_scopes_(scopes), 50 oauth2_scopes_(scopes),
51 token_service_provider_(token_service_provider.Pass()) { 51 token_service_provider_(token_service_provider) {
52 DCHECK(!account_id.empty()); 52 DCHECK(!account_id.empty());
53 DCHECK(!scopes.empty()); 53 DCHECK(!scopes.empty());
54 DCHECK(token_service_provider_); 54 DCHECK(token_service_provider_);
55 DCHECK(url_request_context_getter_); 55 DCHECK(url_request_context_getter_);
56 } 56 }
57 57
58 AttachmentDownloaderImpl::~AttachmentDownloaderImpl() { 58 AttachmentDownloaderImpl::~AttachmentDownloaderImpl() {
59 } 59 }
60 60
61 void AttachmentDownloaderImpl::DownloadAttachment( 61 void AttachmentDownloaderImpl::DownloadAttachment(
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 attachment.reset(new Attachment(Attachment::CreateWithId( 193 attachment.reset(new Attachment(Attachment::CreateWithId(
194 download_state.attachment_id, attachment_data))); 194 download_state.attachment_id, attachment_data)));
195 } 195 }
196 196
197 base::MessageLoop::current()->PostTask( 197 base::MessageLoop::current()->PostTask(
198 FROM_HERE, base::Bind(*iter, result, base::Passed(&attachment))); 198 FROM_HERE, base::Bind(*iter, result, base::Passed(&attachment)));
199 } 199 }
200 } 200 }
201 201
202 } // namespace syncer 202 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698