| OLD | NEW |
| 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 "chrome/browser/sync/syncable/syncable.h" | 5 #include "chrome/browser/sync/syncable/syncable.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <functional> | 9 #include <functional> |
| 10 #include <iomanip> | 10 #include <iomanip> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "chrome/browser/sync/syncable/syncable-inl.h" | 38 #include "chrome/browser/sync/syncable/syncable-inl.h" |
| 39 #include "chrome/browser/sync/syncable/syncable_changes_version.h" | 39 #include "chrome/browser/sync/syncable/syncable_changes_version.h" |
| 40 #include "chrome/browser/sync/syncable/syncable_columns.h" | 40 #include "chrome/browser/sync/syncable/syncable_columns.h" |
| 41 #include "chrome/browser/sync/syncable/syncable_enum_conversions.h" | 41 #include "chrome/browser/sync/syncable/syncable_enum_conversions.h" |
| 42 #include "chrome/browser/sync/syncable/transaction_observer.h" | 42 #include "chrome/browser/sync/syncable/transaction_observer.h" |
| 43 #include "chrome/browser/sync/util/logging.h" | 43 #include "chrome/browser/sync/util/logging.h" |
| 44 #include "chrome/common/chrome_constants.h" | 44 #include "chrome/common/chrome_constants.h" |
| 45 #include "net/base/escape.h" | 45 #include "net/base/escape.h" |
| 46 | 46 |
| 47 namespace { | 47 namespace { |
| 48 |
| 48 enum InvariantCheckLevel { | 49 enum InvariantCheckLevel { |
| 49 OFF = 0, | 50 OFF = 0, |
| 50 VERIFY_IN_MEMORY = 1, | 51 VERIFY_IN_MEMORY = 1, |
| 51 FULL_DB_VERIFICATION = 2 | 52 FULL_DB_VERIFICATION = 2 |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 static const InvariantCheckLevel kInvariantCheckLevel = VERIFY_IN_MEMORY; | 55 const InvariantCheckLevel kInvariantCheckLevel = VERIFY_IN_MEMORY; |
| 55 | 56 |
| 56 // Max number of milliseconds to spend checking syncable entry invariants | 57 // Max number of milliseconds to spend checking syncable entry invariants |
| 57 static const int kInvariantCheckMaxMs = 50; | 58 const int kInvariantCheckMaxMs = 50; |
| 58 | 59 |
| 59 // This function checks to see if the given list of Metahandles has any nodes | 60 // This function checks to see if the given list of Metahandles has any nodes |
| 60 // whose PREV_ID, PARENT_ID or NEXT_ID values refer to ID values that do not | 61 // whose PREV_ID, PARENT_ID or NEXT_ID values refer to ID values that do not |
| 61 // actually exist. Returns true on success. | 62 // actually exist. Returns true on success. |
| 62 // | 63 // |
| 63 // This function is "Unsafe" because it does not attempt to acquire any locks | 64 // This function is "Unsafe" because it does not attempt to acquire any locks |
| 64 // that may be protecting this list that gets passed in. The caller is | 65 // that may be protecting this list that gets passed in. The caller is |
| 65 // responsible for ensuring that no one modifies this list while the function is | 66 // responsible for ensuring that no one modifies this list while the function is |
| 66 // running. | 67 // running. |
| 67 bool VerifyReferenceIntegrityUnsafe(const syncable::MetahandlesIndex &index) { | 68 bool VerifyReferenceIntegrityUnsafe(const syncable::MetahandlesIndex &index) { |
| (...skipping 2309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2377 if (entry->ref(NEXT_ID).IsRoot() || | 2378 if (entry->ref(NEXT_ID).IsRoot() || |
| 2378 entry->ref(NEXT_ID) != entry->ref(PREV_ID)) { | 2379 entry->ref(NEXT_ID) != entry->ref(PREV_ID)) { |
| 2379 return entry; | 2380 return entry; |
| 2380 } | 2381 } |
| 2381 } | 2382 } |
| 2382 // There were no children in the linked list. | 2383 // There were no children in the linked list. |
| 2383 return NULL; | 2384 return NULL; |
| 2384 } | 2385 } |
| 2385 | 2386 |
| 2386 } // namespace syncable | 2387 } // namespace syncable |
| OLD | NEW |