| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 if (type != UNSPECIFIED && type != TOP_LEVEL_FOLDER) | 46 if (type != UNSPECIFIED && type != TOP_LEVEL_FOLDER) |
| 47 DVLOG(1) << "Entry does not belong to active ModelSafeGroup!"; | 47 DVLOG(1) << "Entry does not belong to active ModelSafeGroup!"; |
| 48 return GROUP_PASSIVE; | 48 return GROUP_PASSIVE; |
| 49 } | 49 } |
| 50 return it->second; | 50 return it->second; |
| 51 } | 51 } |
| 52 | 52 |
| 53 std::string ModelSafeGroupToString(ModelSafeGroup group) { | 53 std::string ModelSafeGroupToString(ModelSafeGroup group) { |
| 54 switch (group) { | 54 switch (group) { |
| 55 case GROUP_UI: | 55 case GROUP_UI: |
| 56 return "GROUP_UI"; | 56 return "Group UI"; |
| 57 case GROUP_DB: | 57 case GROUP_DB: |
| 58 return "GROUP_DB"; | 58 return "Group DB"; |
| 59 case GROUP_FILE: | 59 case GROUP_FILE: |
| 60 return "GROUP_FILE"; | 60 return "Group File"; |
| 61 case GROUP_HISTORY: | 61 case GROUP_HISTORY: |
| 62 return "GROUP_HISTORY"; | 62 return "Group History"; |
| 63 case GROUP_PASSIVE: | 63 case GROUP_PASSIVE: |
| 64 return "GROUP_PASSIVE"; | 64 return "Group Passive"; |
| 65 case GROUP_PASSWORD: | 65 case GROUP_PASSWORD: |
| 66 return "GROUP_PASSWORD"; | 66 return "Group Password"; |
| 67 case GROUP_NON_BLOCKING: | 67 case GROUP_NON_BLOCKING: |
| 68 return "GROUP_NON_BLOCKING"; | 68 return "Group Non Blocking"; |
| 69 default: | |
| 70 NOTREACHED(); | |
| 71 return "INVALID"; | |
| 72 } | 69 } |
| 70 NOTREACHED(); |
| 71 return "Invalid"; |
| 73 } | 72 } |
| 74 | 73 |
| 75 ModelSafeWorker::ModelSafeWorker() | 74 ModelSafeWorker::ModelSafeWorker() |
| 76 : work_done_or_abandoned_(base::WaitableEvent::ResetPolicy::AUTOMATIC, | 75 : work_done_or_abandoned_(base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 77 base::WaitableEvent::InitialState::NOT_SIGNALED) { | 76 base::WaitableEvent::InitialState::NOT_SIGNALED) { |
| 78 } | 77 } |
| 79 ModelSafeWorker::~ModelSafeWorker() {} | 78 ModelSafeWorker::~ModelSafeWorker() {} |
| 80 | 79 |
| 81 void ModelSafeWorker::RequestStop() { | 80 void ModelSafeWorker::RequestStop() { |
| 82 base::AutoLock auto_lock(lock_); | 81 base::AutoLock auto_lock(lock_); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 *did_run = true; | 147 *did_run = true; |
| 149 | 148 |
| 150 { | 149 { |
| 151 base::AutoLock auto_lock(lock_); | 150 base::AutoLock auto_lock(lock_); |
| 152 DCHECK(is_work_running_); | 151 DCHECK(is_work_running_); |
| 153 is_work_running_ = false; | 152 is_work_running_ = false; |
| 154 } | 153 } |
| 155 } | 154 } |
| 156 | 155 |
| 157 } // namespace syncer | 156 } // namespace syncer |
| OLD | NEW |