| 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 #include "sync/engine/syncer_proto_util.h" | 5 #include "sync/engine/syncer_proto_util.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "sync/engine/net/server_connection_manager.h" | 9 #include "sync/engine/net/server_connection_manager.h" |
| 10 #include "sync/engine/syncer.h" | 10 #include "sync/engine/syncer.h" |
| 11 #include "sync/engine/syncer_types.h" | 11 #include "sync/engine/syncer_types.h" |
| 12 #include "sync/engine/throttled_data_type_tracker.h" | 12 #include "sync/engine/throttled_data_type_tracker.h" |
| 13 #include "sync/engine/traffic_logger.h" | 13 #include "sync/engine/traffic_logger.h" |
| 14 #include "sync/internal_api/public/syncable/model_type.h" | 14 #include "sync/internal_api/public/syncable/model_type.h" |
| 15 #include "sync/protocol/sync.pb.h" | 15 #include "sync/protocol/sync.pb.h" |
| 16 #include "sync/protocol/sync_enums.pb.h" | 16 #include "sync/protocol/sync_enums.pb.h" |
| 17 #include "sync/protocol/sync_protocol_error.h" | 17 #include "sync/protocol/sync_protocol_error.h" |
| 18 #include "sync/sessions/sync_session.h" | 18 #include "sync/sessions/sync_session.h" |
| 19 #include "sync/syncable/directory.h" | 19 #include "sync/syncable/directory.h" |
| 20 #include "sync/syncable/entry.h" | 20 #include "sync/syncable/entry.h" |
| 21 #include "sync/syncable/syncable-inl.h" | 21 #include "sync/syncable/syncable-inl.h" |
| 22 #include "sync/util/time.h" | 22 #include "sync/util/time.h" |
| 23 | 23 |
| 24 using syncer::SyncProtocolErrorType; | |
| 25 using std::string; | 24 using std::string; |
| 26 using std::stringstream; | 25 using std::stringstream; |
| 26 |
| 27 namespace syncer { |
| 28 |
| 29 using sessions::SyncSession; |
| 27 using syncable::BASE_VERSION; | 30 using syncable::BASE_VERSION; |
| 28 using syncable::CTIME; | 31 using syncable::CTIME; |
| 29 using syncable::ID; | 32 using syncable::ID; |
| 30 using syncable::IS_DEL; | 33 using syncable::IS_DEL; |
| 31 using syncable::IS_DIR; | 34 using syncable::IS_DIR; |
| 32 using syncable::IS_UNSYNCED; | 35 using syncable::IS_UNSYNCED; |
| 33 using syncable::MTIME; | 36 using syncable::MTIME; |
| 34 using syncable::PARENT_ID; | 37 using syncable::PARENT_ID; |
| 35 | 38 |
| 36 namespace syncer { | |
| 37 using sessions::SyncSession; | |
| 38 | |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 // Time to backoff syncing after receiving a throttled response. | 41 // Time to backoff syncing after receiving a throttled response. |
| 42 const int kSyncDelayAfterThrottled = 2 * 60 * 60; // 2 hours | 42 const int kSyncDelayAfterThrottled = 2 * 60 * 60; // 2 hours |
| 43 | 43 |
| 44 void LogResponseProfilingData(const ClientToServerResponse& response) { | 44 void LogResponseProfilingData(const ClientToServerResponse& response) { |
| 45 if (response.has_profiling_data()) { | 45 if (response.has_profiling_data()) { |
| 46 stringstream response_trace; | 46 stringstream response_trace; |
| 47 response_trace << "Server response trace:"; | 47 response_trace << "Server response trace:"; |
| 48 | 48 |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 std::string SyncerProtoUtil::ClientToServerResponseDebugString( | 536 std::string SyncerProtoUtil::ClientToServerResponseDebugString( |
| 537 const sync_pb::ClientToServerResponse& response) { | 537 const sync_pb::ClientToServerResponse& response) { |
| 538 // Add more handlers as needed. | 538 // Add more handlers as needed. |
| 539 std::string output; | 539 std::string output; |
| 540 if (response.has_get_updates()) | 540 if (response.has_get_updates()) |
| 541 output.append(GetUpdatesResponseString(response.get_updates())); | 541 output.append(GetUpdatesResponseString(response.get_updates())); |
| 542 return output; | 542 return output; |
| 543 } | 543 } |
| 544 | 544 |
| 545 } // namespace syncer | 545 } // namespace syncer |
| OLD | NEW |