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

Side by Side Diff: components/sync/model/model_error.cc

Issue 2623723002: [Sync] Remove ModelError::IsSet() in favor of base::Optional. (Closed)
Patch Set: Rebase. Created 3 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/model_error.h" 5 #include "components/sync/model/model_error.h"
6 6
7 namespace syncer { 7 namespace syncer {
8 8
9 ModelError::ModelError() : is_set_(false) {}
10
11 ModelError::ModelError(const tracked_objects::Location& location, 9 ModelError::ModelError(const tracked_objects::Location& location,
12 const std::string& message) 10 const std::string& message)
13 : is_set_(true), location_(location), message_(message) {} 11 : location_(location), message_(message) {}
14 12
15 ModelError::~ModelError() = default; 13 ModelError::~ModelError() = default;
16 14
17 bool ModelError::IsSet() const {
18 return is_set_;
19 }
20
21 const tracked_objects::Location& ModelError::location() const { 15 const tracked_objects::Location& ModelError::location() const {
22 DCHECK(IsSet());
23 return location_; 16 return location_;
24 } 17 }
25 18
26 const std::string& ModelError::message() const { 19 const std::string& ModelError::message() const {
27 DCHECK(IsSet());
28 return message_; 20 return message_;
29 } 21 }
30 22
31 } // namespace syncer 23 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698