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

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: Add a comment. 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
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/drive_feed_processor.h" 8 #include "chrome/browser/chromeos/drive/drive_feed_processor.h"
9 #include "chrome/browser/chromeos/drive/drive_files.h" 9 #include "chrome/browser/chromeos/drive/drive_files.h"
10 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h" 10 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 DCHECK(changed_dirs); 82 DCHECK(changed_dirs);
83 83
84 if (!is_delta_feed) { // Full update. 84 if (!is_delta_feed) { // Full update.
85 resource_metadata_->root()->RemoveChildren(); 85 resource_metadata_->root()->RemoveChildren();
86 changed_dirs->insert(resource_metadata_->root()->GetFilePath()); 86 changed_dirs->insert(resource_metadata_->root()->GetFilePath());
87 } 87 }
88 resource_metadata_->set_largest_changestamp(feed_changestamp); 88 resource_metadata_->set_largest_changestamp(feed_changestamp);
89 89
90 scoped_ptr<DriveResourceMetadata> orphaned_resources( 90 scoped_ptr<DriveResourceMetadata> orphaned_resources(
91 new DriveResourceMetadata); 91 new DriveResourceMetadata);
92 orphaned_resources->InitializeRootEntry("orphanedroot");
92 // Go through all entries generated by the feed and apply them to the local 93 // Go through all entries generated by the feed and apply them to the local
93 // snapshot of the file system. 94 // snapshot of the file system.
94 for (FileResourceIdMap::iterator it = file_map->begin(); 95 for (FileResourceIdMap::iterator it = file_map->begin();
95 it != file_map->end();) { 96 it != file_map->end();) {
96 // Ensure that the entry is deleted, unless the ownership is explicitly 97 // Ensure that the entry is deleted, unless the ownership is explicitly
97 // transferred by entry.release(). 98 // transferred by entry.release().
98 scoped_ptr<DriveEntry> entry(it->second); 99 scoped_ptr<DriveEntry> entry(it->second);
99 DCHECK_EQ(it->first, entry->resource_id()); 100 DCHECK_EQ(it->first, entry->resource_id());
100 // Erase the entry so the deleted entry won't be referenced. 101 // Erase the entry so the deleted entry won't be referenced.
101 file_map->erase(it++); 102 file_map->erase(it++);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // If the code above fails to parse a feed, any DriveEntry instance 295 // If the code above fails to parse a feed, any DriveEntry instance
295 // added to |file_by_url| is not managed by a DriveDirectory instance, 296 // added to |file_by_url| is not managed by a DriveDirectory instance,
296 // so we need to explicitly release them here. 297 // so we need to explicitly release them here.
297 STLDeleteValues(file_map); 298 STLDeleteValues(file_map);
298 } 299 }
299 300
300 return error; 301 return error;
301 } 302 }
302 303
303 } // namespace drive 304 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698