| OLD | NEW |
| 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 "google_apis/gaia/oauth2_token_service_request.h" | 5 #include "google_apis/gaia/oauth2_token_service_request.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 OAuth2TokenServiceRequest* owner(); | 70 OAuth2TokenServiceRequest* owner(); |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 friend class base::RefCountedThreadSafe<OAuth2TokenServiceRequest::Core>; | 73 friend class base::RefCountedThreadSafe<OAuth2TokenServiceRequest::Core>; |
| 74 | 74 |
| 75 void DoNothing(); | 75 void DoNothing(); |
| 76 | 76 |
| 77 scoped_refptr<base::SingleThreadTaskRunner> token_service_task_runner_; | 77 scoped_refptr<base::SingleThreadTaskRunner> token_service_task_runner_; |
| 78 OAuth2TokenServiceRequest* owner_; | 78 OAuth2TokenServiceRequest* owner_; |
| 79 | 79 |
| 80 // It is important that provider_ is destroyed on the owner thread, not the | 80 // Clear on owner thread. OAuth2TokenServiceRequest promises to clear its |
| 81 // token_service_task_runner_ thread. | 81 // last reference to TokenServiceProvider on the owner thread so the caller |
| 82 // can ensure it is destroyed on the owner thread if desired. |
| 82 scoped_refptr<TokenServiceProvider> provider_; | 83 scoped_refptr<TokenServiceProvider> provider_; |
| 83 | 84 |
| 84 DISALLOW_COPY_AND_ASSIGN(Core); | 85 DISALLOW_COPY_AND_ASSIGN(Core); |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 OAuth2TokenServiceRequest::Core::Core( | 88 OAuth2TokenServiceRequest::Core::Core( |
| 88 OAuth2TokenServiceRequest* owner, | 89 OAuth2TokenServiceRequest* owner, |
| 89 const scoped_refptr<TokenServiceProvider>& provider) | 90 const scoped_refptr<TokenServiceProvider>& provider) |
| 90 : owner_(owner), provider_(provider) { | 91 : owner_(owner), provider_(provider) { |
| 91 DCHECK(owner_); | 92 DCHECK(owner_); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 const std::string& account_id) | 362 const std::string& account_id) |
| 362 : account_id_(account_id) { | 363 : account_id_(account_id) { |
| 363 DCHECK(!account_id_.empty()); | 364 DCHECK(!account_id_.empty()); |
| 364 } | 365 } |
| 365 | 366 |
| 366 void OAuth2TokenServiceRequest::StartWithCore(const scoped_refptr<Core>& core) { | 367 void OAuth2TokenServiceRequest::StartWithCore(const scoped_refptr<Core>& core) { |
| 367 DCHECK(core); | 368 DCHECK(core); |
| 368 core_ = core; | 369 core_ = core; |
| 369 core_->Start(); | 370 core_->Start(); |
| 370 } | 371 } |
| OLD | NEW |