OLD | NEW |
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/drive/change_list_loader.h" | 5 #include "chrome/browser/chromeos/drive/change_list_loader.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 // Register the callback function to be called when it is loaded. | 370 // Register the callback function to be called when it is loaded. |
371 pending_load_callback_.push_back(callback); | 371 pending_load_callback_.push_back(callback); |
372 | 372 |
373 // If loading task is already running, do nothing. | 373 // If loading task is already running, do nothing. |
374 if (pending_load_callback_.size() > 1) | 374 if (pending_load_callback_.size() > 1) |
375 return; | 375 return; |
376 | 376 |
377 // Check the current status of local metadata, and start loading if needed. | 377 // Check the current status of local metadata, and start loading if needed. |
378 int64* local_changestamp = new int64(0); | 378 int64* local_changestamp = new int64(0); |
379 base::PostTaskAndReplyWithResult( | 379 base::PostTaskAndReplyWithResult( |
380 blocking_task_runner_, | 380 blocking_task_runner_.get(), |
381 FROM_HERE, | 381 FROM_HERE, |
382 base::Bind(&ResourceMetadata::GetLargestChangestamp, | 382 base::Bind(&ResourceMetadata::GetLargestChangestamp, |
383 base::Unretained(resource_metadata_), | 383 base::Unretained(resource_metadata_), |
384 local_changestamp), | 384 local_changestamp), |
385 base::Bind(&ChangeListLoader::LoadAfterGetLargestChangestamp, | 385 base::Bind(&ChangeListLoader::LoadAfterGetLargestChangestamp, |
386 weak_ptr_factory_.GetWeakPtr(), | 386 weak_ptr_factory_.GetWeakPtr(), |
387 is_initial_load, | 387 is_initial_load, |
388 base::Owned(local_changestamp))); | 388 base::Owned(local_changestamp))); |
389 } | 389 } |
390 | 390 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 | 573 |
574 OnChangeListLoadComplete(error); | 574 OnChangeListLoadComplete(error); |
575 | 575 |
576 FOR_EACH_OBSERVER(ChangeListLoaderObserver, | 576 FOR_EACH_OBSERVER(ChangeListLoaderObserver, |
577 observers_, | 577 observers_, |
578 OnLoadFromServerComplete()); | 578 OnLoadFromServerComplete()); |
579 } | 579 } |
580 | 580 |
581 } // namespace internal | 581 } // namespace internal |
582 } // namespace drive | 582 } // namespace drive |
OLD | NEW |