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