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

Side by Side Diff: components/sync/engine_impl/directory_update_handler.cc

Issue 2422253002: [Sync] Rewriting ".reset(new" pattern to use "= base::MakeUnique" instead. (Closed)
Patch Set: Fixing compile. 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/directory_update_handler.h" 5 #include "components/sync/engine_impl/directory_update_handler.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/ptr_util.h"
11 #include "components/sync/base/data_type_histogram.h" 12 #include "components/sync/base/data_type_histogram.h"
12 #include "components/sync/engine_impl/conflict_resolver.h" 13 #include "components/sync/engine_impl/conflict_resolver.h"
13 #include "components/sync/engine_impl/cycle/directory_type_debug_info_emitter.h" 14 #include "components/sync/engine_impl/cycle/directory_type_debug_info_emitter.h"
14 #include "components/sync/engine_impl/cycle/status_controller.h" 15 #include "components/sync/engine_impl/cycle/status_controller.h"
15 #include "components/sync/engine_impl/update_applicator.h" 16 #include "components/sync/engine_impl/update_applicator.h"
16 #include "components/sync/syncable/directory.h" 17 #include "components/sync/syncable/directory.h"
17 #include "components/sync/syncable/model_neutral_mutable_entry.h" 18 #include "components/sync/syncable/model_neutral_mutable_entry.h"
18 #include "components/sync/syncable/syncable_changes_version.h" 19 #include "components/sync/syncable/syncable_changes_version.h"
19 #include "components/sync/syncable/syncable_model_neutral_write_transaction.h" 20 #include "components/sync/syncable/syncable_model_neutral_write_transaction.h"
20 #include "components/sync/syncable/syncable_write_transaction.h" 21 #include "components/sync/syncable/syncable_write_transaction.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 279 }
279 } 280 }
280 281
281 void DirectoryUpdateHandler::ExpireEntriesIfNeeded( 282 void DirectoryUpdateHandler::ExpireEntriesIfNeeded(
282 syncable::ModelNeutralWriteTransaction* trans, 283 syncable::ModelNeutralWriteTransaction* trans,
283 const sync_pb::DataTypeProgressMarker& progress_marker) { 284 const sync_pb::DataTypeProgressMarker& progress_marker) {
284 if (!cached_gc_directive_) { 285 if (!cached_gc_directive_) {
285 sync_pb::DataTypeProgressMarker current_marker; 286 sync_pb::DataTypeProgressMarker current_marker;
286 GetDownloadProgress(&current_marker); 287 GetDownloadProgress(&current_marker);
287 if (current_marker.has_gc_directive()) { 288 if (current_marker.has_gc_directive()) {
288 cached_gc_directive_.reset(new sync_pb::GarbageCollectionDirective( 289 cached_gc_directive_ =
289 current_marker.gc_directive())); 290 base::MakeUnique<sync_pb::GarbageCollectionDirective>(
291 current_marker.gc_directive());
290 } 292 }
291 } 293 }
292 294
293 if (!progress_marker.has_gc_directive()) 295 if (!progress_marker.has_gc_directive())
294 return; 296 return;
295 297
296 const sync_pb::GarbageCollectionDirective& new_gc_directive = 298 const sync_pb::GarbageCollectionDirective& new_gc_directive =
297 progress_marker.gc_directive(); 299 progress_marker.gc_directive();
298 300
299 if (new_gc_directive.has_version_watermark() && 301 if (new_gc_directive.has_version_watermark() &&
300 (!cached_gc_directive_ || 302 (!cached_gc_directive_ ||
301 cached_gc_directive_->version_watermark() < 303 cached_gc_directive_->version_watermark() <
302 new_gc_directive.version_watermark())) { 304 new_gc_directive.version_watermark())) {
303 ExpireEntriesByVersion(dir_, trans, type_, 305 ExpireEntriesByVersion(dir_, trans, type_,
304 new_gc_directive.version_watermark()); 306 new_gc_directive.version_watermark());
305 } 307 }
306 308
307 cached_gc_directive_.reset( 309 cached_gc_directive_ =
308 new sync_pb::GarbageCollectionDirective(new_gc_directive)); 310 base::MakeUnique<sync_pb::GarbageCollectionDirective>(new_gc_directive);
309 } 311 }
310 312
311 } // namespace syncer 313 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine_impl/cycle/sync_cycle.cc ('k') | components/sync/engine_impl/directory_update_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698