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

Side by Side Diff: blimp/net/blob_channel/blob_channel_sender.h

Issue 1985863002: Incorporate BlobChannel into Blimp image encode/decode pipeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blobchannel-helium
Patch Set: fix gn dependency warning & rebase Created 4 years, 6 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 2016 The Chromium Authors. All rights reserved. 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 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 BLIMP_NET_BLOB_CHANNEL_BLOB_CHANNEL_SENDER_H_ 5 #ifndef BLIMP_NET_BLOB_CHANNEL_BLOB_CHANNEL_SENDER_H_
6 #define BLIMP_NET_BLOB_CHANNEL_BLOB_CHANNEL_SENDER_H_ 6 #define BLIMP_NET_BLOB_CHANNEL_BLOB_CHANNEL_SENDER_H_
7 7
8 #include <memory>
9 #include <set>
10 #include <string>
11
12 #include "base/macros.h"
13 #include "base/threading/thread_checker.h"
14 #include "blimp/common/blob_cache/blob_cache.h" 8 #include "blimp/common/blob_cache/blob_cache.h"
15 #include "blimp/net/blimp_net_export.h" 9 #include "blimp/net/blimp_net_export.h"
16 10
17 namespace blimp { 11 namespace blimp {
18 12
19 // Sends blobs to a remote receiver.
20 // The transport-specific details are provided by the caller using the Delegate
21 // subclass.
22 class BLIMP_NET_EXPORT BlobChannelSender { 13 class BLIMP_NET_EXPORT BlobChannelSender {
23 public: 14 public:
24 // Delegate interface for transport-specific implementations of blob transfer 15 virtual ~BlobChannelSender() {}
25 // commands.
26 class Delegate {
27 public:
28 virtual ~Delegate() {}
29
30 // Send blob |id| with payload |data| to the receiver.
31 virtual void DeliverBlob(const BlobId& id, BlobDataPtr data) = 0;
32 };
33
34 BlobChannelSender(std::unique_ptr<BlobCache> cache,
35 std::unique_ptr<Delegate> delegate);
36 ~BlobChannelSender();
37 16
38 // Puts a blob in the local BlobChannel. The blob can then be pushed to the 17 // Puts a blob in the local BlobChannel. The blob can then be pushed to the
39 // remote receiver via "DeliverBlob()". 18 // remote receiver via "DeliverBlob()".
40 // Does nothing if there is already a blob |id| in the channel. 19 // Does nothing if there is already a blob |id| in the channel.
41 void PutBlob(const BlobId& id, BlobDataPtr data); 20 virtual void PutBlob(const BlobId& id, BlobDataPtr data) = 0;
42 21
43 // Sends the blob |id| to the remote side, if the remote side doesn't already 22 // Sends the blob |id| to the remote side, if the remote side doesn't already
44 // have the blob. 23 // have the blob.
45 void DeliverBlob(const BlobId& id); 24 virtual void DeliverBlob(const BlobId& id) = 0;
46
47 private:
48 std::unique_ptr<BlobCache> cache_;
49 std::unique_ptr<Delegate> delegate_;
50
51 // Used to track the item IDs in the receiver's cache. This may differ from
52 // the set of IDs in |cache_|, for instance if an ID hasn't yet been
53 // delivered, or has been evicted at the receiver.
54 std::set<BlobId> receiver_cache_contents_;
55
56 DISALLOW_COPY_AND_ASSIGN(BlobChannelSender);
57 }; 25 };
58 26
59 } // namespace blimp 27 } // namespace blimp
60 28
61 #endif // BLIMP_NET_BLOB_CHANNEL_BLOB_CHANNEL_SENDER_H_ 29 #endif // BLIMP_NET_BLOB_CHANNEL_BLOB_CHANNEL_SENDER_H_
OLDNEW
« no previous file with comments | « blimp/net/blob_channel/blob_channel_receiver.cc ('k') | blimp/net/blob_channel/blob_channel_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698