| OLD | NEW | 
|---|
|  | (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_NET_BLOB_CHANNEL_BLOB_CHANNEL_RECEIVER_H_ |  | 
| 6 #define BLIMP_NET_BLOB_CHANNEL_BLOB_CHANNEL_RECEIVER_H_ |  | 
| 7 |  | 
| 8 #include "base/macros.h" |  | 
| 9 #include "base/memory/ref_counted.h" |  | 
| 10 #include "base/synchronization/lock.h" |  | 
| 11 #include "blimp/common/blob_cache/blob_cache.h" |  | 
| 12 #include "blimp/net/blimp_message_processor.h" |  | 
| 13 #include "blimp/net/blimp_net_export.h" |  | 
| 14 |  | 
| 15 namespace blimp { |  | 
| 16 |  | 
| 17 class BlobCache; |  | 
| 18 |  | 
| 19 class BLIMP_NET_EXPORT BlobChannelReceiver { |  | 
| 20  public: |  | 
| 21   class Delegate { |  | 
| 22    public: |  | 
| 23     virtual ~Delegate() {} |  | 
| 24 |  | 
| 25     // Sets the Receiver object which will take incoming blobs. |  | 
| 26     virtual void SetReceiver(BlobChannelReceiver* receiver) = 0; |  | 
| 27   }; |  | 
| 28 |  | 
| 29   virtual ~BlobChannelReceiver() {} |  | 
| 30 |  | 
| 31   // Constructs a BlobChannelReceiverImpl object for use. |  | 
| 32   static std::unique_ptr<BlobChannelReceiver> Create( |  | 
| 33       std::unique_ptr<BlobCache> cache, |  | 
| 34       std::unique_ptr<Delegate> delegate); |  | 
| 35 |  | 
| 36   // Gets a blob from the BlobChannel. |  | 
| 37   // Returns nullptr if the blob is not available in the channel. |  | 
| 38   // Can be accessed concurrently from any thread. Calling code must ensure that |  | 
| 39   // the object instance outlives all calls to Get(). |  | 
| 40   virtual BlobDataPtr Get(const BlobId& id) = 0; |  | 
| 41 |  | 
| 42   // Called by Delegate::OnBlobReceived() when a blob arrives over the channel. |  | 
| 43   virtual void OnBlobReceived(const BlobId& id, BlobDataPtr data) = 0; |  | 
| 44 }; |  | 
| 45 |  | 
| 46 }  // namespace blimp |  | 
| 47 |  | 
| 48 #endif  // BLIMP_NET_BLOB_CHANNEL_BLOB_CHANNEL_RECEIVER_H_ |  | 
| OLD | NEW | 
|---|