OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h
" | 5 #include "chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h
" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
68 | 68 |
69 scoped_ptr<FileMetadata> GetFileMetadata(MetadataDatabase* database, | 69 scoped_ptr<FileMetadata> GetFileMetadata(MetadataDatabase* database, |
70 const std::string& file_id) { | 70 const std::string& file_id) { |
71 scoped_ptr<FileMetadata> metadata(new FileMetadata); | 71 scoped_ptr<FileMetadata> metadata(new FileMetadata); |
72 if (!database->FindFileByFileID(file_id, metadata.get())) | 72 if (!database->FindFileByFileID(file_id, metadata.get())) |
73 metadata.reset(); | 73 metadata.reset(); |
74 return metadata.Pass(); | 74 return metadata.Pass(); |
75 } | 75 } |
76 | 76 |
77 template <typename R, typename S, typename T> | |
78 R ComposeFunction(const base::Callback<T()>& g, | |
79 const base::Callback<R(S)>& f) { | |
80 return f.Run(g.Run()); | |
81 } | |
82 | |
83 template <typename R, typename S, typename T> | |
84 base::Callback<R()> CreateComposedFunction( | |
85 const base::Callback<T()>& g, | |
86 const base::Callback<R(S)>& f) { | |
87 return base::Bind(&ComposeFunction<R, S, T>, g, f); | |
88 } | |
89 | |
90 } // namespace | 77 } // namespace |
91 | 78 |
92 RemoteToLocalSyncer::RemoteToLocalSyncer(SyncEngineContext* sync_context) | 79 RemoteToLocalSyncer::RemoteToLocalSyncer(SyncEngineContext* sync_context) |
93 : sync_context_(sync_context), | 80 : sync_context_(sync_context), |
94 sync_action_(SYNC_ACTION_NONE), | 81 sync_action_(SYNC_ACTION_NONE), |
95 prepared_(false), | 82 prepared_(false), |
96 sync_root_deletion_(false), | 83 sync_root_deletion_(false), |
97 weak_ptr_factory_(this) { | 84 weak_ptr_factory_(this) { |
98 } | 85 } |
99 | 86 |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 return sync_context_->GetMetadataDatabase(); | 781 return sync_context_->GetMetadataDatabase(); |
795 } | 782 } |
796 | 783 |
797 RemoteChangeProcessor* RemoteToLocalSyncer::remote_change_processor() { | 784 RemoteChangeProcessor* RemoteToLocalSyncer::remote_change_processor() { |
798 DCHECK(sync_context_->GetRemoteChangeProcessor()); | 785 DCHECK(sync_context_->GetRemoteChangeProcessor()); |
799 return sync_context_->GetRemoteChangeProcessor(); | 786 return sync_context_->GetRemoteChangeProcessor(); |
800 } | 787 } |
801 | 788 |
802 } // namespace drive_backend | 789 } // namespace drive_backend |
803 } // namespace sync_file_system | 790 } // namespace sync_file_system |
OLD | NEW |