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

Side by Side Diff: components/sync_driver/non_blocking_data_type_controller.cc

Issue 1548203002: Convert Pass()→std::move() in //components/[n-z]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bad headers Created 4 years, 11 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_driver/non_blocking_data_type_controller.h" 5 #include "components/sync_driver/non_blocking_data_type_controller.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
9 #include "base/location.h" 11 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
11 #include "components/sync_driver/backend_data_type_configurer.h" 13 #include "components/sync_driver/backend_data_type_configurer.h"
12 #include "components/sync_driver/sync_client.h" 14 #include "components/sync_driver/sync_client.h"
13 #include "sync/api/sync_error.h" 15 #include "sync/api/sync_error.h"
14 #include "sync/api/sync_merge_result.h" 16 #include "sync/api/sync_merge_result.h"
15 #include "sync/internal_api/public/activation_context.h" 17 #include "sync/internal_api/public/activation_context.h"
16 #include "sync/internal_api/public/shared_model_type_processor.h" 18 #include "sync/internal_api/public/shared_model_type_processor.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 model_load_callback_.Run(type(), error); 83 model_load_callback_.Run(type(), error);
82 } 84 }
83 } 85 }
84 86
85 void NonBlockingDataTypeController::OnProcessorStarted( 87 void NonBlockingDataTypeController::OnProcessorStarted(
86 syncer::SyncError error, 88 syncer::SyncError error,
87 scoped_ptr<syncer_v2::ActivationContext> activation_context) { 89 scoped_ptr<syncer_v2::ActivationContext> activation_context) {
88 if (BelongsToUIThread()) { 90 if (BelongsToUIThread()) {
89 // Hold on to the activation context until ActivateDataType is called. 91 // Hold on to the activation context until ActivateDataType is called.
90 if (state_ == MODEL_STARTING) { 92 if (state_ == MODEL_STARTING) {
91 activation_context_ = activation_context.Pass(); 93 activation_context_ = std::move(activation_context);
92 } 94 }
93 // TODO(stanisc): Figure out if UNRECOVERABLE_ERROR is OK in this case. 95 // TODO(stanisc): Figure out if UNRECOVERABLE_ERROR is OK in this case.
94 ConfigureResult result = error.IsSet() ? UNRECOVERABLE_ERROR : OK; 96 ConfigureResult result = error.IsSet() ? UNRECOVERABLE_ERROR : OK;
95 LoadModelsDone(result, error); 97 LoadModelsDone(result, error);
96 } else { 98 } else {
97 RunOnUIThread( 99 RunOnUIThread(
98 FROM_HERE, 100 FROM_HERE,
99 base::Bind(&NonBlockingDataTypeController::OnProcessorStarted, this, 101 base::Bind(&NonBlockingDataTypeController::OnProcessorStarted, this,
100 error, base::Passed(activation_context.Pass()))); 102 error, base::Passed(std::move(activation_context))));
101 } 103 }
102 } 104 }
103 105
104 void NonBlockingDataTypeController::StartAssociating( 106 void NonBlockingDataTypeController::StartAssociating(
105 const StartCallback& start_callback) { 107 const StartCallback& start_callback) {
106 DCHECK(BelongsToUIThread()); 108 DCHECK(BelongsToUIThread());
107 DCHECK(!start_callback.is_null()); 109 DCHECK(!start_callback.is_null());
108 110
109 state_ = RUNNING; 111 state_ = RUNNING;
110 112
111 // There is no association, just call back promptly. 113 // There is no association, just call back promptly.
112 syncer::SyncMergeResult merge_result(type()); 114 syncer::SyncMergeResult merge_result(type());
113 start_callback.Run(OK, merge_result, merge_result); 115 start_callback.Run(OK, merge_result, merge_result);
114 } 116 }
115 117
116 void NonBlockingDataTypeController::ActivateDataType( 118 void NonBlockingDataTypeController::ActivateDataType(
117 sync_driver::BackendDataTypeConfigurer* configurer) { 119 sync_driver::BackendDataTypeConfigurer* configurer) {
118 DCHECK(BelongsToUIThread()); 120 DCHECK(BelongsToUIThread());
119 DCHECK(configurer); 121 DCHECK(configurer);
120 DCHECK(activation_context_); 122 DCHECK(activation_context_);
121 DCHECK_EQ(RUNNING, state_); 123 DCHECK_EQ(RUNNING, state_);
122 configurer->ActivateNonBlockingDataType(type(), activation_context_.Pass()); 124 configurer->ActivateNonBlockingDataType(type(),
125 std::move(activation_context_));
123 } 126 }
124 127
125 void NonBlockingDataTypeController::DeactivateDataType( 128 void NonBlockingDataTypeController::DeactivateDataType(
126 sync_driver::BackendDataTypeConfigurer* configurer) { 129 sync_driver::BackendDataTypeConfigurer* configurer) {
127 DCHECK(BelongsToUIThread()); 130 DCHECK(BelongsToUIThread());
128 DCHECK(configurer); 131 DCHECK(configurer);
129 configurer->DeactivateNonBlockingDataType(type()); 132 configurer->DeactivateNonBlockingDataType(type());
130 } 133 }
131 134
132 void NonBlockingDataTypeController::Stop() { 135 void NonBlockingDataTypeController::Stop() {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 #undef PER_DATA_TYPE_MACRO 205 #undef PER_DATA_TYPE_MACRO
203 } 206 }
204 207
205 void NonBlockingDataTypeController::RecordUnrecoverableError() { 208 void NonBlockingDataTypeController::RecordUnrecoverableError() {
206 UMA_HISTOGRAM_ENUMERATION("Sync.DataTypeRunFailures", 209 UMA_HISTOGRAM_ENUMERATION("Sync.DataTypeRunFailures",
207 ModelTypeToHistogramInt(type()), 210 ModelTypeToHistogramInt(type()),
208 syncer::MODEL_TYPE_COUNT); 211 syncer::MODEL_TYPE_COUNT);
209 } 212 }
210 213
211 } // namespace sync_driver_v2 214 } // namespace sync_driver_v2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698