Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: sync/engine/syncer_proto_util.cc

Issue 9732008: [Sync] Store the past 10 traffic records in memory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For submitting. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sync/engine/traffic_logger.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 332
333 CHECK(response); 333 CHECK(response);
334 DCHECK(!msg.get_updates().has_from_timestamp()); // Deprecated. 334 DCHECK(!msg.get_updates().has_from_timestamp()); // Deprecated.
335 DCHECK(!msg.get_updates().has_requested_types()); // Deprecated. 335 DCHECK(!msg.get_updates().has_requested_types()); // Deprecated.
336 DCHECK(msg.has_store_birthday() || IsVeryFirstGetUpdates(msg)) 336 DCHECK(msg.has_store_birthday() || IsVeryFirstGetUpdates(msg))
337 << "Must call AddRequestBirthday to set birthday."; 337 << "Must call AddRequestBirthday to set birthday.";
338 338
339 syncable::Directory* dir = session->context()->directory(); 339 syncable::Directory* dir = session->context()->directory();
340 340
341 LogClientToServerMessage(msg); 341 LogClientToServerMessage(msg);
342 session->context()->traffic_recorder()->RecordClientToServerMessage(msg);
342 if (!PostAndProcessHeaders(session->context()->connection_manager(), session, 343 if (!PostAndProcessHeaders(session->context()->connection_manager(), session,
343 msg, response)) { 344 msg, response)) {
344 // There was an error establishing communication with the server. 345 // There was an error establishing communication with the server.
345 // We can not proceed beyond this point. 346 // We can not proceed beyond this point.
346 const browser_sync::HttpResponse::ServerConnectionCode server_status = 347 const browser_sync::HttpResponse::ServerConnectionCode server_status =
347 session->context()->connection_manager()->server_status(); 348 session->context()->connection_manager()->server_status();
348 349
349 DCHECK_NE(server_status, browser_sync::HttpResponse::NONE); 350 DCHECK_NE(server_status, browser_sync::HttpResponse::NONE);
350 DCHECK_NE(server_status, browser_sync::HttpResponse::SERVER_CONNECTION_OK); 351 DCHECK_NE(server_status, browser_sync::HttpResponse::SERVER_CONNECTION_OK);
351 352
352 return ServerConnectionErrorAsSyncerError(server_status); 353 return ServerConnectionErrorAsSyncerError(server_status);
353 } 354 }
354 355
355 LogClientToServerResponse(*response); 356 LogClientToServerResponse(*response);
357 session->context()->traffic_recorder()->RecordClientToServerResponse(
358 *response);
356 359
357 browser_sync::SyncProtocolError sync_protocol_error; 360 browser_sync::SyncProtocolError sync_protocol_error;
358 361
359 // Birthday mismatch overrides any error that is sent by the server. 362 // Birthday mismatch overrides any error that is sent by the server.
360 if (!VerifyResponseBirthday(dir, response)) { 363 if (!VerifyResponseBirthday(dir, response)) {
361 sync_protocol_error.error_type = browser_sync::NOT_MY_BIRTHDAY; 364 sync_protocol_error.error_type = browser_sync::NOT_MY_BIRTHDAY;
362 sync_protocol_error.action = 365 sync_protocol_error.action =
363 browser_sync::DISABLE_SYNC_ON_CLIENT; 366 browser_sync::DISABLE_SYNC_ON_CLIENT;
364 } else if (response->has_error()) { 367 } else if (response->has_error()) {
365 // This is a new server. Just get the error from the protocol. 368 // This is a new server. Just get the error from the protocol.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 std::string SyncerProtoUtil::ClientToServerResponseDebugString( 535 std::string SyncerProtoUtil::ClientToServerResponseDebugString(
533 const sync_pb::ClientToServerResponse& response) { 536 const sync_pb::ClientToServerResponse& response) {
534 // Add more handlers as needed. 537 // Add more handlers as needed.
535 std::string output; 538 std::string output;
536 if (response.has_get_updates()) 539 if (response.has_get_updates())
537 output.append(GetUpdatesResponseString(response.get_updates())); 540 output.append(GetUpdatesResponseString(response.get_updates()));
538 return output; 541 return output;
539 } 542 }
540 543
541 } // namespace browser_sync 544 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | sync/engine/traffic_logger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698