| 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/model/sync_error.h" | 5 #include "components/sync/model/sync_error.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/ptr_util.h" |
| 11 | 12 |
| 12 namespace syncer { | 13 namespace syncer { |
| 13 | 14 |
| 14 SyncError::SyncError() { | 15 SyncError::SyncError() { |
| 15 Clear(); | 16 Clear(); |
| 16 } | 17 } |
| 17 | 18 |
| 18 SyncError::SyncError(const tracked_objects::Location& location, | 19 SyncError::SyncError(const tracked_objects::Location& location, |
| 19 ErrorType error_type, | 20 ErrorType error_type, |
| 20 const std::string& message, | 21 const std::string& message, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 const std::string& message, | 59 const std::string& message, |
| 59 ModelType model_type) { | 60 ModelType model_type) { |
| 60 Init(location, message, model_type, DATATYPE_ERROR); | 61 Init(location, message, model_type, DATATYPE_ERROR); |
| 61 PrintLogError(); | 62 PrintLogError(); |
| 62 } | 63 } |
| 63 | 64 |
| 64 void SyncError::Init(const tracked_objects::Location& location, | 65 void SyncError::Init(const tracked_objects::Location& location, |
| 65 const std::string& message, | 66 const std::string& message, |
| 66 ModelType model_type, | 67 ModelType model_type, |
| 67 ErrorType error_type) { | 68 ErrorType error_type) { |
| 68 location_.reset(new tracked_objects::Location(location)); | 69 location_ = base::MakeUnique<tracked_objects::Location>(location); |
| 69 message_ = message; | 70 message_ = message; |
| 70 model_type_ = model_type; | 71 model_type_ = model_type; |
| 71 error_type_ = error_type; | 72 error_type_ = error_type; |
| 72 } | 73 } |
| 73 | 74 |
| 74 bool SyncError::IsSet() const { | 75 bool SyncError::IsSet() const { |
| 75 return error_type_ != UNSET; | 76 return error_type_ != UNSET; |
| 76 } | 77 } |
| 77 | 78 |
| 78 const tracked_objects::Location& SyncError::location() const { | 79 const tracked_objects::Location& SyncError::location() const { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 logSeverity >= ::logging::GetMinLogLevel()) | 153 logSeverity >= ::logging::GetMinLogLevel()) |
| 153 << ModelTypeToString(model_type_) << " " << GetMessagePrefix() | 154 << ModelTypeToString(model_type_) << " " << GetMessagePrefix() |
| 154 << message_; | 155 << message_; |
| 155 } | 156 } |
| 156 | 157 |
| 157 void PrintTo(const SyncError& sync_error, std::ostream* os) { | 158 void PrintTo(const SyncError& sync_error, std::ostream* os) { |
| 158 *os << sync_error.ToString(); | 159 *os << sync_error.ToString(); |
| 159 } | 160 } |
| 160 | 161 |
| 161 } // namespace syncer | 162 } // namespace syncer |
| OLD | NEW |