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

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

Issue 12588009: drive: Pass through AboutResouce from server among callbacks in ChangeListLoader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 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 (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_processor.h" 5 #include "chrome/browser/chromeos/drive/change_list_processor.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "chrome/browser/chromeos/drive/drive.pb.h" 10 #include "chrome/browser/chromeos/drive/drive.pb.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 DriveResourceMetadata* resource_metadata) 63 DriveResourceMetadata* resource_metadata)
64 : resource_metadata_(resource_metadata), 64 : resource_metadata_(resource_metadata),
65 largest_changestamp_(0), 65 largest_changestamp_(0),
66 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { 66 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
67 } 67 }
68 68
69 ChangeListProcessor::~ChangeListProcessor() { 69 ChangeListProcessor::~ChangeListProcessor() {
70 } 70 }
71 71
72 void ChangeListProcessor::ApplyFeeds( 72 void ChangeListProcessor::ApplyFeeds(
73 scoped_ptr<google_apis::AboutResource> about_resource,
73 const ScopedVector<google_apis::ResourceList>& feed_list, 74 const ScopedVector<google_apis::ResourceList>& feed_list,
74 bool is_delta_feed, 75 bool is_delta_feed,
75 int64 root_feed_changestamp,
76 const base::Closure& on_complete_callback) { 76 const base::Closure& on_complete_callback) {
77 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 77 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
78 DCHECK(!on_complete_callback.is_null()); 78 DCHECK(!on_complete_callback.is_null());
79 DCHECK(is_delta_feed || about_resource.get());
79 80
80 int64 delta_feed_changestamp = 0; 81 int64 delta_feed_changestamp = 0;
81 ChangeListToEntryProtoMapUMAStats uma_stats; 82 ChangeListToEntryProtoMapUMAStats uma_stats;
82 FeedToEntryProtoMap(feed_list, &delta_feed_changestamp, &uma_stats); 83 FeedToEntryProtoMap(feed_list, &delta_feed_changestamp, &uma_stats);
83 // Note FeedToEntryProtoMap calls Clear() which resets on_complete_callback_. 84 // Note FeedToEntryProtoMap calls Clear() which resets on_complete_callback_.
84 on_complete_callback_ = on_complete_callback; 85 on_complete_callback_ = on_complete_callback;
85 largest_changestamp_ = 86 largest_changestamp_ = 0;
86 is_delta_feed ? delta_feed_changestamp : root_feed_changestamp; 87 if (is_delta_feed) {
88 largest_changestamp_ = delta_feed_changestamp;
89 } else if (about_resource.get()) {
90 largest_changestamp_ = about_resource->largest_change_id();
91
92 DVLOG(1) << "Root folder ID is " << about_resource->root_folder_id();
93 DCHECK(!about_resource->root_folder_id().empty());
94 } else {
95 // A full update without AboutResouce will have no effective changestamp.
96 NOTREACHED();
97 }
98
99 // TODO(haruki): Add pseudo tree structure for "drive"/root" and "drive/other"
100 // when we start using those namespaces. The root folder ID is necessary for
101 // full feed update.
87 ApplyEntryProtoMap(is_delta_feed); 102 ApplyEntryProtoMap(is_delta_feed);
88 103
89 // Shouldn't record histograms when processing delta feeds. 104 // Shouldn't record histograms when processing delta feeds.
90 if (!is_delta_feed) 105 if (!is_delta_feed)
91 uma_stats.UpdateFileCountUmaHistograms(); 106 uma_stats.UpdateFileCountUmaHistograms();
92 } 107 }
93 108
94 void ChangeListProcessor::ApplyEntryProtoMap(bool is_delta_feed) { 109 void ChangeListProcessor::ApplyEntryProtoMap(bool is_delta_feed) {
95 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 110 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
96 111
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 461 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
447 462
448 entry_proto_map_.clear(); 463 entry_proto_map_.clear();
449 changed_dirs_.clear(); 464 changed_dirs_.clear();
450 root_upload_url_ = GURL(); 465 root_upload_url_ = GURL();
451 largest_changestamp_ = 0; 466 largest_changestamp_ = 0;
452 on_complete_callback_.Reset(); 467 on_complete_callback_.Reset();
453 } 468 }
454 469
455 } // namespace drive 470 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/change_list_processor.h ('k') | chrome/browser/chromeos/drive/drive_file_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698