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

Side by Side Diff: components/sync/engine_impl/cycle/data_type_tracker.cc

Issue 2375383003: Remove std::unique_ptr<>::release() on ScopedVector::insert
Patch Set: Created 4 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
« no previous file with comments | « components/dom_distiller/core/distiller_unittest.cc ('k') | ui/app_list/app_list_item_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/sync/engine_impl/cycle/data_type_tracker.h" 5 #include "components/sync/engine_impl/cycle/data_type_tracker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 if (it != pending_invalidations_.end() && 64 if (it != pending_invalidations_.end() &&
65 !InvalidationInterface::LessThanByVersion(*incoming, **it) && 65 !InvalidationInterface::LessThanByVersion(*incoming, **it) &&
66 !InvalidationInterface::LessThanByVersion(**it, *incoming)) { 66 !InvalidationInterface::LessThanByVersion(**it, *incoming)) {
67 // Incoming overlaps with existing. Either both are unknown versions 67 // Incoming overlaps with existing. Either both are unknown versions
68 // (likely) or these two have the same version number (very unlikely). 68 // (likely) or these two have the same version number (very unlikely).
69 // Acknowledge and overwrite existing. 69 // Acknowledge and overwrite existing.
70 70
71 // Insert before the existing and get iterator to inserted. 71 // Insert before the existing and get iterator to inserted.
72 ScopedVector<InvalidationInterface>::iterator it2 = 72 ScopedVector<InvalidationInterface>::iterator it2 =
73 pending_invalidations_.insert(it, incoming.release()); 73 pending_invalidations_.insert(it, std::move(incoming));
74 74
75 // Increment that iterator to the old one, then acknowledge and remove it. 75 // Increment that iterator to the old one, then acknowledge and remove it.
76 ++it2; 76 ++it2;
77 (*it2)->Acknowledge(); 77 (*it2)->Acknowledge();
78 pending_invalidations_.erase(it2); 78 pending_invalidations_.erase(it2);
79 } else { 79 } else {
80 // The incoming has a version not in the pending_invalidations_ list. 80 // The incoming has a version not in the pending_invalidations_ list.
81 // Add it to the list at the proper position. 81 // Add it to the list at the proper position.
82 pending_invalidations_.insert(it, incoming.release()); 82 pending_invalidations_.insert(it, std::move(incoming));
83 } 83 }
84 84
85 // The incoming invalidation may have caused us to exceed our buffer size. 85 // The incoming invalidation may have caused us to exceed our buffer size.
86 // Trim some items from our list, if necessary. 86 // Trim some items from our list, if necessary.
87 while (pending_invalidations_.size() > payload_buffer_size_) { 87 while (pending_invalidations_.size() > payload_buffer_size_) {
88 last_dropped_invalidation_.reset(pending_invalidations_.front()); 88 last_dropped_invalidation_.reset(pending_invalidations_.front());
89 last_dropped_invalidation_->Drop(); 89 last_dropped_invalidation_->Drop();
90 pending_invalidations_.weak_erase(pending_invalidations_.begin()); 90 pending_invalidations_.weak_erase(pending_invalidations_.begin());
91 } 91 }
92 } 92 }
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 if (now >= unthrottle_time_) { 228 if (now >= unthrottle_time_) {
229 unthrottle_time_ = base::TimeTicks(); 229 unthrottle_time_ = base::TimeTicks();
230 } 230 }
231 } 231 }
232 232
233 void DataTypeTracker::UpdateLocalNudgeDelay(base::TimeDelta delay) { 233 void DataTypeTracker::UpdateLocalNudgeDelay(base::TimeDelta delay) {
234 nudge_delay_ = delay; 234 nudge_delay_ = delay;
235 } 235 }
236 236
237 } // namespace syncer 237 } // namespace syncer
OLDNEW
« no previous file with comments | « components/dom_distiller/core/distiller_unittest.cc ('k') | ui/app_list/app_list_item_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698