| 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 "base/containers/scoped_ptr_map.h" | 8 #include "base/containers/scoped_ptr_map.h" |
| 9 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "sync/base/sync_export.h" | 11 #include "sync/base/sync_export.h" |
| 11 #include "sync/engine/commit_contribution.h" | 12 #include "sync/engine/commit_contribution.h" |
| 12 #include "sync/internal_api/public/base/model_type.h" | 13 #include "sync/internal_api/public/base/model_type.h" |
| 13 #include "sync/internal_api/public/engine/model_safe_worker.h" | 14 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 14 #include "sync/internal_api/public/util/syncer_error.h" | 15 #include "sync/internal_api/public/util/syncer_error.h" |
| 15 #include "sync/protocol/sync.pb.h" | 16 #include "sync/protocol/sync.pb.h" |
| 16 #include "sync/sessions/nudge_tracker.h" | 17 #include "sync/sessions/nudge_tracker.h" |
| 17 #include "sync/util/extensions_activity.h" | 18 #include "sync/util/extensions_activity.h" |
| 18 | 19 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 29 // This class wraps the actions related to building and executing a single | 30 // This class wraps the actions related to building and executing a single |
| 30 // commit operation. | 31 // commit operation. |
| 31 // | 32 // |
| 32 // This class' most important responsibility is to manage the ContributionsMap. | 33 // This class' most important responsibility is to manage the ContributionsMap. |
| 33 // This class serves as a container for those objects. Although it would have | 34 // This class serves as a container for those objects. Although it would have |
| 34 // been acceptable to let this class be a dumb container object, it turns out | 35 // been acceptable to let this class be a dumb container object, it turns out |
| 35 // that there was no other convenient place to put the Init() and | 36 // that there was no other convenient place to put the Init() and |
| 36 // PostAndProcessCommitResponse() functions. So they ended up here. | 37 // PostAndProcessCommitResponse() functions. So they ended up here. |
| 37 class SYNC_EXPORT_PRIVATE Commit { | 38 class SYNC_EXPORT_PRIVATE Commit { |
| 38 public: | 39 public: |
| 39 typedef base::ScopedPtrMap<ModelType, scoped_ptr<CommitContribution>> | 40 typedef std::map<ModelType, scoped_ptr<CommitContribution>> ContributionMap; |
| 40 ContributionMap; | |
| 41 | 41 |
| 42 Commit(ContributionMap contributions, | 42 Commit(ContributionMap contributions, |
| 43 const sync_pb::ClientToServerMessage& message, | 43 const sync_pb::ClientToServerMessage& message, |
| 44 ExtensionsActivity::Records extensions_activity_buffer); | 44 ExtensionsActivity::Records extensions_activity_buffer); |
| 45 | 45 |
| 46 // This destructor will DCHECK if CleanUp() has not been called. | 46 // This destructor will DCHECK if CleanUp() has not been called. |
| 47 ~Commit(); | 47 ~Commit(); |
| 48 | 48 |
| 49 static Commit* Init( | 49 static Commit* Init( |
| 50 ModelTypeSet requested_types, | 50 ModelTypeSet requested_types, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 ContributionMap contributions_; | 68 ContributionMap contributions_; |
| 69 | 69 |
| 70 sync_pb::ClientToServerMessage message_; | 70 sync_pb::ClientToServerMessage message_; |
| 71 sync_pb::ClientToServerResponse response_; | 71 sync_pb::ClientToServerResponse response_; |
| 72 ExtensionsActivity::Records extensions_activity_buffer_; | 72 ExtensionsActivity::Records extensions_activity_buffer_; |
| 73 | 73 |
| 74 // Debug only flag used to indicate if it's safe to destruct the object. | 74 // Debug only flag used to indicate if it's safe to destruct the object. |
| 75 bool cleaned_up_; | 75 bool cleaned_up_; |
| 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(Commit); |
| 76 }; | 78 }; |
| 77 | 79 |
| 78 } // namespace syncer | 80 } // namespace syncer |
| 79 | 81 |
| 80 #endif // SYNC_ENGINE_COMMIT_H_ | 82 #endif // SYNC_ENGINE_COMMIT_H_ |
| OLD | NEW |