| 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 "components/sync/engine/model_safe_worker.h" | 5 #include "components/sync/engine/model_safe_worker.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // destroyed (see MessageLoop::~MessageLoop). So syncer will be blocked | 117 // destroyed (see MessageLoop::~MessageLoop). So syncer will be blocked |
| 118 // indefinitely without signaling here. | 118 // indefinitely without signaling here. |
| 119 work_done_or_stopped_.Signal(); | 119 work_done_or_stopped_.Signal(); |
| 120 | 120 |
| 121 DVLOG(1) << ModelSafeGroupToString(GetModelSafeGroup()) | 121 DVLOG(1) << ModelSafeGroupToString(GetModelSafeGroup()) |
| 122 << " worker stops on destruction of its working thread."; | 122 << " worker stops on destruction of its working thread."; |
| 123 } | 123 } |
| 124 | 124 |
| 125 { | 125 { |
| 126 base::AutoLock l(working_task_runner_lock_); | 126 base::AutoLock l(working_task_runner_lock_); |
| 127 working_task_runner_ = NULL; | 127 working_task_runner_ = nullptr; |
| 128 } | 128 } |
| 129 | 129 |
| 130 if (observer_) | 130 if (observer_) |
| 131 observer_->OnWorkerLoopDestroyed(GetModelSafeGroup()); | 131 observer_->OnWorkerLoopDestroyed(GetModelSafeGroup()); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void ModelSafeWorker::SetWorkingLoopToCurrent() { | 134 void ModelSafeWorker::SetWorkingLoopToCurrent() { |
| 135 base::Callback<void(ModelSafeGroup)> unregister_done_callback; | 135 base::Callback<void(ModelSafeGroup)> unregister_done_callback; |
| 136 | 136 |
| 137 { | 137 { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 return; | 189 return; |
| 190 DCHECK(working_task_runner_->BelongsToCurrentThread()); | 190 DCHECK(working_task_runner_->BelongsToCurrentThread()); |
| 191 } | 191 } |
| 192 | 192 |
| 193 DCHECK(stopped_); | 193 DCHECK(stopped_); |
| 194 base::MessageLoop::current()->RemoveDestructionObserver(this); | 194 base::MessageLoop::current()->RemoveDestructionObserver(this); |
| 195 unregister_done_callback.Run(GetModelSafeGroup()); | 195 unregister_done_callback.Run(GetModelSafeGroup()); |
| 196 } | 196 } |
| 197 | 197 |
| 198 } // namespace syncer | 198 } // namespace syncer |
| OLD | NEW |