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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_system_service.cc

Issue 10833020: Make blocking_task_runner_ a member variable instead of sequence_token_. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_system_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/gdata/gdata_system_service.h" 5 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h" 10 #include "chrome/browser/chromeos/gdata/drive_webapps_registry.h"
11 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h" 11 #include "chrome/browser/chromeos/gdata/gdata_documents_service.h"
12 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" 12 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h"
13 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" 13 #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
14 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h" 14 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h"
15 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h" 15 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h"
16 #include "chrome/browser/chromeos/gdata/gdata_uploader.h" 16 #include "chrome/browser/chromeos/gdata/gdata_uploader.h"
17 #include "chrome/browser/chromeos/gdata/gdata_util.h" 17 #include "chrome/browser/chromeos/gdata/gdata_util.h"
18 #include "chrome/browser/download/download_service.h" 18 #include "chrome/browser/download/download_service.h"
19 #include "chrome/browser/download/download_service_factory.h" 19 #include "chrome/browser/download/download_service_factory.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/profiles/profile_dependency_manager.h" 21 #include "chrome/browser/profiles/profile_dependency_manager.h"
22 #include "content/public/browser/browser_context.h" 22 #include "content/public/browser/browser_context.h"
23 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
24 #include "webkit/fileapi/file_system_context.h" 24 #include "webkit/fileapi/file_system_context.h"
25 #include "webkit/fileapi/file_system_mount_point_provider.h" 25 #include "webkit/fileapi/file_system_mount_point_provider.h"
26 26
27 using content::BrowserContext; 27 using content::BrowserContext;
28 using content::BrowserThread; 28 using content::BrowserThread;
29 29
30 namespace gdata {
30 namespace { 31 namespace {
31 32
32 // Used in test to setup system service. 33 // Used in test to setup system service.
33 gdata::DocumentsServiceInterface* g_test_documents_service = NULL; 34 DocumentsServiceInterface* g_test_documents_service = NULL;
34 const std::string* g_test_cache_root = NULL; 35 const std::string* g_test_cache_root = NULL;
35 36
36 scoped_refptr<base::SequencedTaskRunner> GetTaskRunner( 37 } // namespace
37 const base::SequencedWorkerPool::SequenceToken& sequence_token) {
38 return BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
39 sequence_token);
40 }
41 38
42 } // nemaspace
43
44 namespace gdata {
45
46 //===================== GDataSystemService ====================================
47 GDataSystemService::GDataSystemService(Profile* profile) 39 GDataSystemService::GDataSystemService(Profile* profile)
48 : profile_(profile), 40 : profile_(profile),
49 sequence_token_(BrowserThread::GetBlockingPool()->GetSequenceToken()),
50 cache_(NULL) { 41 cache_(NULL) {
51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
43 base::SequencedWorkerPool* blocking_pool = BrowserThread::GetBlockingPool();
44 blocking_task_runner_ = blocking_pool->GetSequencedTaskRunner(
45 blocking_pool->GetSequenceToken());
52 } 46 }
53 47
54 GDataSystemService::~GDataSystemService() { 48 GDataSystemService::~GDataSystemService() {
55 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
56 cache_->DestroyOnUIThread(); 50 cache_->DestroyOnUIThread();
57 } 51 }
58 52
59 void GDataSystemService::Initialize( 53 void GDataSystemService::Initialize(
60 DocumentsServiceInterface* documents_service, 54 DocumentsServiceInterface* documents_service,
61 const FilePath& cache_root) { 55 const FilePath& cache_root) {
62 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 56 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
63 57
64 documents_service_.reset(documents_service); 58 documents_service_.reset(documents_service);
65 cache_ = GDataCache::CreateGDataCacheOnUIThread( 59 cache_ = GDataCache::CreateGDataCacheOnUIThread(
66 cache_root, 60 cache_root,
67 GetTaskRunner(sequence_token_)); 61 blocking_task_runner_);
68 uploader_.reset(new GDataUploader(docs_service())); 62 uploader_.reset(new GDataUploader(docs_service()));
69 webapps_registry_.reset(new DriveWebAppsRegistry); 63 webapps_registry_.reset(new DriveWebAppsRegistry);
70 file_system_.reset(new GDataFileSystem(profile_, 64 file_system_.reset(new GDataFileSystem(profile_,
71 cache(), 65 cache(),
72 docs_service(), 66 docs_service(),
73 uploader(), 67 uploader(),
74 webapps_registry(), 68 webapps_registry(),
75 GetTaskRunner(sequence_token_))); 69 blocking_task_runner_));
76 download_observer_.reset(new GDataDownloadObserver(uploader(), 70 download_observer_.reset(new GDataDownloadObserver(uploader(),
77 file_system())); 71 file_system()));
78 sync_client_.reset(new GDataSyncClient(profile_, file_system(), cache())); 72 sync_client_.reset(new GDataSyncClient(profile_, file_system(), cache()));
79 73
80 sync_client_->Initialize(); 74 sync_client_->Initialize();
81 file_system_->Initialize(); 75 file_system_->Initialize();
82 cache_->RequestInitializeOnUIThread(); 76 cache_->RequestInitializeOnUIThread();
83 77
84 content::DownloadManager* download_manager = 78 content::DownloadManager* download_manager =
85 g_browser_process->download_status_updater() ? 79 g_browser_process->download_status_updater() ?
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 g_test_cache_root ? FilePath(*g_test_cache_root) : 180 g_test_cache_root ? FilePath(*g_test_cache_root) :
187 GDataCache::GetCacheRootPath(profile); 181 GDataCache::GetCacheRootPath(profile);
188 delete g_test_cache_root; 182 delete g_test_cache_root;
189 g_test_cache_root = NULL; 183 g_test_cache_root = NULL;
190 184
191 service->Initialize(documents_service, cache_root); 185 service->Initialize(documents_service, cache_root);
192 return service; 186 return service;
193 } 187 }
194 188
195 } // namespace gdata 189 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_system_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698