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

Side by Side Diff: chrome/browser/sync/glue/change_processor.h

Issue 10698014: [Sync] Rename csync namespace to syncer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 months 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 | Annotate | Revision Log
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 #ifndef CHROME_BROWSER_SYNC_GLUE_CHANGE_PROCESSOR_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_CHANGE_PROCESSOR_H_
6 #define CHROME_BROWSER_SYNC_GLUE_CHANGE_PROCESSOR_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_CHANGE_PROCESSOR_H_
7 #pragma once 7 #pragma once
8 8
9 #include "chrome/browser/sync/glue/data_type_error_handler.h" 9 #include "chrome/browser/sync/glue/data_type_error_handler.h"
10 #include "chrome/browser/sync/glue/sync_backend_host.h" 10 #include "chrome/browser/sync/glue/sync_backend_host.h"
11 #include "sync/internal_api/public/change_record.h" 11 #include "sync/internal_api/public/change_record.h"
12 12
13 class Profile; 13 class Profile;
14 14
15 namespace csync { 15 namespace syncer {
16 class UnrecoverableErrorHandler; 16 class UnrecoverableErrorHandler;
17 } // namespace csync 17 } // namespace syncer
18 18
19 namespace browser_sync { 19 namespace browser_sync {
20 20
21 class ModelAssociator; 21 class ModelAssociator;
22 22
23 // An interface used to apply changes from the sync model to the browser's 23 // An interface used to apply changes from the sync model to the browser's
24 // native model. This does not currently distinguish between model data types. 24 // native model. This does not currently distinguish between model data types.
25 class ChangeProcessor { 25 class ChangeProcessor {
26 public: 26 public:
27 explicit ChangeProcessor(DataTypeErrorHandler* error_handler); 27 explicit ChangeProcessor(DataTypeErrorHandler* error_handler);
28 virtual ~ChangeProcessor(); 28 virtual ~ChangeProcessor();
29 29
30 // Call when the processor should accept changes from either 30 // Call when the processor should accept changes from either
31 // provided model and apply them to the other. Both the chrome 31 // provided model and apply them to the other. Both the chrome
32 // model and sync_api are expected to be initialized and loaded. 32 // model and sync_api are expected to be initialized and loaded.
33 // You must have set a valid ModelAssociator and 33 // You must have set a valid ModelAssociator and
34 // UnrecoverableErrorHandler before using this method, and the two 34 // UnrecoverableErrorHandler before using this method, and the two
35 // models should be associated w.r.t the ModelAssociator provided. 35 // models should be associated w.r.t the ModelAssociator provided.
36 // It is safe to call Start again after previously Stop()ing the 36 // It is safe to call Start again after previously Stop()ing the
37 // processor. Subclasses can extract their associated chrome model 37 // processor. Subclasses can extract their associated chrome model
38 // from |profile| in |StartImpl|. 38 // from |profile| in |StartImpl|.
39 void Start(Profile* profile, csync::UserShare* share_handle); 39 void Start(Profile* profile, syncer::UserShare* share_handle);
40 void Stop(); 40 void Stop();
41 virtual bool IsRunning() const; 41 virtual bool IsRunning() const;
42 42
43 // Changes have been applied to the backend model and are ready to be 43 // Changes have been applied to the backend model and are ready to be
44 // applied to the frontend model. See syncapi.h for detailed instructions on 44 // applied to the frontend model. See syncapi.h for detailed instructions on
45 // how to interpret and process |changes|. 45 // how to interpret and process |changes|.
46 virtual void ApplyChangesFromSyncModel( 46 virtual void ApplyChangesFromSyncModel(
47 const csync::BaseTransaction* trans, 47 const syncer::BaseTransaction* trans,
48 const csync::ImmutableChangeRecordList& changes) = 0; 48 const syncer::ImmutableChangeRecordList& changes) = 0;
49 49
50 // The changes found in ApplyChangesFromSyncModel may be too slow to be 50 // The changes found in ApplyChangesFromSyncModel may be too slow to be
51 // performed while holding a [Read/Write]Transaction lock or may interact 51 // performed while holding a [Read/Write]Transaction lock or may interact
52 // with another thread, which might itself be waiting on the transaction lock, 52 // with another thread, which might itself be waiting on the transaction lock,
53 // putting us at risk of deadlock. 53 // putting us at risk of deadlock.
54 // This function is called once the transactional lock is released and it is 54 // This function is called once the transactional lock is released and it is
55 // safe to perform inter-thread or slow I/O operations. Note that not all 55 // safe to perform inter-thread or slow I/O operations. Note that not all
56 // datatypes need this, so we provide an empty default version. 56 // datatypes need this, so we provide an empty default version.
57 virtual void CommitChangesFromSyncModel(); 57 virtual void CommitChangesFromSyncModel();
58 58
(...skipping 16 matching lines...) Expand all
75 }; 75 };
76 76
77 protected: 77 protected:
78 // These methods are invoked by Start() and Stop() to do 78 // These methods are invoked by Start() and Stop() to do
79 // implementation-specific work. 79 // implementation-specific work.
80 virtual void StartImpl(Profile* profile) = 0; 80 virtual void StartImpl(Profile* profile) = 0;
81 virtual void StopImpl() = 0; 81 virtual void StopImpl() = 0;
82 82
83 bool running() const { return running_; } 83 bool running() const { return running_; }
84 DataTypeErrorHandler* error_handler() const; 84 DataTypeErrorHandler* error_handler() const;
85 virtual csync::UserShare* share_handle() const; 85 virtual syncer::UserShare* share_handle() const;
86 86
87 private: 87 private:
88 bool running_; // True if we have been told it is safe to process changes. 88 bool running_; // True if we have been told it is safe to process changes.
89 DataTypeErrorHandler* error_handler_; // Guaranteed to outlive us. 89 DataTypeErrorHandler* error_handler_; // Guaranteed to outlive us.
90 90
91 // The sync model we are processing changes from. Non-NULL when |running_| is 91 // The sync model we are processing changes from. Non-NULL when |running_| is
92 // true. 92 // true.
93 csync::UserShare* share_handle_; 93 syncer::UserShare* share_handle_;
94 94
95 DISALLOW_COPY_AND_ASSIGN(ChangeProcessor); 95 DISALLOW_COPY_AND_ASSIGN(ChangeProcessor);
96 }; 96 };
97 97
98 } // namespace browser_sync 98 } // namespace browser_sync
99 99
100 #endif // CHROME_BROWSER_SYNC_GLUE_CHANGE_PROCESSOR_H_ 100 #endif // CHROME_BROWSER_SYNC_GLUE_CHANGE_PROCESSOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/browser_thread_model_worker_unittest.cc ('k') | chrome/browser/sync/glue/change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698