| 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 #ifndef SYNC_ENGINE_COMMIT_H_ | 5 #ifndef SYNC_ENGINE_COMMIT_H_ |
| 6 #define SYNC_ENGINE_COMMIT_H_ | 6 #define SYNC_ENGINE_COMMIT_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 11 #include <string> | 12 #include <string> |
| 12 | 13 |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "sync/base/sync_export.h" | 15 #include "sync/base/sync_export.h" |
| 16 #include "sync/engine/commit_contribution.h" | 16 #include "sync/engine/commit_contribution.h" |
| 17 #include "sync/internal_api/public/base/model_type.h" | 17 #include "sync/internal_api/public/base/model_type.h" |
| 18 #include "sync/internal_api/public/engine/model_safe_worker.h" | 18 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 19 #include "sync/internal_api/public/util/syncer_error.h" | 19 #include "sync/internal_api/public/util/syncer_error.h" |
| 20 #include "sync/protocol/sync.pb.h" | 20 #include "sync/protocol/sync.pb.h" |
| 21 #include "sync/sessions/nudge_tracker.h" | 21 #include "sync/sessions/nudge_tracker.h" |
| 22 #include "sync/util/extensions_activity.h" | 22 #include "sync/util/extensions_activity.h" |
| 23 | 23 |
| 24 namespace syncer { | 24 namespace syncer { |
| 25 | 25 |
| 26 namespace sessions { | 26 namespace sessions { |
| 27 class StatusController; | 27 class StatusController; |
| 28 class SyncSession; | 28 class SyncSession; |
| 29 } | 29 } |
| 30 | 30 |
| 31 class CommitProcessor; | 31 class CommitProcessor; |
| 32 class Syncer; | 32 class Syncer; |
| 33 | 33 |
| 34 // This class wraps the actions related to building and executing a single | 34 // This class wraps the actions related to building and executing a single |
| 35 // commit operation. | 35 // commit operation. |
| 36 // | 36 // |
| 37 // This class' most important responsibility is to manage the ContributionsMap. | 37 // This class' most important responsibility is to manage the ContributionsMap. |
| 38 // This class serves as a container for those objects. Although it would have | 38 // This class serves as a container for those objects. Although it would have |
| 39 // been acceptable to let this class be a dumb container object, it turns out | 39 // been acceptable to let this class be a dumb container object, it turns out |
| 40 // that there was no other convenient place to put the Init() and | 40 // that there was no other convenient place to put the Init() and |
| 41 // PostAndProcessCommitResponse() functions. So they ended up here. | 41 // PostAndProcessCommitResponse() functions. So they ended up here. |
| 42 class SYNC_EXPORT Commit { | 42 class SYNC_EXPORT Commit { |
| 43 public: | 43 public: |
| 44 typedef std::map<ModelType, scoped_ptr<CommitContribution>> ContributionMap; | 44 typedef std::map<ModelType, std::unique_ptr<CommitContribution>> |
| 45 ContributionMap; |
| 45 | 46 |
| 46 Commit(ContributionMap contributions, | 47 Commit(ContributionMap contributions, |
| 47 const sync_pb::ClientToServerMessage& message, | 48 const sync_pb::ClientToServerMessage& message, |
| 48 ExtensionsActivity::Records extensions_activity_buffer); | 49 ExtensionsActivity::Records extensions_activity_buffer); |
| 49 | 50 |
| 50 // This destructor will DCHECK if CleanUp() has not been called. | 51 // This destructor will DCHECK if CleanUp() has not been called. |
| 51 ~Commit(); | 52 ~Commit(); |
| 52 | 53 |
| 53 static Commit* Init( | 54 static Commit* Init( |
| 54 ModelTypeSet requested_types, | 55 ModelTypeSet requested_types, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 78 | 79 |
| 79 // Debug only flag used to indicate if it's safe to destruct the object. | 80 // Debug only flag used to indicate if it's safe to destruct the object. |
| 80 bool cleaned_up_; | 81 bool cleaned_up_; |
| 81 | 82 |
| 82 DISALLOW_COPY_AND_ASSIGN(Commit); | 83 DISALLOW_COPY_AND_ASSIGN(Commit); |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 } // namespace syncer | 86 } // namespace syncer |
| 86 | 87 |
| 87 #endif // SYNC_ENGINE_COMMIT_H_ | 88 #endif // SYNC_ENGINE_COMMIT_H_ |
| OLD | NEW |