| OLD | NEW |
| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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( | 93 scoped_ptr<DriveResourceMetadata> orphaned_resources( |
| 94 new DriveResourceMetadata); | 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->SetRootResourceId("orphan"); |
| 95 | 98 |
| 96 // TODO(achuith): Get rid of this conversion of DriveEntryProtoMap to | 99 // TODO(achuith): Get rid of this conversion of DriveEntryProtoMap to |
| 97 // ResourceMap. | 100 // ResourceMap. |
| 98 ResourceMap resource_map; | 101 ResourceMap resource_map; |
| 99 for (DriveEntryProtoMap::const_iterator it = entry_proto_map.begin(); | 102 for (DriveEntryProtoMap::const_iterator it = entry_proto_map.begin(); |
| 100 it != entry_proto_map.end(); ++it) { | 103 it != entry_proto_map.end(); ++it) { |
| 101 scoped_ptr<DriveEntry> entry = | 104 scoped_ptr<DriveEntry> entry = |
| 102 resource_metadata_->CreateDriveEntryFromProto(it->second); | 105 resource_metadata_->CreateDriveEntryFromProto(it->second); |
| 103 resource_map.insert(std::make_pair(it->first, entry.release())); | 106 resource_map.insert(std::make_pair(it->first, entry.release())); |
| 104 } | 107 } |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 std::pair<DriveEntryProtoMap::iterator, bool> ret = entry_proto_map-> | 284 std::pair<DriveEntryProtoMap::iterator, bool> ret = entry_proto_map-> |
| 282 insert(std::make_pair(entry_proto.resource_id(), entry_proto)); | 285 insert(std::make_pair(entry_proto.resource_id(), entry_proto)); |
| 283 DCHECK(ret.second); | 286 DCHECK(ret.second); |
| 284 if (!ret.second) | 287 if (!ret.second) |
| 285 LOG(WARNING) << "Found duplicate file " << entry_proto.base_name(); | 288 LOG(WARNING) << "Found duplicate file " << entry_proto.base_name(); |
| 286 } | 289 } |
| 287 } | 290 } |
| 288 } | 291 } |
| 289 | 292 |
| 290 } // namespace drive | 293 } // namespace drive |
| OLD | NEW |