| 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 COMPONENTS_SYNC_ENGINE_IMPL_GET_UPDATES_PROCESSOR_H_ | 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_GET_UPDATES_PROCESSOR_H_ |
| 6 #define COMPONENTS_SYNC_ENGINE_IMPL_GET_UPDATES_PROCESSOR_H_ | 6 #define COMPONENTS_SYNC_ENGINE_IMPL_GET_UPDATES_PROCESSOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // Downloads and processes a batch of updates for the specified types. | 41 // Downloads and processes a batch of updates for the specified types. |
| 42 // | 42 // |
| 43 // Returns SYNCER_OK if the download succeeds, SERVER_MORE_TO_DOWNLOAD if the | 43 // Returns SYNCER_OK if the download succeeds, SERVER_MORE_TO_DOWNLOAD if the |
| 44 // download succeeded but there are still some updates left to fetch on the | 44 // download succeeded but there are still some updates left to fetch on the |
| 45 // server, or an appropriate error value in case of failure. | 45 // server, or an appropriate error value in case of failure. |
| 46 SyncerError DownloadUpdates(ModelTypeSet* request_types, | 46 SyncerError DownloadUpdates(ModelTypeSet* request_types, |
| 47 SyncCycle* cycle, | 47 SyncCycle* cycle, |
| 48 bool create_mobile_bookmarks_folder); | 48 bool create_mobile_bookmarks_folder); |
| 49 | 49 |
| 50 // Applies any downloaded and processed updates. | 50 // Applies any downloaded and processed updates. |
| 51 void ApplyUpdates(ModelTypeSet gu_types, StatusController* status_controller); | 51 void ApplyUpdates(const ModelTypeSet& gu_types, |
| 52 StatusController* status_controller); |
| 52 | 53 |
| 53 private: | 54 private: |
| 54 // Populates a GetUpdates request message with per-type information. | 55 // Populates a GetUpdates request message with per-type information. |
| 55 void PrepareGetUpdates(ModelTypeSet gu_types, | 56 void PrepareGetUpdates(const ModelTypeSet& gu_types, |
| 56 sync_pb::ClientToServerMessage* message); | 57 sync_pb::ClientToServerMessage* message); |
| 57 | 58 |
| 58 // Sends the specified message to the server and stores the response in a | 59 // Sends the specified message to the server and stores the response in a |
| 59 // member of the |cycle|'s StatusController. | 60 // member of the |cycle|'s StatusController. |
| 60 SyncerError ExecuteDownloadUpdates(ModelTypeSet* request_types, | 61 SyncerError ExecuteDownloadUpdates(ModelTypeSet* request_types, |
| 61 SyncCycle* cycle, | 62 SyncCycle* cycle, |
| 62 sync_pb::ClientToServerMessage* msg); | 63 sync_pb::ClientToServerMessage* msg); |
| 63 | 64 |
| 64 // Helper function for processing responses from the server. Defined here for | 65 // Helper function for processing responses from the server. Defined here for |
| 65 // testing. | 66 // testing. |
| 66 SyncerError ProcessResponse(const sync_pb::GetUpdatesResponse& gu_response, | 67 SyncerError ProcessResponse(const sync_pb::GetUpdatesResponse& gu_response, |
| 67 ModelTypeSet proto_request_types, | 68 const ModelTypeSet& proto_request_types, |
| 68 StatusController* status); | 69 StatusController* status); |
| 69 | 70 |
| 70 // Processes a GetUpdates responses for each type. | 71 // Processes a GetUpdates responses for each type. |
| 71 SyncerError ProcessGetUpdatesResponse( | 72 SyncerError ProcessGetUpdatesResponse( |
| 72 ModelTypeSet gu_types, | 73 const ModelTypeSet& gu_types, |
| 73 const sync_pb::GetUpdatesResponse& gu_response, | 74 const sync_pb::GetUpdatesResponse& gu_response, |
| 74 StatusController* status_controller); | 75 StatusController* status_controller); |
| 75 | 76 |
| 76 static void CopyClientDebugInfo(DebugInfoGetter* debug_info_getter, | 77 static void CopyClientDebugInfo(DebugInfoGetter* debug_info_getter, |
| 77 sync_pb::DebugInfo* debug_info); | 78 sync_pb::DebugInfo* debug_info); |
| 78 | 79 |
| 79 FRIEND_TEST_ALL_PREFIXES(GetUpdatesProcessorTest, BookmarkNudge); | 80 FRIEND_TEST_ALL_PREFIXES(GetUpdatesProcessorTest, BookmarkNudge); |
| 80 FRIEND_TEST_ALL_PREFIXES(GetUpdatesProcessorTest, NotifyMany); | 81 FRIEND_TEST_ALL_PREFIXES(GetUpdatesProcessorTest, NotifyMany); |
| 81 FRIEND_TEST_ALL_PREFIXES(GetUpdatesProcessorTest, InitialSyncRequest); | 82 FRIEND_TEST_ALL_PREFIXES(GetUpdatesProcessorTest, InitialSyncRequest); |
| 82 FRIEND_TEST_ALL_PREFIXES(GetUpdatesProcessorTest, ConfigureTest); | 83 FRIEND_TEST_ALL_PREFIXES(GetUpdatesProcessorTest, ConfigureTest); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 96 UpdateHandlerMap* update_handler_map_; | 97 UpdateHandlerMap* update_handler_map_; |
| 97 | 98 |
| 98 const GetUpdatesDelegate& delegate_; | 99 const GetUpdatesDelegate& delegate_; |
| 99 | 100 |
| 100 DISALLOW_COPY_AND_ASSIGN(GetUpdatesProcessor); | 101 DISALLOW_COPY_AND_ASSIGN(GetUpdatesProcessor); |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 } // namespace syncer | 104 } // namespace syncer |
| 104 | 105 |
| 105 #endif // COMPONENTS_SYNC_ENGINE_IMPL_GET_UPDATES_PROCESSOR_H_ | 106 #endif // COMPONENTS_SYNC_ENGINE_IMPL_GET_UPDATES_PROCESSOR_H_ |
| OLD | NEW |