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

Side by Side Diff: sync/engine/get_updates_delegate.h

Issue 1866243002: Convert //sync from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 SYNC_ENGINE_GET_UPDATES_DELEGATE_H_ 5 #ifndef SYNC_ENGINE_GET_UPDATES_DELEGATE_H_
6 #define SYNC_ENGINE_GET_UPDATES_DELEGATE_H_ 6 #define SYNC_ENGINE_GET_UPDATES_DELEGATE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
Nicolas Zea 2016/04/07 21:48:58 Include memory?
9 #include "sync/internal_api/public/events/protocol_event.h" 9 #include "sync/internal_api/public/events/protocol_event.h"
10 #include "sync/protocol/sync.pb.h" 10 #include "sync/protocol/sync.pb.h"
11 #include "sync/sessions/model_type_registry.h" 11 #include "sync/sessions/model_type_registry.h"
12 #include "sync/sessions/nudge_tracker.h" 12 #include "sync/sessions/nudge_tracker.h"
13 #include "sync/sessions/status_controller.h" 13 #include "sync/sessions/status_controller.h"
14 14
15 namespace syncer { 15 namespace syncer {
16 16
17 class GetUpdatesProcessor; 17 class GetUpdatesProcessor;
18 18
19 // Interface for GetUpdates functionality that dependends on the requested 19 // Interface for GetUpdates functionality that dependends on the requested
20 // GetUpdate type (normal, configuration, poll). The GetUpdatesProcessor is 20 // GetUpdate type (normal, configuration, poll). The GetUpdatesProcessor is
21 // given an appropriate GetUpdatesDelegate to handle type specific functionality 21 // given an appropriate GetUpdatesDelegate to handle type specific functionality
22 // on construction. 22 // on construction.
23 class SYNC_EXPORT GetUpdatesDelegate { 23 class SYNC_EXPORT GetUpdatesDelegate {
24 public: 24 public:
25 GetUpdatesDelegate(); 25 GetUpdatesDelegate();
26 virtual ~GetUpdatesDelegate() = 0; 26 virtual ~GetUpdatesDelegate() = 0;
27 27
28 // Populates GetUpdate message fields that depende on GetUpdates request type. 28 // Populates GetUpdate message fields that depende on GetUpdates request type.
29 virtual void HelpPopulateGuMessage( 29 virtual void HelpPopulateGuMessage(
30 sync_pb::GetUpdatesMessage* get_updates) const = 0; 30 sync_pb::GetUpdatesMessage* get_updates) const = 0;
31 31
32 // Applies pending updates to non-control types. 32 // Applies pending updates to non-control types.
33 virtual void ApplyUpdates( 33 virtual void ApplyUpdates(
34 ModelTypeSet gu_types, 34 ModelTypeSet gu_types,
35 sessions::StatusController* status, 35 sessions::StatusController* status,
36 UpdateHandlerMap* update_handler_map) const = 0; 36 UpdateHandlerMap* update_handler_map) const = 0;
37 37
38 virtual scoped_ptr<ProtocolEvent> GetNetworkRequestEvent( 38 virtual std::unique_ptr<ProtocolEvent> GetNetworkRequestEvent(
39 base::Time timestamp, 39 base::Time timestamp,
40 const sync_pb::ClientToServerMessage& request) const = 0; 40 const sync_pb::ClientToServerMessage& request) const = 0;
41 }; 41 };
42 42
43 // Functionality specific to the normal GetUpdate request. 43 // Functionality specific to the normal GetUpdate request.
44 class SYNC_EXPORT NormalGetUpdatesDelegate : public GetUpdatesDelegate { 44 class SYNC_EXPORT NormalGetUpdatesDelegate : public GetUpdatesDelegate {
45 public: 45 public:
46 explicit NormalGetUpdatesDelegate( 46 explicit NormalGetUpdatesDelegate(
47 const sessions::NudgeTracker& nudge_tracker); 47 const sessions::NudgeTracker& nudge_tracker);
48 ~NormalGetUpdatesDelegate() override; 48 ~NormalGetUpdatesDelegate() override;
49 49
50 // Uses the member NudgeTracker to populate some fields of this GU message. 50 // Uses the member NudgeTracker to populate some fields of this GU message.
51 void HelpPopulateGuMessage( 51 void HelpPopulateGuMessage(
52 sync_pb::GetUpdatesMessage* get_updates) const override; 52 sync_pb::GetUpdatesMessage* get_updates) const override;
53 53
54 // Applies pending updates on the appropriate data type threads. 54 // Applies pending updates on the appropriate data type threads.
55 void ApplyUpdates(ModelTypeSet gu_types, 55 void ApplyUpdates(ModelTypeSet gu_types,
56 sessions::StatusController* status, 56 sessions::StatusController* status,
57 UpdateHandlerMap* update_handler_map) const override; 57 UpdateHandlerMap* update_handler_map) const override;
58 58
59 scoped_ptr<ProtocolEvent> GetNetworkRequestEvent( 59 std::unique_ptr<ProtocolEvent> GetNetworkRequestEvent(
60 base::Time timestamp, 60 base::Time timestamp,
61 const sync_pb::ClientToServerMessage& request) const override; 61 const sync_pb::ClientToServerMessage& request) const override;
62 62
63 private: 63 private:
64 const sessions::NudgeTracker& nudge_tracker_; 64 const sessions::NudgeTracker& nudge_tracker_;
65 65
66 DISALLOW_COPY_AND_ASSIGN(NormalGetUpdatesDelegate); 66 DISALLOW_COPY_AND_ASSIGN(NormalGetUpdatesDelegate);
67 }; 67 };
68 68
69 // Functionality specific to the configure GetUpdate request. 69 // Functionality specific to the configure GetUpdate request.
70 class SYNC_EXPORT ConfigureGetUpdatesDelegate : public GetUpdatesDelegate { 70 class SYNC_EXPORT ConfigureGetUpdatesDelegate : public GetUpdatesDelegate {
71 public: 71 public:
72 ConfigureGetUpdatesDelegate( 72 ConfigureGetUpdatesDelegate(
73 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); 73 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source);
74 ~ConfigureGetUpdatesDelegate() override; 74 ~ConfigureGetUpdatesDelegate() override;
75 75
76 // Sets the 'source' and 'origin' fields for this request. 76 // Sets the 'source' and 'origin' fields for this request.
77 void HelpPopulateGuMessage( 77 void HelpPopulateGuMessage(
78 sync_pb::GetUpdatesMessage* get_updates) const override; 78 sync_pb::GetUpdatesMessage* get_updates) const override;
79 79
80 // Applies updates passively (ie. on the sync thread). 80 // Applies updates passively (ie. on the sync thread).
81 // 81 //
82 // This is safe only if the ChangeProcessor is not listening to changes at 82 // This is safe only if the ChangeProcessor is not listening to changes at
83 // this time. 83 // this time.
84 void ApplyUpdates(ModelTypeSet gu_types, 84 void ApplyUpdates(ModelTypeSet gu_types,
85 sessions::StatusController* status, 85 sessions::StatusController* status,
86 UpdateHandlerMap* update_handler_map) const override; 86 UpdateHandlerMap* update_handler_map) const override;
87 87
88 scoped_ptr<ProtocolEvent> GetNetworkRequestEvent( 88 std::unique_ptr<ProtocolEvent> GetNetworkRequestEvent(
89 base::Time timestamp, 89 base::Time timestamp,
90 const sync_pb::ClientToServerMessage& request) const override; 90 const sync_pb::ClientToServerMessage& request) const override;
91 91
92 private: 92 private:
93 static sync_pb::SyncEnums::GetUpdatesOrigin ConvertConfigureSourceToOrigin( 93 static sync_pb::SyncEnums::GetUpdatesOrigin ConvertConfigureSourceToOrigin(
94 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); 94 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source);
95 95
96 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source_; 96 const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(ConfigureGetUpdatesDelegate); 98 DISALLOW_COPY_AND_ASSIGN(ConfigureGetUpdatesDelegate);
99 }; 99 };
100 100
101 // Functionality specific to the poll GetUpdate request. 101 // Functionality specific to the poll GetUpdate request.
102 class SYNC_EXPORT PollGetUpdatesDelegate : public GetUpdatesDelegate { 102 class SYNC_EXPORT PollGetUpdatesDelegate : public GetUpdatesDelegate {
103 public: 103 public:
104 PollGetUpdatesDelegate(); 104 PollGetUpdatesDelegate();
105 ~PollGetUpdatesDelegate() override; 105 ~PollGetUpdatesDelegate() override;
106 106
107 // Sets the 'source' and 'origin' to indicate this is a poll request. 107 // Sets the 'source' and 'origin' to indicate this is a poll request.
108 void HelpPopulateGuMessage( 108 void HelpPopulateGuMessage(
109 sync_pb::GetUpdatesMessage* get_updates) const override; 109 sync_pb::GetUpdatesMessage* get_updates) const override;
110 110
111 // Applies updates on the appropriate data type thread. 111 // Applies updates on the appropriate data type thread.
112 void ApplyUpdates(ModelTypeSet gu_types, 112 void ApplyUpdates(ModelTypeSet gu_types,
113 sessions::StatusController* status, 113 sessions::StatusController* status,
114 UpdateHandlerMap* update_handler_map) const override; 114 UpdateHandlerMap* update_handler_map) const override;
115 115
116 scoped_ptr<ProtocolEvent> GetNetworkRequestEvent( 116 std::unique_ptr<ProtocolEvent> GetNetworkRequestEvent(
117 base::Time timestamp, 117 base::Time timestamp,
118 const sync_pb::ClientToServerMessage& request) const override; 118 const sync_pb::ClientToServerMessage& request) const override;
119 119
120 private: 120 private:
121 DISALLOW_COPY_AND_ASSIGN(PollGetUpdatesDelegate); 121 DISALLOW_COPY_AND_ASSIGN(PollGetUpdatesDelegate);
122 }; 122 };
123 123
124 } // namespace syncer 124 } // namespace syncer
125 125
126 #endif // SYNC_ENGINE_GET_UPDATES_DELEGATE_H_ 126 #endif // SYNC_ENGINE_GET_UPDATES_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698