| 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/syncer_error.h" | 17 #include "components/sync/base/syncer_error.h" |
| 18 #include "components/sync/engine/model_safe_worker.h" | 18 #include "components/sync/engine/model_safe_worker.h" |
| 19 #include "components/sync/engine_impl/commit_contribution.h" | 19 #include "components/sync/engine_impl/commit_contribution.h" |
| 20 #include "components/sync/engine_impl/cycle/nudge_tracker.h" |
| 20 #include "components/sync/protocol/sync.pb.h" | 21 #include "components/sync/protocol/sync.pb.h" |
| 21 #include "components/sync/sessions_impl/nudge_tracker.h" | |
| 22 | 22 |
| 23 namespace syncer { | 23 namespace syncer { |
| 24 | 24 |
| 25 namespace sessions { | 25 class CommitProcessor; |
| 26 class StatusController; | 26 class StatusController; |
| 27 class SyncSession; | 27 class SyncCycle; |
| 28 } | |
| 29 | |
| 30 class CommitProcessor; | |
| 31 class Syncer; | 28 class Syncer; |
| 32 | 29 |
| 33 // 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 |
| 34 // commit operation. | 31 // commit operation. |
| 35 // | 32 // |
| 36 // This class' most important responsibility is to manage the ContributionsMap. | 33 // This class' most important responsibility is to manage the ContributionsMap. |
| 37 // 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 |
| 38 // 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 |
| 39 // 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 |
| 40 // PostAndProcessCommitResponse() functions. So they ended up here. | 37 // PostAndProcessCommitResponse() functions. So they ended up here. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 53 static Commit* Init(ModelTypeSet requested_types, | 50 static Commit* Init(ModelTypeSet requested_types, |
| 54 ModelTypeSet enabled_types, | 51 ModelTypeSet enabled_types, |
| 55 size_t max_entries, | 52 size_t max_entries, |
| 56 const std::string& account_name, | 53 const std::string& account_name, |
| 57 const std::string& cache_guid, | 54 const std::string& cache_guid, |
| 58 bool cookie_jar_mismatch, | 55 bool cookie_jar_mismatch, |
| 59 bool cookie_jar_empty, | 56 bool cookie_jar_empty, |
| 60 CommitProcessor* commit_processor, | 57 CommitProcessor* commit_processor, |
| 61 ExtensionsActivity* extensions_activity); | 58 ExtensionsActivity* extensions_activity); |
| 62 | 59 |
| 63 SyncerError PostAndProcessResponse(sessions::NudgeTracker* nudge_tracker, | 60 SyncerError PostAndProcessResponse(NudgeTracker* nudge_tracker, |
| 64 sessions::SyncSession* session, | 61 SyncCycle* cycle, |
| 65 sessions::StatusController* status, | 62 StatusController* status, |
| 66 ExtensionsActivity* extensions_activity); | 63 ExtensionsActivity* extensions_activity); |
| 67 | 64 |
| 68 // Cleans up state associated with this commit. Must be called before the | 65 // Cleans up state associated with this commit. Must be called before the |
| 69 // destructor. | 66 // destructor. |
| 70 void CleanUp(); | 67 void CleanUp(); |
| 71 | 68 |
| 72 private: | 69 private: |
| 73 ContributionMap contributions_; | 70 ContributionMap contributions_; |
| 74 | 71 |
| 75 sync_pb::ClientToServerMessage message_; | 72 sync_pb::ClientToServerMessage message_; |
| 76 sync_pb::ClientToServerResponse response_; | 73 sync_pb::ClientToServerResponse response_; |
| 77 ExtensionsActivity::Records extensions_activity_buffer_; | 74 ExtensionsActivity::Records extensions_activity_buffer_; |
| 78 | 75 |
| 79 // Debug only flag used to indicate if it's safe to destruct the object. | 76 // Debug only flag used to indicate if it's safe to destruct the object. |
| 80 bool cleaned_up_; | 77 bool cleaned_up_; |
| 81 | 78 |
| 82 DISALLOW_COPY_AND_ASSIGN(Commit); | 79 DISALLOW_COPY_AND_ASSIGN(Commit); |
| 83 }; | 80 }; |
| 84 | 81 |
| 85 } // namespace syncer | 82 } // namespace syncer |
| 86 | 83 |
| 87 #endif // COMPONENTS_SYNC_ENGINE_IMPL_COMMIT_H_ | 84 #endif // COMPONENTS_SYNC_ENGINE_IMPL_COMMIT_H_ |
| OLD | NEW |