| 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 "chrome/browser/sync_file_system/drive_backend/sync_engine_context.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/sync_engine_context.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.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/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "chrome/browser/drive/drive_service_interface.h" | 12 #include "chrome/browser/drive/drive_service_interface.h" |
| 13 #include "chrome/browser/drive/drive_uploader.h" | 13 #include "chrome/browser/drive/drive_uploader.h" |
| 14 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" | 14 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" |
| 15 #include "chrome/browser/sync_file_system/remote_change_processor.h" | 15 #include "chrome/browser/sync_file_system/remote_change_processor.h" |
| 16 #include "chrome/browser/sync_file_system/task_logger.h" | 16 #include "chrome/browser/sync_file_system/task_logger.h" |
| 17 | 17 |
| 18 namespace sync_file_system { | 18 namespace sync_file_system { |
| 19 namespace drive_backend { | 19 namespace drive_backend { |
| 20 | 20 |
| 21 SyncEngineContext::SyncEngineContext( | 21 SyncEngineContext::SyncEngineContext( |
| 22 scoped_ptr<drive::DriveServiceInterface> drive_service, | 22 scoped_ptr<drive::DriveServiceInterface> drive_service, |
| 23 scoped_ptr<drive::DriveUploaderInterface> drive_uploader, | 23 scoped_ptr<drive::DriveUploaderInterface> drive_uploader, |
| 24 TaskLogger* task_logger, | 24 TaskLogger* task_logger, |
| 25 base::SingleThreadTaskRunner* ui_task_runner, | 25 const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner, |
| 26 base::SequencedTaskRunner* worker_task_runner) | 26 const scoped_refptr<base::SequencedTaskRunner>& worker_task_runner) |
| 27 : drive_service_(drive_service.Pass()), | 27 : drive_service_(drive_service.Pass()), |
| 28 drive_uploader_(drive_uploader.Pass()), | 28 drive_uploader_(drive_uploader.Pass()), |
| 29 task_logger_(task_logger | 29 task_logger_(task_logger ? task_logger->AsWeakPtr() |
| 30 ? task_logger->AsWeakPtr() | 30 : base::WeakPtr<TaskLogger>()), |
| 31 : base::WeakPtr<TaskLogger>()), | |
| 32 remote_change_processor_(NULL), | 31 remote_change_processor_(NULL), |
| 33 ui_task_runner_(ui_task_runner), | 32 ui_task_runner_(ui_task_runner), |
| 34 worker_task_runner_(worker_task_runner) { | 33 worker_task_runner_(worker_task_runner) { |
| 35 sequence_checker_.DetachFromSequence(); | 34 sequence_checker_.DetachFromSequence(); |
| 36 } | 35 } |
| 37 | 36 |
| 38 SyncEngineContext::~SyncEngineContext() { | 37 SyncEngineContext::~SyncEngineContext() { |
| 39 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 38 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
| 40 } | 39 } |
| 41 | 40 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 DCHECK(remote_change_processor); | 91 DCHECK(remote_change_processor); |
| 93 remote_change_processor_ = remote_change_processor; | 92 remote_change_processor_ = remote_change_processor; |
| 94 } | 93 } |
| 95 | 94 |
| 96 void SyncEngineContext::DetachFromSequence() { | 95 void SyncEngineContext::DetachFromSequence() { |
| 97 sequence_checker_.DetachFromSequence(); | 96 sequence_checker_.DetachFromSequence(); |
| 98 } | 97 } |
| 99 | 98 |
| 100 } // namespace drive_backend | 99 } // namespace drive_backend |
| 101 } // namespace sync_file_system | 100 } // namespace sync_file_system |
| OLD | NEW |