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 "components/drive/chromeos/directory_loader.h" | 5 #include "components/drive/chromeos/directory_loader.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 386 |
387 int64_t remote_changestamp = about_resource->largest_change_id(); | 387 int64_t remote_changestamp = about_resource->largest_change_id(); |
388 | 388 |
389 // Start loading the directory. | 389 // Start loading the directory. |
390 int64_t directory_changestamp = std::max( | 390 int64_t directory_changestamp = std::max( |
391 entry->directory_specific_info().changestamp(), *local_changestamp); | 391 entry->directory_specific_info().changestamp(), *local_changestamp); |
392 | 392 |
393 DirectoryFetchInfo directory_fetch_info( | 393 DirectoryFetchInfo directory_fetch_info( |
394 local_id, entry->resource_id(), remote_changestamp); | 394 local_id, entry->resource_id(), remote_changestamp); |
395 | 395 |
396 // If the directory's changestamp is up-to-date or the global changestamp of | 396 // If the directory's changestamp is up to date or the global changestamp of |
397 // the metadata DB is new enough (which means the normal changelist loading | 397 // the metadata DB is new enough (which means the normal changelist loading |
398 // should finish very soon), just schedule to run the callback, as there is no | 398 // should finish very soon), just schedule to run the callback, as there is no |
399 // need to fetch the directory. | 399 // need to fetch the directory. |
400 if (directory_changestamp >= remote_changestamp || | 400 if (directory_changestamp >= remote_changestamp || |
401 *local_changestamp + kMinimumChangestampGap > remote_changestamp) { | 401 *local_changestamp + kMinimumChangestampGap > remote_changestamp) { |
402 OnDirectoryLoadComplete(local_id, FILE_ERROR_OK); | 402 OnDirectoryLoadComplete(local_id, FILE_ERROR_OK); |
403 } else { | 403 } else { |
404 // Start fetching the directory content, and mark it with the changestamp | 404 // Start fetching the directory content, and mark it with the changestamp |
405 // |remote_changestamp|. | 405 // |remote_changestamp|. |
406 LoadDirectoryFromServer(directory_fetch_info); | 406 LoadDirectoryFromServer(directory_fetch_info); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 // Also notify the observers. | 562 // Also notify the observers. |
563 if (error == FILE_ERROR_OK && !directory_path->empty()) { | 563 if (error == FILE_ERROR_OK && !directory_path->empty()) { |
564 FOR_EACH_OBSERVER(ChangeListLoaderObserver, | 564 FOR_EACH_OBSERVER(ChangeListLoaderObserver, |
565 observers_, | 565 observers_, |
566 OnDirectoryReloaded(*directory_path)); | 566 OnDirectoryReloaded(*directory_path)); |
567 } | 567 } |
568 } | 568 } |
569 | 569 |
570 } // namespace internal | 570 } // namespace internal |
571 } // namespace drive | 571 } // namespace drive |
OLD | NEW |