| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_DIRECTORY_COMMIT_CONTRIBUTOR_H_ | 5 #ifndef SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTOR_H_ |
| 6 #define SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTOR_H_ | 6 #define SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "sync/engine/commit_contributor.h" | 11 #include "sync/engine/commit_contributor.h" |
| 12 #include "sync/engine/directory_commit_contribution.h" | 12 #include "sync/engine/directory_commit_contribution.h" |
| 13 #include "sync/internal_api/public/base/model_type.h" | 13 #include "sync/internal_api/public/base/model_type.h" |
| 14 | 14 |
| 15 namespace syncer { | 15 namespace syncer { |
| 16 | 16 |
| 17 namespace syncable { | 17 namespace syncable { |
| 18 class Directory; | 18 class Directory; |
| 19 } | 19 } |
| 20 | 20 |
| 21 class DirectoryTypeDebugInfoEmitter; |
| 22 |
| 21 // This class represents the syncable::Directory as a source of items to commit | 23 // This class represents the syncable::Directory as a source of items to commit |
| 22 // to the sync server. | 24 // to the sync server. |
| 23 // | 25 // |
| 24 // Each instance of this class represents a particular type within the | 26 // Each instance of this class represents a particular type within the |
| 25 // syncable::Directory. When asked, it will iterate through the directory, grab | 27 // syncable::Directory. When asked, it will iterate through the directory, grab |
| 26 // any items of its type that are ready for commit, and return them in the form | 28 // any items of its type that are ready for commit, and return them in the form |
| 27 // of a DirectoryCommitContribution. | 29 // of a DirectoryCommitContribution. |
| 28 class DirectoryCommitContributor : public CommitContributor { | 30 class DirectoryCommitContributor : public CommitContributor { |
| 29 public: | 31 public: |
| 30 DirectoryCommitContributor(syncable::Directory* dir, ModelType type); | 32 DirectoryCommitContributor(syncable::Directory* dir, |
| 33 ModelType type, |
| 34 DirectoryTypeDebugInfoEmitter* debug_info_emitter); |
| 31 virtual ~DirectoryCommitContributor(); | 35 virtual ~DirectoryCommitContributor(); |
| 32 | 36 |
| 33 virtual scoped_ptr<CommitContribution> GetContribution( | 37 virtual scoped_ptr<CommitContribution> GetContribution( |
| 34 size_t max_entries) OVERRIDE; | 38 size_t max_entries) OVERRIDE; |
| 35 | 39 |
| 36 private: | 40 private: |
| 37 syncable::Directory* dir_; | 41 syncable::Directory* dir_; |
| 38 ModelType type_; | 42 ModelType type_; |
| 39 | 43 |
| 44 DirectoryTypeDebugInfoEmitter* debug_info_emitter_; |
| 45 |
| 40 DISALLOW_COPY_AND_ASSIGN(DirectoryCommitContributor); | 46 DISALLOW_COPY_AND_ASSIGN(DirectoryCommitContributor); |
| 41 }; | 47 }; |
| 42 | 48 |
| 43 } // namespace | 49 } // namespace |
| 44 | 50 |
| 45 #endif // SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTOR_H_ | 51 #endif // SYNC_ENGINE_DIRECTORY_COMMIT_CONTRIBUTOR_H_ |
| OLD | NEW |