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_ENGINE_RENDERER_BLOB_CHANNEL_SENDER_PROXY_H_ |
| 6 #define BLIMP_ENGINE_RENDERER_BLOB_CHANNEL_SENDER_PROXY_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 |
| 11 #include "base/containers/hash_tables.h" |
| 12 #include "blimp/common/blimp_common_export.h" |
| 13 #include "blimp/engine/mojo/blob_channel.mojom.h" |
| 14 #include "blimp/net/blob_channel/blob_channel_sender.h" |
| 15 |
| 16 namespace blimp { |
| 17 namespace engine { |
| 18 |
| 19 // Class for sending blobs (e.g. images) from the renderer to the browser |
| 20 // process. |
| 21 class BLIMP_COMMON_EXPORT BlobChannelSenderProxy : public BlobChannelSender { |
| 22 public: |
| 23 BlobChannelSenderProxy(); |
| 24 ~BlobChannelSenderProxy() override; |
| 25 |
| 26 // Returns true if the blob is known to exist within the Engine cache. |
| 27 bool IsInEngineCache(const std::string& id) const; |
| 28 |
| 29 // Returns true if the blob has been delivered to the Client cache. |
| 30 bool IsInClientCache(const std::string& id) const; |
| 31 |
| 32 // BlobChannelSender implementation. |
| 33 void PutBlob(const BlobId& id, BlobDataPtr data) override; |
| 34 void DeliverBlob(const BlobId& id) override; |
| 35 |
| 36 private: |
| 37 // BlobChannel Mojo IPC stub, used for delivering blobs to the browser |
| 38 // process. |
| 39 mojom::BlobChannelPtr blob_channel_; |
| 40 |
| 41 // Local copy of the cache state for the local and remote BlobChannel. |
| 42 // Knowledge of the cache state enables callers to avoid unnecessary |
| 43 // image encoding and transferral if the content is already in the system. |
| 44 base::hash_map<std::string, bool> replication_state_; |
| 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(BlobChannelSenderProxy); |
| 47 }; |
| 48 |
| 49 } // namespace engine |
| 50 } // namespace blimp |
| 51 |
| 52 #endif // BLIMP_ENGINE_RENDERER_BLOB_CHANNEL_SENDER_PROXY_H_ |
OLD | NEW |