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

Side by Side Diff: chrome/browser/sync_file_system/local/canned_syncable_file_system.cc

Issue 506793002: Remove implicit conversions from scoped_refptr to T* in chrome/browser/sync_file_system/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" 5 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 void CannedSyncableFileSystem::SetUp(QuotaMode quota_mode) { 228 void CannedSyncableFileSystem::SetUp(QuotaMode quota_mode) {
229 ASSERT_FALSE(is_filesystem_set_up_); 229 ASSERT_FALSE(is_filesystem_set_up_);
230 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); 230 ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
231 231
232 scoped_refptr<storage::SpecialStoragePolicy> storage_policy = 232 scoped_refptr<storage::SpecialStoragePolicy> storage_policy =
233 new content::MockSpecialStoragePolicy(); 233 new content::MockSpecialStoragePolicy();
234 234
235 if (quota_mode == QUOTA_ENABLED) { 235 if (quota_mode == QUOTA_ENABLED) {
236 quota_manager_ = new QuotaManager(false /* is_incognito */, 236 quota_manager_ = new QuotaManager(false /* is_incognito */,
237 data_dir_.path(), 237 data_dir_.path(),
238 io_task_runner_, 238 io_task_runner_.get(),
239 base::ThreadTaskRunnerHandle::Get().get(), 239 base::ThreadTaskRunnerHandle::Get().get(),
240 storage_policy.get()); 240 storage_policy.get());
241 } 241 }
242 242
243 std::vector<std::string> additional_allowed_schemes; 243 std::vector<std::string> additional_allowed_schemes;
244 additional_allowed_schemes.push_back(origin_.scheme()); 244 additional_allowed_schemes.push_back(origin_.scheme());
245 storage::FileSystemOptions options( 245 storage::FileSystemOptions options(
246 storage::FileSystemOptions::PROFILE_MODE_NORMAL, 246 storage::FileSystemOptions::PROFILE_MODE_NORMAL,
247 additional_allowed_schemes, 247 additional_allowed_schemes,
248 env_override_); 248 env_override_);
249 249
250 ScopedVector<storage::FileSystemBackend> additional_backends; 250 ScopedVector<storage::FileSystemBackend> additional_backends;
251 additional_backends.push_back(SyncFileSystemBackend::CreateForTesting()); 251 additional_backends.push_back(SyncFileSystemBackend::CreateForTesting());
252 252
253 file_system_context_ = new FileSystemContext( 253 file_system_context_ = new FileSystemContext(
254 io_task_runner_, 254 io_task_runner_.get(),
255 file_task_runner_, 255 file_task_runner_.get(),
256 storage::ExternalMountPoints::CreateRefCounted().get(), 256 storage::ExternalMountPoints::CreateRefCounted().get(),
257 storage_policy.get(), 257 storage_policy.get(),
258 quota_manager_ ? quota_manager_->proxy() : NULL, 258 quota_manager_.get() ? quota_manager_->proxy() : NULL,
259 additional_backends.Pass(), 259 additional_backends.Pass(),
260 std::vector<storage::URLRequestAutoMountHandler>(), 260 std::vector<storage::URLRequestAutoMountHandler>(),
261 data_dir_.path(), 261 data_dir_.path(),
262 options); 262 options);
263 263
264 is_filesystem_set_up_ = true; 264 is_filesystem_set_up_ = true;
265 } 265 }
266 266
267 void CannedSyncableFileSystem::TearDown() { 267 void CannedSyncableFileSystem::TearDown() {
268 quota_manager_ = NULL; 268 quota_manager_ = NULL;
269 file_system_context_ = NULL; 269 file_system_context_ = NULL;
270 270
271 // Make sure we give some more time to finish tasks on other threads. 271 // Make sure we give some more time to finish tasks on other threads.
272 EnsureLastTaskRuns(io_task_runner_); 272 EnsureLastTaskRuns(io_task_runner_.get());
273 EnsureLastTaskRuns(file_task_runner_); 273 EnsureLastTaskRuns(file_task_runner_.get());
274 } 274 }
275 275
276 FileSystemURL CannedSyncableFileSystem::URL(const std::string& path) const { 276 FileSystemURL CannedSyncableFileSystem::URL(const std::string& path) const {
277 EXPECT_TRUE(is_filesystem_set_up_); 277 EXPECT_TRUE(is_filesystem_set_up_);
278 EXPECT_FALSE(root_url_.is_empty()); 278 EXPECT_FALSE(root_url_.is_empty());
279 279
280 GURL url(root_url_.spec() + path); 280 GURL url(root_url_.spec() + path);
281 return file_system_context_->CrackURL(url); 281 return file_system_context_->CrackURL(url);
282 } 282 }
283 283
284 File::Error CannedSyncableFileSystem::OpenFileSystem() { 284 File::Error CannedSyncableFileSystem::OpenFileSystem() {
285 EXPECT_TRUE(is_filesystem_set_up_); 285 EXPECT_TRUE(is_filesystem_set_up_);
286 286
287 base::RunLoop run_loop; 287 base::RunLoop run_loop;
288 io_task_runner_->PostTask( 288 io_task_runner_->PostTask(
289 FROM_HERE, 289 FROM_HERE,
290 base::Bind(&CannedSyncableFileSystem::DoOpenFileSystem, 290 base::Bind(&CannedSyncableFileSystem::DoOpenFileSystem,
291 base::Unretained(this), 291 base::Unretained(this),
292 base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem, 292 base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem,
293 base::Unretained(this), 293 base::Unretained(this),
294 base::ThreadTaskRunnerHandle::Get(), 294 base::ThreadTaskRunnerHandle::Get(),
295 run_loop.QuitClosure()))); 295 run_loop.QuitClosure())));
296 run_loop.Run(); 296 run_loop.Run();
297 297
298 if (backend()->sync_context()) { 298 if (backend()->sync_context()) {
299 // Register 'this' as a sync status observer. 299 // Register 'this' as a sync status observer.
300 RunOnThread( 300 RunOnThread(
301 io_task_runner_, 301 io_task_runner_.get(),
302 FROM_HERE, 302 FROM_HERE,
303 base::Bind(&CannedSyncableFileSystem::InitializeSyncStatusObserver, 303 base::Bind(&CannedSyncableFileSystem::InitializeSyncStatusObserver,
304 base::Unretained(this))); 304 base::Unretained(this)));
305 } 305 }
306 return result_; 306 return result_;
307 } 307 }
308 308
309 void CannedSyncableFileSystem::AddSyncStatusObserver( 309 void CannedSyncableFileSystem::AddSyncStatusObserver(
310 LocalFileSyncStatus::Observer* observer) { 310 LocalFileSyncStatus::Observer* observer) {
311 sync_status_observers_->AddObserver(observer); 311 sync_status_observers_->AddObserver(observer);
312 } 312 }
313 313
314 void CannedSyncableFileSystem::RemoveSyncStatusObserver( 314 void CannedSyncableFileSystem::RemoveSyncStatusObserver(
315 LocalFileSyncStatus::Observer* observer) { 315 LocalFileSyncStatus::Observer* observer) {
316 sync_status_observers_->RemoveObserver(observer); 316 sync_status_observers_->RemoveObserver(observer);
317 } 317 }
318 318
319 SyncStatusCode CannedSyncableFileSystem::MaybeInitializeFileSystemContext( 319 SyncStatusCode CannedSyncableFileSystem::MaybeInitializeFileSystemContext(
320 LocalFileSyncContext* sync_context) { 320 LocalFileSyncContext* sync_context) {
321 DCHECK(sync_context); 321 DCHECK(sync_context);
322 base::RunLoop run_loop; 322 base::RunLoop run_loop;
323 sync_status_ = sync_file_system::SYNC_STATUS_UNKNOWN; 323 sync_status_ = sync_file_system::SYNC_STATUS_UNKNOWN;
324 VerifySameTaskRunner(io_task_runner_, 324 VerifySameTaskRunner(io_task_runner_.get(),
325 sync_context->io_task_runner_); 325 sync_context->io_task_runner_.get());
326 sync_context->MaybeInitializeFileSystemContext( 326 sync_context->MaybeInitializeFileSystemContext(
327 origin_, 327 origin_,
328 file_system_context_.get(), 328 file_system_context_.get(),
329 base::Bind(&CannedSyncableFileSystem::DidInitializeFileSystemContext, 329 base::Bind(&CannedSyncableFileSystem::DidInitializeFileSystemContext,
330 base::Unretained(this), 330 base::Unretained(this),
331 run_loop.QuitClosure())); 331 run_loop.QuitClosure()));
332 run_loop.Run(); 332 run_loop.Run();
333 return sync_status_; 333 return sync_status_;
334 } 334 }
335 335
336 File::Error CannedSyncableFileSystem::CreateDirectory( 336 File::Error CannedSyncableFileSystem::CreateDirectory(
337 const FileSystemURL& url) { 337 const FileSystemURL& url) {
338 return RunOnThread<File::Error>( 338 return RunOnThread<File::Error>(
339 io_task_runner_, 339 io_task_runner_.get(),
340 FROM_HERE, 340 FROM_HERE,
341 base::Bind(&CannedSyncableFileSystem::DoCreateDirectory, 341 base::Bind(&CannedSyncableFileSystem::DoCreateDirectory,
342 base::Unretained(this), 342 base::Unretained(this),
343 url)); 343 url));
344 } 344 }
345 345
346 File::Error CannedSyncableFileSystem::CreateFile(const FileSystemURL& url) { 346 File::Error CannedSyncableFileSystem::CreateFile(const FileSystemURL& url) {
347 return RunOnThread<File::Error>( 347 return RunOnThread<File::Error>(
348 io_task_runner_, 348 io_task_runner_.get(),
349 FROM_HERE, 349 FROM_HERE,
350 base::Bind(&CannedSyncableFileSystem::DoCreateFile, 350 base::Bind(&CannedSyncableFileSystem::DoCreateFile,
351 base::Unretained(this), 351 base::Unretained(this),
352 url)); 352 url));
353 } 353 }
354 354
355 File::Error CannedSyncableFileSystem::Copy( 355 File::Error CannedSyncableFileSystem::Copy(
356 const FileSystemURL& src_url, const FileSystemURL& dest_url) { 356 const FileSystemURL& src_url, const FileSystemURL& dest_url) {
357 return RunOnThread<File::Error>( 357 return RunOnThread<File::Error>(io_task_runner_.get(),
358 io_task_runner_, 358 FROM_HERE,
359 FROM_HERE, 359 base::Bind(&CannedSyncableFileSystem::DoCopy,
360 base::Bind(&CannedSyncableFileSystem::DoCopy, 360 base::Unretained(this),
361 base::Unretained(this), 361 src_url,
362 src_url, 362 dest_url));
363 dest_url));
364 } 363 }
365 364
366 File::Error CannedSyncableFileSystem::Move( 365 File::Error CannedSyncableFileSystem::Move(
367 const FileSystemURL& src_url, const FileSystemURL& dest_url) { 366 const FileSystemURL& src_url, const FileSystemURL& dest_url) {
368 return RunOnThread<File::Error>( 367 return RunOnThread<File::Error>(io_task_runner_.get(),
369 io_task_runner_, 368 FROM_HERE,
370 FROM_HERE, 369 base::Bind(&CannedSyncableFileSystem::DoMove,
371 base::Bind(&CannedSyncableFileSystem::DoMove, 370 base::Unretained(this),
372 base::Unretained(this), 371 src_url,
373 src_url, 372 dest_url));
374 dest_url));
375 } 373 }
376 374
377 File::Error CannedSyncableFileSystem::TruncateFile( 375 File::Error CannedSyncableFileSystem::TruncateFile(
378 const FileSystemURL& url, int64 size) { 376 const FileSystemURL& url, int64 size) {
379 return RunOnThread<File::Error>( 377 return RunOnThread<File::Error>(
380 io_task_runner_, 378 io_task_runner_.get(),
381 FROM_HERE, 379 FROM_HERE,
382 base::Bind(&CannedSyncableFileSystem::DoTruncateFile, 380 base::Bind(&CannedSyncableFileSystem::DoTruncateFile,
383 base::Unretained(this), 381 base::Unretained(this),
384 url, 382 url,
385 size)); 383 size));
386 } 384 }
387 385
388 File::Error CannedSyncableFileSystem::TouchFile( 386 File::Error CannedSyncableFileSystem::TouchFile(
389 const FileSystemURL& url, 387 const FileSystemURL& url,
390 const base::Time& last_access_time, 388 const base::Time& last_access_time,
391 const base::Time& last_modified_time) { 389 const base::Time& last_modified_time) {
392 return RunOnThread<File::Error>( 390 return RunOnThread<File::Error>(
393 io_task_runner_, 391 io_task_runner_.get(),
394 FROM_HERE, 392 FROM_HERE,
395 base::Bind(&CannedSyncableFileSystem::DoTouchFile, 393 base::Bind(&CannedSyncableFileSystem::DoTouchFile,
396 base::Unretained(this), 394 base::Unretained(this),
397 url, 395 url,
398 last_access_time, 396 last_access_time,
399 last_modified_time)); 397 last_modified_time));
400 } 398 }
401 399
402 File::Error CannedSyncableFileSystem::Remove( 400 File::Error CannedSyncableFileSystem::Remove(
403 const FileSystemURL& url, bool recursive) { 401 const FileSystemURL& url, bool recursive) {
404 return RunOnThread<File::Error>( 402 return RunOnThread<File::Error>(
405 io_task_runner_, 403 io_task_runner_.get(),
406 FROM_HERE, 404 FROM_HERE,
407 base::Bind(&CannedSyncableFileSystem::DoRemove, 405 base::Bind(&CannedSyncableFileSystem::DoRemove,
408 base::Unretained(this), 406 base::Unretained(this),
409 url, 407 url,
410 recursive)); 408 recursive));
411 } 409 }
412 410
413 File::Error CannedSyncableFileSystem::FileExists( 411 File::Error CannedSyncableFileSystem::FileExists(
414 const FileSystemURL& url) { 412 const FileSystemURL& url) {
415 return RunOnThread<File::Error>( 413 return RunOnThread<File::Error>(
416 io_task_runner_, 414 io_task_runner_.get(),
417 FROM_HERE, 415 FROM_HERE,
418 base::Bind(&CannedSyncableFileSystem::DoFileExists, 416 base::Bind(&CannedSyncableFileSystem::DoFileExists,
419 base::Unretained(this), 417 base::Unretained(this),
420 url)); 418 url));
421 } 419 }
422 420
423 File::Error CannedSyncableFileSystem::DirectoryExists( 421 File::Error CannedSyncableFileSystem::DirectoryExists(
424 const FileSystemURL& url) { 422 const FileSystemURL& url) {
425 return RunOnThread<File::Error>( 423 return RunOnThread<File::Error>(
426 io_task_runner_, 424 io_task_runner_.get(),
427 FROM_HERE, 425 FROM_HERE,
428 base::Bind(&CannedSyncableFileSystem::DoDirectoryExists, 426 base::Bind(&CannedSyncableFileSystem::DoDirectoryExists,
429 base::Unretained(this), 427 base::Unretained(this),
430 url)); 428 url));
431 } 429 }
432 430
433 File::Error CannedSyncableFileSystem::VerifyFile( 431 File::Error CannedSyncableFileSystem::VerifyFile(
434 const FileSystemURL& url, 432 const FileSystemURL& url,
435 const std::string& expected_data) { 433 const std::string& expected_data) {
436 return RunOnThread<File::Error>( 434 return RunOnThread<File::Error>(
437 io_task_runner_, 435 io_task_runner_.get(),
438 FROM_HERE, 436 FROM_HERE,
439 base::Bind(&CannedSyncableFileSystem::DoVerifyFile, 437 base::Bind(&CannedSyncableFileSystem::DoVerifyFile,
440 base::Unretained(this), 438 base::Unretained(this),
441 url, 439 url,
442 expected_data)); 440 expected_data));
443 } 441 }
444 442
445 File::Error CannedSyncableFileSystem::GetMetadataAndPlatformPath( 443 File::Error CannedSyncableFileSystem::GetMetadataAndPlatformPath(
446 const FileSystemURL& url, 444 const FileSystemURL& url,
447 base::File::Info* info, 445 base::File::Info* info,
448 base::FilePath* platform_path) { 446 base::FilePath* platform_path) {
449 return RunOnThread<File::Error>( 447 return RunOnThread<File::Error>(
450 io_task_runner_, 448 io_task_runner_.get(),
451 FROM_HERE, 449 FROM_HERE,
452 base::Bind(&CannedSyncableFileSystem::DoGetMetadataAndPlatformPath, 450 base::Bind(&CannedSyncableFileSystem::DoGetMetadataAndPlatformPath,
453 base::Unretained(this), 451 base::Unretained(this),
454 url, 452 url,
455 info, 453 info,
456 platform_path)); 454 platform_path));
457 } 455 }
458 456
459 File::Error CannedSyncableFileSystem::ReadDirectory( 457 File::Error CannedSyncableFileSystem::ReadDirectory(
460 const storage::FileSystemURL& url, 458 const storage::FileSystemURL& url,
461 FileEntryList* entries) { 459 FileEntryList* entries) {
462 return RunOnThread<File::Error>( 460 return RunOnThread<File::Error>(
463 io_task_runner_, 461 io_task_runner_.get(),
464 FROM_HERE, 462 FROM_HERE,
465 base::Bind(&CannedSyncableFileSystem::DoReadDirectory, 463 base::Bind(&CannedSyncableFileSystem::DoReadDirectory,
466 base::Unretained(this), 464 base::Unretained(this),
467 url, 465 url,
468 entries)); 466 entries));
469 } 467 }
470 468
471 int64 CannedSyncableFileSystem::Write( 469 int64 CannedSyncableFileSystem::Write(
472 net::URLRequestContext* url_request_context, 470 net::URLRequestContext* url_request_context,
473 const FileSystemURL& url, 471 const FileSystemURL& url,
474 scoped_ptr<storage::BlobDataHandle> blob_data_handle) { 472 scoped_ptr<storage::BlobDataHandle> blob_data_handle) {
475 return RunOnThread<int64>(io_task_runner_, 473 return RunOnThread<int64>(io_task_runner_.get(),
476 FROM_HERE, 474 FROM_HERE,
477 base::Bind(&CannedSyncableFileSystem::DoWrite, 475 base::Bind(&CannedSyncableFileSystem::DoWrite,
478 base::Unretained(this), 476 base::Unretained(this),
479 url_request_context, 477 url_request_context,
480 url, 478 url,
481 base::Passed(&blob_data_handle))); 479 base::Passed(&blob_data_handle)));
482 } 480 }
483 481
484 int64 CannedSyncableFileSystem::WriteString( 482 int64 CannedSyncableFileSystem::WriteString(
485 const FileSystemURL& url, const std::string& data) { 483 const FileSystemURL& url, const std::string& data) {
486 return RunOnThread<int64>(io_task_runner_, 484 return RunOnThread<int64>(io_task_runner_.get(),
487 FROM_HERE, 485 FROM_HERE,
488 base::Bind(&CannedSyncableFileSystem::DoWriteString, 486 base::Bind(&CannedSyncableFileSystem::DoWriteString,
489 base::Unretained(this), 487 base::Unretained(this),
490 url, 488 url,
491 data)); 489 data));
492 } 490 }
493 491
494 File::Error CannedSyncableFileSystem::DeleteFileSystem() { 492 File::Error CannedSyncableFileSystem::DeleteFileSystem() {
495 EXPECT_TRUE(is_filesystem_set_up_); 493 EXPECT_TRUE(is_filesystem_set_up_);
496 return RunOnThread<File::Error>( 494 return RunOnThread<File::Error>(
497 io_task_runner_, 495 io_task_runner_.get(),
498 FROM_HERE, 496 FROM_HERE,
499 base::Bind(&FileSystemContext::DeleteFileSystem, 497 base::Bind(&FileSystemContext::DeleteFileSystem,
500 file_system_context_, 498 file_system_context_,
501 origin_, 499 origin_,
502 type_)); 500 type_));
503 } 501 }
504 502
505 storage::QuotaStatusCode CannedSyncableFileSystem::GetUsageAndQuota( 503 storage::QuotaStatusCode CannedSyncableFileSystem::GetUsageAndQuota(
506 int64* usage, 504 int64* usage,
507 int64* quota) { 505 int64* quota) {
508 return RunOnThread<storage::QuotaStatusCode>( 506 return RunOnThread<storage::QuotaStatusCode>(
509 io_task_runner_, 507 io_task_runner_.get(),
510 FROM_HERE, 508 FROM_HERE,
511 base::Bind(&CannedSyncableFileSystem::DoGetUsageAndQuota, 509 base::Bind(&CannedSyncableFileSystem::DoGetUsageAndQuota,
512 base::Unretained(this), 510 base::Unretained(this),
513 usage, 511 usage,
514 quota)); 512 quota));
515 } 513 }
516 514
517 void CannedSyncableFileSystem::GetChangedURLsInTracker( 515 void CannedSyncableFileSystem::GetChangedURLsInTracker(
518 FileSystemURLSet* urls) { 516 FileSystemURLSet* urls) {
519 RunOnThread( 517 RunOnThread(file_task_runner_.get(),
520 file_task_runner_, 518 FROM_HERE,
521 FROM_HERE, 519 base::Bind(&LocalFileChangeTracker::GetAllChangedURLs,
522 base::Bind(&LocalFileChangeTracker::GetAllChangedURLs, 520 base::Unretained(backend()->change_tracker()),
523 base::Unretained(backend()->change_tracker()), 521 urls));
524 urls));
525 } 522 }
526 523
527 void CannedSyncableFileSystem::ClearChangeForURLInTracker( 524 void CannedSyncableFileSystem::ClearChangeForURLInTracker(
528 const FileSystemURL& url) { 525 const FileSystemURL& url) {
529 RunOnThread( 526 RunOnThread(file_task_runner_.get(),
530 file_task_runner_, 527 FROM_HERE,
531 FROM_HERE, 528 base::Bind(&LocalFileChangeTracker::ClearChangesForURL,
532 base::Bind(&LocalFileChangeTracker::ClearChangesForURL, 529 base::Unretained(backend()->change_tracker()),
533 base::Unretained(backend()->change_tracker()), 530 url));
534 url));
535 } 531 }
536 532
537 void CannedSyncableFileSystem::GetChangesForURLInTracker( 533 void CannedSyncableFileSystem::GetChangesForURLInTracker(
538 const FileSystemURL& url, 534 const FileSystemURL& url,
539 FileChangeList* changes) { 535 FileChangeList* changes) {
540 RunOnThread( 536 RunOnThread(file_task_runner_.get(),
541 file_task_runner_, 537 FROM_HERE,
542 FROM_HERE, 538 base::Bind(&LocalFileChangeTracker::GetChangesForURL,
543 base::Bind(&LocalFileChangeTracker::GetChangesForURL, 539 base::Unretained(backend()->change_tracker()),
544 base::Unretained(backend()->change_tracker()), 540 url,
545 url, changes)); 541 changes));
546 } 542 }
547 543
548 SyncFileSystemBackend* CannedSyncableFileSystem::backend() { 544 SyncFileSystemBackend* CannedSyncableFileSystem::backend() {
549 return SyncFileSystemBackend::GetBackend(file_system_context_); 545 return SyncFileSystemBackend::GetBackend(file_system_context_.get());
550 } 546 }
551 547
552 FileSystemOperationRunner* CannedSyncableFileSystem::operation_runner() { 548 FileSystemOperationRunner* CannedSyncableFileSystem::operation_runner() {
553 return file_system_context_->operation_runner(); 549 return file_system_context_->operation_runner();
554 } 550 }
555 551
556 void CannedSyncableFileSystem::OnSyncEnabled(const FileSystemURL& url) { 552 void CannedSyncableFileSystem::OnSyncEnabled(const FileSystemURL& url) {
557 sync_status_observers_->Notify(&LocalFileSyncStatus::Observer::OnSyncEnabled, 553 sync_status_observers_->Notify(&LocalFileSyncStatus::Observer::OnSyncEnabled,
558 url); 554 url);
559 } 555 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 base::Bind(&WriteHelper::DidWrite, 712 base::Bind(&WriteHelper::DidWrite,
717 base::Owned(helper), callback)); 713 base::Owned(helper), callback));
718 } 714 }
719 715
720 void CannedSyncableFileSystem::DoGetUsageAndQuota( 716 void CannedSyncableFileSystem::DoGetUsageAndQuota(
721 int64* usage, 717 int64* usage,
722 int64* quota, 718 int64* quota,
723 const storage::StatusCallback& callback) { 719 const storage::StatusCallback& callback) {
724 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); 720 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
725 EXPECT_TRUE(is_filesystem_opened_); 721 EXPECT_TRUE(is_filesystem_opened_);
726 DCHECK(quota_manager_); 722 DCHECK(quota_manager_.get());
727 quota_manager_->GetUsageAndQuota( 723 quota_manager_->GetUsageAndQuota(
728 origin_, storage_type(), 724 origin_, storage_type(),
729 base::Bind(&DidGetUsageAndQuota, callback, usage, quota)); 725 base::Bind(&DidGetUsageAndQuota, callback, usage, quota));
730 } 726 }
731 727
732 void CannedSyncableFileSystem::DidOpenFileSystem( 728 void CannedSyncableFileSystem::DidOpenFileSystem(
733 base::SingleThreadTaskRunner* original_task_runner, 729 base::SingleThreadTaskRunner* original_task_runner,
734 const base::Closure& quit_closure, 730 const base::Closure& quit_closure,
735 const GURL& root, 731 const GURL& root,
736 const std::string& name, 732 const std::string& name,
(...skipping 24 matching lines...) Expand all
761 sync_status_ = status; 757 sync_status_ = status;
762 quit_closure.Run(); 758 quit_closure.Run();
763 } 759 }
764 760
765 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { 761 void CannedSyncableFileSystem::InitializeSyncStatusObserver() {
766 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); 762 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
767 backend()->sync_context()->sync_status()->AddObserver(this); 763 backend()->sync_context()->sync_status()->AddObserver(this);
768 } 764 }
769 765
770 } // namespace sync_file_system 766 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698