| OLD | NEW |
| 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 <vector> |
| 9 |
| 8 #include "blimp/common/blob_cache/blob_cache.h" | 10 #include "blimp/common/blob_cache/blob_cache.h" |
| 9 #include "blimp/net/blimp_net_export.h" | 11 #include "blimp/net/blimp_net_export.h" |
| 10 | 12 |
| 11 namespace blimp { | 13 namespace blimp { |
| 12 | 14 |
| 13 // Blob size upper limit, for abuse prevention. | 15 // Blob size upper limit, for abuse prevention. |
| 14 const size_t kMaxBlobSizeBytes = 10 * 1024 * 1024; | 16 const size_t kMaxBlobSizeBytes = 10 * 1024 * 1024; |
| 15 | 17 |
| 16 class BLIMP_NET_EXPORT BlobChannelSender { | 18 class BLIMP_NET_EXPORT BlobChannelSender { |
| 17 public: | 19 public: |
| 20 struct CacheStateEntry { |
| 21 BlobId id; |
| 22 bool was_delivered; |
| 23 }; |
| 24 |
| 18 virtual ~BlobChannelSender() {} | 25 virtual ~BlobChannelSender() {} |
| 19 | 26 |
| 27 // Gets the list of cache keys and their replication status in the BlobCache. |
| 28 virtual std::vector<CacheStateEntry> GetCachedBlobIds() const = 0; |
| 29 |
| 20 // Puts a blob in the local BlobChannel. The blob can then be pushed to the | 30 // Puts a blob in the local BlobChannel. The blob can then be pushed to the |
| 21 // remote receiver via "DeliverBlob()". | 31 // remote receiver via "DeliverBlob()". |
| 22 // Does nothing if there is already a blob |id| in the channel. | 32 // Does nothing if there is already a blob |id| in the channel. |
| 23 virtual void PutBlob(const BlobId& id, BlobDataPtr data) = 0; | 33 virtual void PutBlob(const BlobId& id, BlobDataPtr data) = 0; |
| 24 | 34 |
| 25 // Sends the blob |id| to the remote side, if the remote side doesn't already | 35 // Sends the blob |id| to the remote side, if the remote side doesn't already |
| 26 // have the blob. | 36 // have the blob. |
| 27 virtual void DeliverBlob(const BlobId& id) = 0; | 37 virtual void DeliverBlob(const BlobId& id) = 0; |
| 28 }; | 38 }; |
| 29 | 39 |
| 30 } // namespace blimp | 40 } // namespace blimp |
| 31 | 41 |
| 32 #endif // BLIMP_NET_BLOB_CHANNEL_BLOB_CHANNEL_SENDER_H_ | 42 #endif // BLIMP_NET_BLOB_CHANNEL_BLOB_CHANNEL_SENDER_H_ |
| OLD | NEW |