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

Side by Side Diff: webkit/browser/fileapi/syncable/canned_syncable_file_system.cc

Issue 16109008: Cleanup: Deprecate DriveFileSyncService::kServiceName (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "webkit/browser/fileapi/syncable/canned_syncable_file_system.h" 5 #include "webkit/browser/fileapi/syncable/canned_syncable_file_system.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 "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 void EnsureLastTaskRuns(base::SingleThreadTaskRunner* runner) { 170 void EnsureLastTaskRuns(base::SingleThreadTaskRunner* runner) {
171 base::RunLoop run_loop; 171 base::RunLoop run_loop;
172 runner->PostTaskAndReply( 172 runner->PostTaskAndReply(
173 FROM_HERE, base::Bind(&base::DoNothing), run_loop.QuitClosure()); 173 FROM_HERE, base::Bind(&base::DoNothing), run_loop.QuitClosure());
174 run_loop.Run(); 174 run_loop.Run();
175 } 175 }
176 176
177 } // namespace 177 } // namespace
178 178
179 CannedSyncableFileSystem::CannedSyncableFileSystem( 179 CannedSyncableFileSystem::CannedSyncableFileSystem(
180 const GURL& origin, const std::string& service, 180 const GURL& origin,
181 base::SingleThreadTaskRunner* io_task_runner, 181 base::SingleThreadTaskRunner* io_task_runner,
182 base::SingleThreadTaskRunner* file_task_runner) 182 base::SingleThreadTaskRunner* file_task_runner)
183 : service_name_(service), 183 : origin_(origin),
184 origin_(origin),
185 type_(fileapi::kFileSystemTypeSyncable), 184 type_(fileapi::kFileSystemTypeSyncable),
186 result_(base::PLATFORM_FILE_OK), 185 result_(base::PLATFORM_FILE_OK),
187 sync_status_(sync_file_system::SYNC_STATUS_OK), 186 sync_status_(sync_file_system::SYNC_STATUS_OK),
188 io_task_runner_(io_task_runner), 187 io_task_runner_(io_task_runner),
189 file_task_runner_(file_task_runner), 188 file_task_runner_(file_task_runner),
190 is_filesystem_set_up_(false), 189 is_filesystem_set_up_(false),
191 is_filesystem_opened_(false), 190 is_filesystem_opened_(false),
192 sync_status_observers_(new ObserverList) { 191 sync_status_observers_(new ObserverList) {
193 } 192 }
194 193
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 EXPECT_TRUE(is_filesystem_opened_); 240 EXPECT_TRUE(is_filesystem_opened_);
242 241
243 GURL url(root_url_.spec() + path); 242 GURL url(root_url_.spec() + path);
244 return file_system_context_->CrackURL(url); 243 return file_system_context_->CrackURL(url);
245 } 244 }
246 245
247 PlatformFileError CannedSyncableFileSystem::OpenFileSystem() { 246 PlatformFileError CannedSyncableFileSystem::OpenFileSystem() {
248 EXPECT_TRUE(is_filesystem_set_up_); 247 EXPECT_TRUE(is_filesystem_set_up_);
249 EXPECT_FALSE(is_filesystem_opened_); 248 EXPECT_FALSE(is_filesystem_opened_);
250 file_system_context_->OpenSyncableFileSystem( 249 file_system_context_->OpenSyncableFileSystem(
251 service_name_, origin_, type_, 250 origin_, type_,
252 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, 251 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
253 base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem, 252 base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem,
254 base::Unretained(this))); 253 base::Unretained(this)));
255 base::MessageLoop::current()->Run(); 254 base::MessageLoop::current()->Run();
256 if (file_system_context_->sync_context()) { 255 if (file_system_context_->sync_context()) {
257 // Register 'this' as a sync status observer. 256 // Register 'this' as a sync status observer.
258 RunOnThread( 257 RunOnThread(
259 io_task_runner_.get(), 258 io_task_runner_.get(),
260 FROM_HERE, 259 FROM_HERE,
261 base::Bind(&CannedSyncableFileSystem::InitializeSyncStatusObserver, 260 base::Bind(&CannedSyncableFileSystem::InitializeSyncStatusObserver,
(...skipping 13 matching lines...) Expand all
275 } 274 }
276 275
277 SyncStatusCode CannedSyncableFileSystem::MaybeInitializeFileSystemContext( 276 SyncStatusCode CannedSyncableFileSystem::MaybeInitializeFileSystemContext(
278 LocalFileSyncContext* sync_context) { 277 LocalFileSyncContext* sync_context) {
279 DCHECK(sync_context); 278 DCHECK(sync_context);
280 sync_status_ = sync_file_system::SYNC_STATUS_UNKNOWN; 279 sync_status_ = sync_file_system::SYNC_STATUS_UNKNOWN;
281 VerifySameTaskRunner(io_task_runner_.get(), 280 VerifySameTaskRunner(io_task_runner_.get(),
282 sync_context->io_task_runner_.get()); 281 sync_context->io_task_runner_.get());
283 sync_context->MaybeInitializeFileSystemContext( 282 sync_context->MaybeInitializeFileSystemContext(
284 origin_, 283 origin_,
285 service_name_,
286 file_system_context_.get(), 284 file_system_context_.get(),
287 base::Bind(&CannedSyncableFileSystem::DidInitializeFileSystemContext, 285 base::Bind(&CannedSyncableFileSystem::DidInitializeFileSystemContext,
288 base::Unretained(this))); 286 base::Unretained(this)));
289 base::MessageLoop::current()->Run(); 287 base::MessageLoop::current()->Run();
290 return sync_status_; 288 return sync_status_;
291 } 289 }
292 290
293 PlatformFileError CannedSyncableFileSystem::CreateDirectory( 291 PlatformFileError CannedSyncableFileSystem::CreateDirectory(
294 const FileSystemURL& url) { 292 const FileSystemURL& url) {
295 return RunOnThread<PlatformFileError>( 293 return RunOnThread<PlatformFileError>(
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 sync_status_ = status; 624 sync_status_ = status;
627 base::MessageLoop::current()->Quit(); 625 base::MessageLoop::current()->Quit();
628 } 626 }
629 627
630 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { 628 void CannedSyncableFileSystem::InitializeSyncStatusObserver() {
631 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); 629 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
632 file_system_context_->sync_context()->sync_status()->AddObserver(this); 630 file_system_context_->sync_context()->sync_status()->AddObserver(this);
633 } 631 }
634 632
635 } // namespace sync_file_system 633 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698