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

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

Issue 1500803002: [Sync] Ensure all values of SyncProtocolErrorType are handled in ShouldRequestEarlyExit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows build Created 5 years 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
« no previous file with comments | « no previous file | sync/protocol/sync_protocol_error.h » ('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/sync_scheduler_impl.h" 5 #include "sync/engine/sync_scheduler_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 return false; 44 return false;
45 } 45 }
46 } 46 }
47 47
48 bool ShouldRequestEarlyExit(const SyncProtocolError& error) { 48 bool ShouldRequestEarlyExit(const SyncProtocolError& error) {
49 switch (error.error_type) { 49 switch (error.error_type) {
50 case SYNC_SUCCESS: 50 case SYNC_SUCCESS:
51 case MIGRATION_DONE: 51 case MIGRATION_DONE:
52 case THROTTLED: 52 case THROTTLED:
53 case TRANSIENT_ERROR: 53 case TRANSIENT_ERROR:
54 case PARTIAL_FAILURE:
54 return false; 55 return false;
55 case NOT_MY_BIRTHDAY: 56 case NOT_MY_BIRTHDAY:
56 case CLIENT_DATA_OBSOLETE: 57 case CLIENT_DATA_OBSOLETE:
57 case CLEAR_PENDING: 58 case CLEAR_PENDING:
58 case DISABLED_BY_ADMIN: 59 case DISABLED_BY_ADMIN:
59 case USER_ROLLBACK: 60 case USER_ROLLBACK:
60 // If we send terminate sync early then |sync_cycle_ended| notification 61 // If we send terminate sync early then |sync_cycle_ended| notification
61 // would not be sent. If there were no actions then |ACTIONABLE_ERROR| 62 // would not be sent. If there were no actions then |ACTIONABLE_ERROR|
62 // notification wouldnt be sent either. Then the UI layer would be left 63 // notification wouldnt be sent either. Then the UI layer would be left
63 // waiting forever. So assert we would send something. 64 // waiting forever. So assert we would send something.
64 DCHECK_NE(error.action, UNKNOWN_ACTION); 65 DCHECK_NE(error.action, UNKNOWN_ACTION);
65 return true; 66 return true;
66 case INVALID_CREDENTIAL: 67 case INVALID_CREDENTIAL:
67 // The notification for this is handled by PostAndProcessHeaders|. 68 // The notification for this is handled by PostAndProcessHeaders|.
68 // Server does no have to send any action for this. 69 // Server does no have to send any action for this.
69 return true; 70 return true;
70 // Make the default a NOTREACHED. So if a new error is introduced we 71 // Make UNKNOWN_ERROR a NOTREACHED. All the other error should be explicitly
71 // think about its expected functionality. 72 // handled.
72 default: 73 case UNKNOWN_ERROR:
73 NOTREACHED(); 74 NOTREACHED();
74 return false; 75 return false;
75 } 76 }
77 return false;
76 } 78 }
77 79
78 bool IsActionableError( 80 bool IsActionableError(
79 const SyncProtocolError& error) { 81 const SyncProtocolError& error) {
80 return (error.action != UNKNOWN_ACTION); 82 return (error.action != UNKNOWN_ACTION);
81 } 83 }
82 84
83 void RunAndReset(base::Closure* task) { 85 void RunAndReset(base::Closure* task) {
84 DCHECK(task); 86 DCHECK(task);
85 if (task->is_null()) 87 if (task->is_null())
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 981
980 #undef SDVLOG_LOC 982 #undef SDVLOG_LOC
981 983
982 #undef SDVLOG 984 #undef SDVLOG
983 985
984 #undef SLOG 986 #undef SLOG
985 987
986 #undef ENUM_CASE 988 #undef ENUM_CASE
987 989
988 } // namespace syncer 990 } // namespace syncer
OLDNEW
« no previous file with comments | « no previous file | sync/protocol/sync_protocol_error.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698