| 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 """An implementation of the server side of the Chromium sync protocol. | 5 """An implementation of the server side of the Chromium sync protocol. |
| 6 | 6 |
| 7 The details of the protocol are described mostly by comments in the protocol | 7 The details of the protocol are described mostly by comments in the protocol |
| 8 buffer definition at chrome/browser/sync/protocol/sync.proto. | 8 buffer definition at chrome/browser/sync/protocol/sync.proto. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 """Write the new_timestamp or new_progress_marker fields to a response.""" | 444 """Write the new_timestamp or new_progress_marker fields to a response.""" |
| 445 if self._original_request.from_progress_marker: | 445 if self._original_request.from_progress_marker: |
| 446 for data_type, old_timestamp in self._state.iteritems(): | 446 for data_type, old_timestamp in self._state.iteritems(): |
| 447 if data_type == TOP_LEVEL: | 447 if data_type == TOP_LEVEL: |
| 448 continue | 448 continue |
| 449 new_marker = sync_pb2.DataTypeProgressMarker() | 449 new_marker = sync_pb2.DataTypeProgressMarker() |
| 450 new_marker.data_type_id = SyncTypeToProtocolDataTypeId(data_type) | 450 new_marker.data_type_id = SyncTypeToProtocolDataTypeId(data_type) |
| 451 final_stamp = max(old_timestamp, new_timestamp) | 451 final_stamp = max(old_timestamp, new_timestamp) |
| 452 final_migration = self._migration_history.GetLatestVersion(data_type) | 452 final_migration = self._migration_history.GetLatestVersion(data_type) |
| 453 new_marker.token = pickle.dumps((final_stamp, final_migration)) | 453 new_marker.token = pickle.dumps((final_stamp, final_migration)) |
| 454 if new_marker not in self._original_request.from_progress_marker: | 454 get_updates_response.new_progress_marker.add().MergeFrom(new_marker) |
| 455 get_updates_response.new_progress_marker.add().MergeFrom(new_marker) | |
| 456 elif self._original_request.HasField('from_timestamp'): | 455 elif self._original_request.HasField('from_timestamp'): |
| 457 if self._original_request.from_timestamp < new_timestamp: | 456 if self._original_request.from_timestamp < new_timestamp: |
| 458 get_updates_response.new_timestamp = new_timestamp | 457 get_updates_response.new_timestamp = new_timestamp |
| 459 | 458 |
| 460 | 459 |
| 461 class SyncDataModel(object): | 460 class SyncDataModel(object): |
| 462 """Models the account state of one sync user.""" | 461 """Models the account state of one sync user.""" |
| 463 _BATCH_SIZE = 100 | 462 _BATCH_SIZE = 100 |
| 464 | 463 |
| 465 # Specify all the permanent items that a model might need. | 464 # Specify all the permanent items that a model might need. |
| (...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1476 sending_nigori_node = False | 1475 sending_nigori_node = False |
| 1477 for entry in entries: | 1476 for entry in entries: |
| 1478 if entry.name == 'Nigori': | 1477 if entry.name == 'Nigori': |
| 1479 sending_nigori_node = True | 1478 sending_nigori_node = True |
| 1480 reply = update_response.entries.add() | 1479 reply = update_response.entries.add() |
| 1481 reply.CopyFrom(entry) | 1480 reply.CopyFrom(entry) |
| 1482 update_sieve.SaveProgress(new_timestamp, update_response) | 1481 update_sieve.SaveProgress(new_timestamp, update_response) |
| 1483 | 1482 |
| 1484 if update_request.need_encryption_key or sending_nigori_node: | 1483 if update_request.need_encryption_key or sending_nigori_node: |
| 1485 update_response.encryption_keys.extend(self.account.GetKeystoreKeys()) | 1484 update_response.encryption_keys.extend(self.account.GetKeystoreKeys()) |
| OLD | NEW |