| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 // SyncerSession holds the entire state of a single sync cycle; GetUpdates, | 5 // SyncerSession holds the entire state of a single sync cycle; GetUpdates, |
| 6 // Commit, and Conflict Resolution. After said cycle, the Session may contain | 6 // Commit, and Conflict Resolution. After said cycle, the Session may contain |
| 7 // items that were unable to be processed because of errors. | 7 // items that were unable to be processed because of errors. |
| 8 // | 8 // |
| 9 // THIS CLASS PROVIDES NO SYNCHRONIZATION GUARANTEES. | 9 // THIS CLASS PROVIDES NO SYNCHRONIZATION GUARANTEES. |
| 10 | 10 |
| 11 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_SESSION_H_ | 11 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_SESSION_H_ |
| 12 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_SESSION_H_ | 12 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_SESSION_H_ |
| 13 | 13 |
| 14 #include <utility> | 14 #include <utility> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/time.h" | 17 #include "base/time.h" |
| 18 #include "chrome/browser/sync/engine/net/server_connection_manager.h" | 18 #include "chrome/browser/sync/engine/net/server_connection_manager.h" |
| 19 #include "chrome/browser/sync/engine/sync_cycle_state.h" | 19 #include "chrome/browser/sync/engine/sync_cycle_state.h" |
| 20 #include "chrome/browser/sync/engine/sync_process_state.h" | 20 #include "chrome/browser/sync/engine/sync_process_state.h" |
| 21 #include "chrome/browser/sync/engine/syncer_status.h" | 21 #include "chrome/browser/sync/engine/syncer_status.h" |
| 22 #include "chrome/browser/sync/engine/syncer_types.h" | 22 #include "chrome/browser/sync/engine/syncer_types.h" |
| 23 #include "chrome/browser/sync/engine/syncproto.h" | 23 #include "chrome/browser/sync/engine/syncproto.h" |
| 24 #include "chrome/browser/sync/util/event_sys.h" | 24 #include "chrome/browser/sync/util/event_sys.h" |
| 25 #include "chrome/browser/sync/util/extensions_activity_monitor.h" | |
| 26 #include "chrome/browser/sync/util/sync_types.h" | 25 #include "chrome/browser/sync/util/sync_types.h" |
| 27 #include "testing/gtest/include/gtest/gtest_prod.h" // For FRIEND_TEST | 26 #include "testing/gtest/include/gtest/gtest_prod.h" // For FRIEND_TEST |
| 28 | 27 |
| 29 namespace browser_sync { | 28 namespace browser_sync { |
| 30 | 29 |
| 31 class ConflictResolver; | 30 class ConflictResolver; |
| 32 class ModelSafeWorker; | 31 class ModelSafeWorker; |
| 33 class ServerConnectionManager; | 32 class ServerConnectionManager; |
| 34 class SyncerStatus; | 33 class SyncerStatus; |
| 35 struct SyncerEvent; | 34 struct SyncerEvent; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 sync_pb::GetUpdatesCallerInfo::GET_UPDATES_SOURCE old_source = | 300 sync_pb::GetUpdatesCallerInfo::GET_UPDATES_SOURCE old_source = |
| 302 source_; | 301 source_; |
| 303 set_source(sync_pb::GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION); | 302 set_source(sync_pb::GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION); |
| 304 return old_source; | 303 return old_source; |
| 305 } | 304 } |
| 306 | 305 |
| 307 void set_source(sync_pb::GetUpdatesCallerInfo::GET_UPDATES_SOURCE source) { | 306 void set_source(sync_pb::GetUpdatesCallerInfo::GET_UPDATES_SOURCE source) { |
| 308 source_ = source; | 307 source_ = source; |
| 309 } | 308 } |
| 310 | 309 |
| 311 const ExtensionsActivityMonitor::Records& extensions_activity() const { | |
| 312 return extensions_activity_; | |
| 313 } | |
| 314 | |
| 315 ExtensionsActivityMonitor::Records* mutable_extensions_activity() { | |
| 316 return &extensions_activity_; | |
| 317 } | |
| 318 | |
| 319 bool notifications_enabled() const { | 310 bool notifications_enabled() const { |
| 320 return notifications_enabled_; | 311 return notifications_enabled_; |
| 321 } | 312 } |
| 322 | 313 |
| 323 void set_notifications_enabled(const bool state) { | 314 void set_notifications_enabled(const bool state) { |
| 324 notifications_enabled_ = state; | 315 notifications_enabled_ = state; |
| 325 } | 316 } |
| 326 | 317 |
| 327 void set_timestamp_dirty() { | 318 void set_timestamp_dirty() { |
| 328 sync_cycle_state_->set_timestamp_dirty(); | 319 sync_cycle_state_->set_timestamp_dirty(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 357 void ClearWriteTransaction() { | 348 void ClearWriteTransaction() { |
| 358 sync_cycle_state_->ClearWriteTransaction(); | 349 sync_cycle_state_->ClearWriteTransaction(); |
| 359 } | 350 } |
| 360 | 351 |
| 361 SyncProcessState* sync_process_state_; | 352 SyncProcessState* sync_process_state_; |
| 362 SyncCycleState* sync_cycle_state_; | 353 SyncCycleState* sync_cycle_state_; |
| 363 | 354 |
| 364 // The source for initiating this syncer session. | 355 // The source for initiating this syncer session. |
| 365 sync_pb::GetUpdatesCallerInfo::GET_UPDATES_SOURCE source_; | 356 sync_pb::GetUpdatesCallerInfo::GET_UPDATES_SOURCE source_; |
| 366 | 357 |
| 367 // Information about extensions activity since the last successful commit. | |
| 368 ExtensionsActivityMonitor::Records extensions_activity_; | |
| 369 | |
| 370 // True if notifications are enabled when this session was created. | 358 // True if notifications are enabled when this session was created. |
| 371 bool notifications_enabled_; | 359 bool notifications_enabled_; |
| 372 | 360 |
| 373 FRIEND_TEST(SyncerTest, TestCommitListOrderingCounterexample); | 361 FRIEND_TEST(SyncerTest, TestCommitListOrderingCounterexample); |
| 374 DISALLOW_COPY_AND_ASSIGN(SyncerSession); | 362 DISALLOW_COPY_AND_ASSIGN(SyncerSession); |
| 375 }; | 363 }; |
| 376 | 364 |
| 377 } // namespace browser_sync | 365 } // namespace browser_sync |
| 378 | 366 |
| 379 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_SESSION_H_ | 367 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_SESSION_H_ |
| OLD | NEW |