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

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 review. Created 8 years, 9 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.h » ('j') | sync/engine/traffic_logger.h » ('J')
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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 SyncSession* session) { 331 SyncSession* session) {
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, session);
342 if (!PostAndProcessHeaders(session->context()->connection_manager(), session, 342 if (!PostAndProcessHeaders(session->context()->connection_manager(), session,
343 msg, response)) { 343 msg, response)) {
344 // There was an error establishing communication with the server. 344 // There was an error establishing communication with the server.
345 // We can not proceed beyond this point. 345 // We can not proceed beyond this point.
346 const browser_sync::HttpResponse::ServerConnectionCode server_status = 346 const browser_sync::HttpResponse::ServerConnectionCode server_status =
347 session->context()->connection_manager()->server_status(); 347 session->context()->connection_manager()->server_status();
348 348
349 DCHECK_NE(server_status, browser_sync::HttpResponse::NONE); 349 DCHECK_NE(server_status, browser_sync::HttpResponse::NONE);
350 DCHECK_NE(server_status, browser_sync::HttpResponse::SERVER_CONNECTION_OK); 350 DCHECK_NE(server_status, browser_sync::HttpResponse::SERVER_CONNECTION_OK);
351 351
352 return ServerConnectionErrorAsSyncerError(server_status); 352 return ServerConnectionErrorAsSyncerError(server_status);
353 } 353 }
354 354
355 LogClientToServerResponse(*response); 355 LogClientToServerResponse(*response, session);
356 356
357 browser_sync::SyncProtocolError sync_protocol_error; 357 browser_sync::SyncProtocolError sync_protocol_error;
358 358
359 // Birthday mismatch overrides any error that is sent by the server. 359 // Birthday mismatch overrides any error that is sent by the server.
360 if (!VerifyResponseBirthday(dir, response)) { 360 if (!VerifyResponseBirthday(dir, response)) {
361 sync_protocol_error.error_type = browser_sync::NOT_MY_BIRTHDAY; 361 sync_protocol_error.error_type = browser_sync::NOT_MY_BIRTHDAY;
362 sync_protocol_error.action = 362 sync_protocol_error.action =
363 browser_sync::DISABLE_SYNC_ON_CLIENT; 363 browser_sync::DISABLE_SYNC_ON_CLIENT;
364 } else if (response->has_error()) { 364 } else if (response->has_error()) {
365 // This is a new server. Just get the error from the protocol. 365 // 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( 532 std::string SyncerProtoUtil::ClientToServerResponseDebugString(
533 const sync_pb::ClientToServerResponse& response) { 533 const sync_pb::ClientToServerResponse& response) {
534 // Add more handlers as needed. 534 // Add more handlers as needed.
535 std::string output; 535 std::string output;
536 if (response.has_get_updates()) 536 if (response.has_get_updates())
537 output.append(GetUpdatesResponseString(response.get_updates())); 537 output.append(GetUpdatesResponseString(response.get_updates()));
538 return output; 538 return output;
539 } 539 }
540 540
541 } // namespace browser_sync 541 } // namespace browser_sync
OLDNEW
« no previous file with comments | « no previous file | sync/engine/traffic_logger.h » ('j') | sync/engine/traffic_logger.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698