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

Unified Diff: chrome/browser/sync/profile_sync_components_factory_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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/profile_sync_components_factory_impl.cc
diff --git a/chrome/browser/sync/profile_sync_components_factory_impl.cc b/chrome/browser/sync/profile_sync_components_factory_impl.cc
index 5a74820d78659956cac82db1fd014810a3e5b324..ba1b8cef542dba6a5cebf96fd6684f6a18a8e5a7 100644
--- a/chrome/browser/sync/profile_sync_components_factory_impl.cc
+++ b/chrome/browser/sync/profile_sync_components_factory_impl.cc
@@ -555,7 +555,6 @@ class TokenServiceProvider
TokenServiceProvider(
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
OAuth2TokenService* token_service);
- virtual ~TokenServiceProvider();
// OAuth2TokenServiceRequest::TokenServiceProvider implementation.
virtual scoped_refptr<base::SingleThreadTaskRunner>
@@ -563,6 +562,8 @@ class TokenServiceProvider
virtual OAuth2TokenService* GetTokenService() OVERRIDE;
private:
+ virtual ~TokenServiceProvider();
+
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
OAuth2TokenService* token_service_;
};
@@ -601,7 +602,7 @@ ProfileSyncComponentsFactoryImpl::CreateAttachmentService(
// signed in sync user (e.g. sync is running in "backup" mode).
if (!user_share.sync_credentials.email.empty() &&
!user_share.sync_credentials.scope_set.empty()) {
- scoped_ptr<OAuth2TokenServiceRequest::TokenServiceProvider>
+ scoped_refptr<OAuth2TokenServiceRequest::TokenServiceProvider>
token_service_provider(new TokenServiceProvider(
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::UI),
@@ -614,18 +615,18 @@ ProfileSyncComponentsFactoryImpl::CreateAttachmentService(
url_request_context_getter_,
user_share.sync_credentials.email,
user_share.sync_credentials.scope_set,
- token_service_provider.Pass()));
+ token_service_provider));
- token_service_provider.reset(new TokenServiceProvider(
+ token_service_provider = new TokenServiceProvider(
content::BrowserThread::GetMessageLoopProxyForThread(
content::BrowserThread::UI),
- token_service_));
+ token_service_);
attachment_downloader = syncer::AttachmentDownloader::Create(
sync_service_url_,
url_request_context_getter_,
user_share.sync_credentials.email,
user_share.sync_credentials.scope_set,
- token_service_provider.Pass());
+ token_service_provider);
}
scoped_ptr<syncer::AttachmentService> attachment_service(
« no previous file with comments | « no previous file | google_apis/gaia/oauth2_token_service_request.h » ('j') | google_apis/gaia/oauth2_token_service_request.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698