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

Side by Side Diff: chrome/browser/chromeos/drive/drive_feed_loader.cc

Issue 11230025: Initialize root resource ID only once for Drive API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 | « no previous file | 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/drive/drive_feed_loader.h" 5 #include "chrome/browser/chromeos/drive/drive_feed_loader.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 if (feed_data.get()) 374 if (feed_data.get())
375 about_resource = gdata::AboutResource::CreateFrom(*feed_data); 375 about_resource = gdata::AboutResource::CreateFrom(*feed_data);
376 376
377 if (!about_resource.get()) { 377 if (!about_resource.get()) {
378 LoadFromServer(params.Pass()); 378 LoadFromServer(params.Pass());
379 return; 379 return;
380 } 380 }
381 381
382 bool changes_detected = true; 382 bool changes_detected = true;
383 int64 largest_changestamp = about_resource->largest_change_id(); 383 int64 largest_changestamp = about_resource->largest_change_id();
384 resource_metadata_->InitializeRootEntry(about_resource->root_folder_id()); 384
385 // Initialize the root entry only for the first time.
386 if (resource_metadata_->root_resource_id().empty())
387 resource_metadata_->InitializeRootEntry(about_resource->root_folder_id());
385 388
386 if (local_changestamp >= largest_changestamp) { 389 if (local_changestamp >= largest_changestamp) {
387 if (local_changestamp > largest_changestamp) { 390 if (local_changestamp > largest_changestamp) {
388 LOG(WARNING) << "Cached client feed is fresher than server, client = " 391 LOG(WARNING) << "Cached client feed is fresher than server, client = "
389 << local_changestamp 392 << local_changestamp
390 << ", server = " 393 << ", server = "
391 << largest_changestamp; 394 << largest_changestamp;
392 } 395 }
393 // If our cache holds the latest state from the server, change the 396 // If our cache holds the latest state from the server, change the
394 // state to FROM_SERVER. 397 // state to FROM_SERVER.
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 dir_iter != changed_dirs.end(); ++dir_iter) { 916 dir_iter != changed_dirs.end(); ++dir_iter) {
914 FOR_EACH_OBSERVER(DriveFeedLoaderObserver, observers_, 917 FOR_EACH_OBSERVER(DriveFeedLoaderObserver, observers_,
915 OnDirectoryChanged(*dir_iter)); 918 OnDirectoryChanged(*dir_iter));
916 } 919 }
917 } 920 }
918 921
919 return error; 922 return error;
920 } 923 }
921 924
922 } // namespace drive 925 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698