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

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

Issue 11227020: Set root resource ID upon full feed update. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase. Created 8 years, 1 month 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 <utility> 5 #include <utility>
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "chrome/browser/chromeos/drive/document_entry_conversion.h" 8 #include "chrome/browser/chromeos/drive/document_entry_conversion.h"
9 #include "chrome/browser/chromeos/drive/drive_feed_processor.h" 9 #include "chrome/browser/chromeos/drive/drive_feed_processor.h"
10 #include "chrome/browser/chromeos/drive/drive_files.h" 10 #include "chrome/browser/chromeos/drive/drive_files.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 std::set<FilePath>* changed_dirs) { 83 std::set<FilePath>* changed_dirs) {
84 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 84 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
85 DCHECK(changed_dirs); 85 DCHECK(changed_dirs);
86 86
87 if (!is_delta_feed) { // Full update. 87 if (!is_delta_feed) { // Full update.
88 resource_metadata_->root()->RemoveChildren(); 88 resource_metadata_->root()->RemoveChildren();
89 changed_dirs->insert(resource_metadata_->root()->GetFilePath()); 89 changed_dirs->insert(resource_metadata_->root()->GetFilePath());
90 } 90 }
91 resource_metadata_->set_largest_changestamp(feed_changestamp); 91 resource_metadata_->set_largest_changestamp(feed_changestamp);
92 92
93 scoped_ptr<DriveResourceMetadata> orphaned_resources(
94 new DriveResourceMetadata);
95 // This may look weird, but the root has to have some resource ID,
96 // otherwise cleaning up the resource metadata fails.
97 orphaned_resources->InitializeRootEntry("orphan");
satorux1 2012/10/29 05:28:35 This code should be unnecessary. orphaned resource
kochi 2012/10/29 05:52:39 Removed.
98
93 // TODO(achuith): Get rid of this conversion of DriveEntryProtoMap to 99 // TODO(achuith): Get rid of this conversion of DriveEntryProtoMap to
94 // ResourceMap. 100 // ResourceMap.
95 ResourceMap resource_map; 101 ResourceMap resource_map;
96 for (DriveEntryProtoMap::const_iterator it = entry_proto_map.begin(); 102 for (DriveEntryProtoMap::const_iterator it = entry_proto_map.begin();
97 it != entry_proto_map.end(); ++it) { 103 it != entry_proto_map.end(); ++it) {
98 scoped_ptr<DriveEntry> entry = 104 scoped_ptr<DriveEntry> entry =
99 resource_metadata_->CreateDriveEntryFromProto(it->second); 105 resource_metadata_->CreateDriveEntryFromProto(it->second);
100 resource_map.insert(std::make_pair(it->first, entry.release())); 106 resource_map.insert(std::make_pair(it->first, entry.release()));
101 } 107 }
102 108
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 std::pair<DriveEntryProtoMap::iterator, bool> ret = entry_proto_map-> 270 std::pair<DriveEntryProtoMap::iterator, bool> ret = entry_proto_map->
265 insert(std::make_pair(entry_proto.resource_id(), entry_proto)); 271 insert(std::make_pair(entry_proto.resource_id(), entry_proto));
266 DCHECK(ret.second); 272 DCHECK(ret.second);
267 if (!ret.second) 273 if (!ret.second)
268 LOG(WARNING) << "Found duplicate file " << entry_proto.base_name(); 274 LOG(WARNING) << "Found duplicate file " << entry_proto.base_name();
269 } 275 }
270 } 276 }
271 } 277 }
272 278
273 } // namespace drive 279 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698