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

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

Issue 13866009: Remove root resource id aliasing from DriveResourceMetadata. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } else if (about_resource.get()) { 102 } else if (about_resource.get()) {
103 largest_changestamp_ = about_resource->largest_change_id(); 103 largest_changestamp_ = about_resource->largest_change_id();
104 104
105 DVLOG(1) << "Root folder ID is " << about_resource->root_folder_id(); 105 DVLOG(1) << "Root folder ID is " << about_resource->root_folder_id();
106 DCHECK(!about_resource->root_folder_id().empty()); 106 DCHECK(!about_resource->root_folder_id().empty());
107 } else { 107 } else {
108 // A full update without AboutResouce will have no effective changestamp. 108 // A full update without AboutResouce will have no effective changestamp.
109 NOTREACHED(); 109 NOTREACHED();
110 } 110 }
111 111
112 ApplyEntryProtoMap(is_delta_feed); 112 ApplyEntryProtoMap(is_delta_feed, about_resource.Pass());
113 113
114 // Shouldn't record histograms when processing delta feeds. 114 // Shouldn't record histograms when processing delta feeds.
115 if (!is_delta_feed) 115 if (!is_delta_feed)
116 uma_stats.UpdateFileCountUmaHistograms(); 116 uma_stats.UpdateFileCountUmaHistograms();
117 } 117 }
118 118
119 void ChangeListProcessor::ApplyEntryProtoMap(bool is_delta_feed) { 119 void ChangeListProcessor::ApplyEntryProtoMap(
120 bool is_delta_feed,
121 scoped_ptr<google_apis::AboutResource> about_resource) {
120 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
121 123
122 if (!is_delta_feed) { // Full update. 124 if (!is_delta_feed) { // Full update.
125 DCHECK(about_resource);
126 changed_dirs_.insert(util::GetDriveGrandRootPath());
123 changed_dirs_.insert(util::GetDriveMyDriveRootPath()); 127 changed_dirs_.insert(util::GetDriveMyDriveRootPath());
128 // After all nodes are cleared, create the MyDrive root directory at first.
124 resource_metadata_->RemoveAll( 129 resource_metadata_->RemoveAll(
125 base::Bind(&ChangeListProcessor::ApplyNextEntryProtoAsync, 130 base::Bind(
126 weak_ptr_factory_.GetWeakPtr())); 131 &ChangeListProcessor::ApplyEntryProto,
132 weak_ptr_factory_.GetWeakPtr(),
133 util::CreateMyDriveRootEntry(about_resource->root_folder_id())));
127 } else { 134 } else {
128 // Go through all entries generated by the feed and apply them to the local 135 // Go through all entries generated by the feed and apply them to the local
129 // snapshot of the file system. 136 // snapshot of the file system.
130 ApplyNextEntryProtoAsync(); 137 ApplyNextEntryProtoAsync();
131 } 138 }
132 } 139 }
133 140
134 void ChangeListProcessor::ApplyNextEntryProtoAsync() { 141 void ChangeListProcessor::ApplyNextEntryProtoAsync() {
135 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 142 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
136 143
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 void ChangeListProcessor::Clear() { 456 void ChangeListProcessor::Clear() {
450 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 457 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
451 458
452 entry_proto_map_.clear(); 459 entry_proto_map_.clear();
453 changed_dirs_.clear(); 460 changed_dirs_.clear();
454 largest_changestamp_ = 0; 461 largest_changestamp_ = 0;
455 on_complete_callback_.Reset(); 462 on_complete_callback_.Reset();
456 } 463 }
457 464
458 } // namespace drive 465 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698