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