OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "chrome/browser/sync/engine/process_commit_response_command.h" | 5 #include "chrome/browser/sync/engine/process_commit_response_command.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 void IncrementErrorCounters(SyncerStatus status) { | 46 void IncrementErrorCounters(SyncerStatus status) { |
47 status.increment_consecutive_problem_commits(); | 47 status.increment_consecutive_problem_commits(); |
48 status.increment_consecutive_errors(); | 48 status.increment_consecutive_errors(); |
49 } | 49 } |
50 void ResetErrorCounters(SyncerStatus status) { | 50 void ResetErrorCounters(SyncerStatus status) { |
51 status.zero_consecutive_problem_commits(); | 51 status.zero_consecutive_problem_commits(); |
52 status.zero_consecutive_errors(); | 52 status.zero_consecutive_errors(); |
53 } | 53 } |
54 | 54 |
55 ProcessCommitResponseCommand::ProcessCommitResponseCommand() {} | 55 ProcessCommitResponseCommand::ProcessCommitResponseCommand( |
| 56 ExtensionsActivityMonitor* monitor) : extensions_monitor_(monitor) {} |
56 ProcessCommitResponseCommand::~ProcessCommitResponseCommand() {} | 57 ProcessCommitResponseCommand::~ProcessCommitResponseCommand() {} |
57 | 58 |
58 void ProcessCommitResponseCommand::ModelChangingExecuteImpl( | 59 void ProcessCommitResponseCommand::ModelChangingExecuteImpl( |
59 SyncerSession* session) { | 60 SyncerSession* session) { |
| 61 ProcessCommitResponse(session); |
| 62 if (!session->HadSuccessfulCommits()) |
| 63 extensions_monitor_->PutRecords(session->extensions_activity()); |
| 64 } |
| 65 |
| 66 void ProcessCommitResponseCommand::ProcessCommitResponse( |
| 67 SyncerSession* session) { |
60 // TODO(sync): This function returns if it sees problems. We probably want | 68 // TODO(sync): This function returns if it sees problems. We probably want |
61 // to flag the need for an update or similar. | 69 // to flag the need for an update or similar. |
62 ScopedDirLookup dir(session->dirman(), session->account_name()); | 70 ScopedDirLookup dir(session->dirman(), session->account_name()); |
63 if (!dir.good()) { | 71 if (!dir.good()) { |
64 LOG(ERROR) << "Scoped dir lookup failed!"; | 72 LOG(ERROR) << "Scoped dir lookup failed!"; |
65 return; | 73 return; |
66 } | 74 } |
67 const ClientToServerResponse& response = session->commit_response(); | 75 const ClientToServerResponse& response = session->commit_response(); |
68 const vector<syncable::Id>& commit_ids = session->commit_ids(); | 76 const vector<syncable::Id>& commit_ids = session->commit_ids(); |
69 | 77 |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 | 372 |
365 LOG(INFO) << "Server commit moved aside entry: " << old_name.db_value() | 373 LOG(INFO) << "Server commit moved aside entry: " << old_name.db_value() |
366 << " to new name " << db_name; | 374 << " to new name " << db_name; |
367 | 375 |
368 // Should be safe since we're in a "commit lock." | 376 // Should be safe since we're in a "commit lock." |
369 local_entry->PutName(Name::FromDBNameAndSyncName(db_name, server_name)); | 377 local_entry->PutName(Name::FromDBNameAndSyncName(db_name, server_name)); |
370 } | 378 } |
371 } | 379 } |
372 | 380 |
373 } // namespace browser_sync | 381 } // namespace browser_sync |
OLD | NEW |