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

Unified Diff: chrome/browser/sync/engine/clear_data_command.cc

Issue 7861013: Fix the false-positive detection of commit errors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Another attempt at detecting errors Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/engine/clear_data_command.cc
diff --git a/chrome/browser/sync/engine/clear_data_command.cc b/chrome/browser/sync/engine/clear_data_command.cc
index 6e609ed8ca5cd11f156486e3509ea067e2bd19e1..c8859fc53eb27d4dce889e00ee7cd48d0946a6ba 100644
--- a/chrome/browser/sync/engine/clear_data_command.cc
+++ b/chrome/browser/sync/engine/clear_data_command.cc
@@ -27,8 +27,10 @@ ClearDataCommand::ClearDataCommand() {}
ClearDataCommand::~ClearDataCommand() {}
void ClearDataCommand::ExecuteImpl(SyncSession* session) {
+ StatusController* status = session->status_controller();
ClientToServerMessage client_to_server_message;
ClientToServerResponse client_to_server_response;
+ SyncOperationResult result;
client_to_server_message.set_share(session->context()->account_name());
client_to_server_message.set_message_contents(
@@ -40,6 +42,8 @@ void ClearDataCommand::ExecuteImpl(SyncSession* session) {
session->context()->account_name());
if (!dir.good()) {
LOG(ERROR) << "Scoped dir lookup failed!";
+ result.error_type = DIRECTORY_LOOKUP_FAILED;
+ status->set_last_clear_data_result(result);
return;
}
@@ -47,16 +51,22 @@ void ClearDataCommand::ExecuteImpl(SyncSession* session) {
VLOG(1) << "Clearing server data";
- bool ok = SyncerProtoUtil::PostClientToServerMessage(
- client_to_server_message,
- &client_to_server_response,
- session);
+ result = SyncerProtoUtil::PostClientToServerMessage(
+ client_to_server_message,
+ &client_to_server_response,
+ session);
+ status->set_last_clear_data_result(result);
DVLOG(1) << SyncerProtoUtil::ClientToServerResponseDebugString(
client_to_server_response);
- // Clear pending indicates that the server has received our clear message
- if (!ok || !client_to_server_response.has_error_code() ||
+ // NOTE: This code is broken. error_code() is deprecated. Fixing this
+ // is a separate issue that I don't want to get into.
+
+ // Clear pending indicates that the server has received our clear message.
+ if (result.error_type != OPERATION_SUCCESS ||
+ // TODO(rlarocque): This code depends on deprecated error variables.
+ !client_to_server_response.has_error_code() ||
client_to_server_response.error_code() !=
sync_pb::ClientToServerResponse::SUCCESS) {
// On failure, subsequent requests to the server will cause it to attempt
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/browser/sync/engine/download_updates_command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698