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

Side by Side Diff: blimp/helium/update_scheduler.h

Issue 2602103002: Delete blimp/helium and remove references to it from dependent targets (Closed)
Patch Set: . Created 3 years, 11 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
« no previous file with comments | « blimp/helium/transport.h ('k') | blimp/helium/update_scheduler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BLIMP_HELIUM_UPDATE_SCHEDULER_H_
6 #define BLIMP_HELIUM_UPDATE_SCHEDULER_H_
7
8 #include "base/callback.h"
9 #include "blimp/helium/blimp_helium_export.h"
10
11 namespace blimp {
12
13 namespace proto {
14 class HeliumMessage;
15 } // namespace proto
16
17 namespace helium {
18
19 class ObjectSyncState;
20 class StreamPump {
21 public:
22 virtual ~StreamPump() = default;
23
24 virtual void OnMessageAvailable() = 0;
25 };
26
27 // TODO(steimel): #include sync_manager.h instead once it's ready.
28 using HeliumObjectId = uint32_t;
29
30 // The UpdateScheduler is responsible for determining the next message to be
31 // sent on each Stream. This primarily means choosing a dirty object to pull the
32 // next Changeset from and generating acknowledgement messages for received
33 // Changesets.
34 class BLIMP_HELIUM_EXPORT UpdateScheduler {
35 public:
36 using MessagePreparedCallback = base::Callback<void(proto::HeliumMessage)>;
37
38 virtual ~UpdateScheduler() = default;
39
40 // Adds/Removes objects bound to the Stream for which this instance schedules
41 // updates. |object| should not be destroyed before calling RemoveObject().
42 virtual void AddObject(HeliumObjectId object_id, ObjectSyncState* object) = 0;
43 virtual void RemoveObject(HeliumObjectId object_id) = 0;
44
45 // Called by StreamPump to determine if the UpdateScheduler has data to send.
46 virtual bool HasMessageReady() const = 0;
47
48 // Called by StreamPump to request next HeliumMessage.
49 virtual void PrepareMessage(MessagePreparedCallback callback) = 0;
50
51 // Called by the ObjectSyncState when an object is updated locally.
52 // Note that this may be called (e.g. on Stream connection) when an object is
53 // first registered with the UpdateScheduler, to force it to check for pending
54 // changes.
55 virtual void OnLocalUpdate(HeliumObjectId object_id) = 0;
56
57 // Called by the ObjectSyncState when an object processes a Changeset, to
58 // schedule acknowledgement.
59 virtual void OnNeedsAck(HeliumObjectId object_id) = 0;
60
61 // Associates |pump| with this instance and informs each ObjectSyncState of
62 // the new connection. |pump| should not be destroyed before this instance.
63 virtual void OnStreamConnected(StreamPump* pump) = 0;
64
65 // Creates an UpdateScheduler instance.
66 static std::unique_ptr<UpdateScheduler> Create();
67 };
68
69 } // namespace helium
70 } // namespace blimp
71
72 #endif // BLIMP_HELIUM_UPDATE_SCHEDULER_H_
OLDNEW
« no previous file with comments | « blimp/helium/transport.h ('k') | blimp/helium/update_scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698