| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef COMPONENTS_SYNC_SYNCABLE_DIRECTORY_H_ | 5 #ifndef COMPONENTS_SYNC_SYNCABLE_DIRECTORY_H_ |
| 6 #define COMPONENTS_SYNC_SYNCABLE_DIRECTORY_H_ | 6 #define COMPONENTS_SYNC_SYNCABLE_DIRECTORY_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "base/values.h" | 23 #include "base/values.h" |
| 24 #include "components/sync/base/weak_handle.h" | 24 #include "components/sync/base/weak_handle.h" |
| 25 #include "components/sync/model/attachments/attachment_id.h" | 25 #include "components/sync/model/attachments/attachment_id.h" |
| 26 #include "components/sync/syncable/dir_open_result.h" | 26 #include "components/sync/syncable/dir_open_result.h" |
| 27 #include "components/sync/syncable/entry.h" | 27 #include "components/sync/syncable/entry.h" |
| 28 #include "components/sync/syncable/entry_kernel.h" | 28 #include "components/sync/syncable/entry_kernel.h" |
| 29 #include "components/sync/syncable/metahandle_set.h" | 29 #include "components/sync/syncable/metahandle_set.h" |
| 30 #include "components/sync/syncable/parent_child_index.h" | 30 #include "components/sync/syncable/parent_child_index.h" |
| 31 #include "components/sync/syncable/syncable_delete_journal.h" | 31 #include "components/sync/syncable/syncable_delete_journal.h" |
| 32 | 32 |
| 33 namespace base { |
| 34 namespace trace_event { |
| 35 class ProcessMemoryDump; |
| 36 } |
| 37 } |
| 38 |
| 33 namespace syncer { | 39 namespace syncer { |
| 34 | 40 |
| 35 class Cryptographer; | 41 class Cryptographer; |
| 36 class TestUserShare; | 42 class TestUserShare; |
| 37 class UnrecoverableErrorHandler; | 43 class UnrecoverableErrorHandler; |
| 38 | 44 |
| 39 namespace syncable { | 45 namespace syncable { |
| 40 | 46 |
| 41 class BaseTransaction; | 47 class BaseTransaction; |
| 42 class BaseWriteTransaction; | 48 class BaseWriteTransaction; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 ~PersistedKernelInfo(); | 94 ~PersistedKernelInfo(); |
| 89 | 95 |
| 90 // Set the |download_progress| entry for the given model to a | 96 // Set the |download_progress| entry for the given model to a |
| 91 // "first sync" start point. When such a value is sent to the server, | 97 // "first sync" start point. When such a value is sent to the server, |
| 92 // a full download of all objects of the model will be initiated. | 98 // a full download of all objects of the model will be initiated. |
| 93 void ResetDownloadProgress(ModelType model_type); | 99 void ResetDownloadProgress(ModelType model_type); |
| 94 | 100 |
| 95 // Whether a valid progress marker exists for |model_type|. | 101 // Whether a valid progress marker exists for |model_type|. |
| 96 bool HasEmptyDownloadProgress(ModelType model_type); | 102 bool HasEmptyDownloadProgress(ModelType model_type); |
| 97 | 103 |
| 104 size_t EstimateMemoryUsage() const; |
| 105 |
| 98 // Last sync timestamp fetched from the server. | 106 // Last sync timestamp fetched from the server. |
| 99 sync_pb::DataTypeProgressMarker download_progress[MODEL_TYPE_COUNT]; | 107 sync_pb::DataTypeProgressMarker download_progress[MODEL_TYPE_COUNT]; |
| 100 // Sync-side transaction version per data type. Monotonically incremented | 108 // Sync-side transaction version per data type. Monotonically incremented |
| 101 // when updating native model. A copy is also saved in native model. | 109 // when updating native model. A copy is also saved in native model. |
| 102 // Later out-of-sync models can be detected and fixed by comparing | 110 // Later out-of-sync models can be detected and fixed by comparing |
| 103 // transaction versions of sync model and native model. | 111 // transaction versions of sync model and native model. |
| 104 // TODO(hatiaol): implement detection and fixing of out-of-sync models. | 112 // TODO(hatiaol): implement detection and fixing of out-of-sync models. |
| 105 // Bug 154858. | 113 // Bug 154858. |
| 106 int64_t transaction_version[MODEL_TYPE_COUNT]; | 114 int64_t transaction_version[MODEL_TYPE_COUNT]; |
| 107 // The store birthday we were given by the server. Contents are opaque to | 115 // The store birthday we were given by the server. Contents are opaque to |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 sync_pb::DataTypeProgressMarker* value_out) const; | 282 sync_pb::DataTypeProgressMarker* value_out) const; |
| 275 void GetDownloadProgressAsString(ModelType type, | 283 void GetDownloadProgressAsString(ModelType type, |
| 276 std::string* value_out) const; | 284 std::string* value_out) const; |
| 277 void SetDownloadProgress(ModelType type, | 285 void SetDownloadProgress(ModelType type, |
| 278 const sync_pb::DataTypeProgressMarker& value); | 286 const sync_pb::DataTypeProgressMarker& value); |
| 279 bool HasEmptyDownloadProgress(ModelType type) const; | 287 bool HasEmptyDownloadProgress(ModelType type) const; |
| 280 | 288 |
| 281 // Gets the total number of entries in the directory. | 289 // Gets the total number of entries in the directory. |
| 282 size_t GetEntriesCount() const; | 290 size_t GetEntriesCount() const; |
| 283 | 291 |
| 292 // Adds memory statistics to |pmd| for chrome://tracing. |
| 293 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd); |
| 294 |
| 284 // Gets/Increments transaction version of a model type. Must be called when | 295 // Gets/Increments transaction version of a model type. Must be called when |
| 285 // holding kernel mutex. | 296 // holding kernel mutex. |
| 286 int64_t GetTransactionVersion(ModelType type) const; | 297 int64_t GetTransactionVersion(ModelType type) const; |
| 287 void IncrementTransactionVersion(ModelType type); | 298 void IncrementTransactionVersion(ModelType type); |
| 288 | 299 |
| 289 // Getter/setters for the per datatype context. | 300 // Getter/setters for the per datatype context. |
| 290 void GetDataTypeContext(BaseTransaction* trans, | 301 void GetDataTypeContext(BaseTransaction* trans, |
| 291 ModelType type, | 302 ModelType type, |
| 292 sync_pb::DataTypeContext* context) const; | 303 sync_pb::DataTypeContext* context) const; |
| 293 void SetDataTypeContext(BaseWriteTransaction* trans, | 304 void SetDataTypeContext(BaseWriteTransaction* trans, |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 | 663 |
| 653 base::WeakPtrFactory<Directory> weak_ptr_factory_; | 664 base::WeakPtrFactory<Directory> weak_ptr_factory_; |
| 654 | 665 |
| 655 DISALLOW_COPY_AND_ASSIGN(Directory); | 666 DISALLOW_COPY_AND_ASSIGN(Directory); |
| 656 }; | 667 }; |
| 657 | 668 |
| 658 } // namespace syncable | 669 } // namespace syncable |
| 659 } // namespace syncer | 670 } // namespace syncer |
| 660 | 671 |
| 661 #endif // COMPONENTS_SYNC_SYNCABLE_DIRECTORY_H_ | 672 #endif // COMPONENTS_SYNC_SYNCABLE_DIRECTORY_H_ |
| OLD | NEW |