Index: blimp/engine/renderer/blob_channel_sender_proxy.h |
diff --git a/blimp/engine/renderer/blob_channel_sender_proxy.h b/blimp/engine/renderer/blob_channel_sender_proxy.h |
index e219ef06c35e7ff5fda51bed6f00343a4bd8ceb7..98b118ed6db90c861148b08dbff432d8576cc84b 100644 |
--- a/blimp/engine/renderer/blob_channel_sender_proxy.h |
+++ b/blimp/engine/renderer/blob_channel_sender_proxy.h |
@@ -7,8 +7,10 @@ |
#include <memory> |
#include <string> |
+#include <vector> |
#include "base/containers/hash_tables.h" |
+#include "base/memory/weak_ptr.h" |
#include "blimp/common/blimp_common_export.h" |
#include "blimp/engine/mojo/blob_channel.mojom.h" |
#include "blimp/net/blob_channel/blob_channel_sender.h" |
@@ -20,6 +22,14 @@ namespace engine { |
// process. |
class BLIMP_COMMON_EXPORT BlobChannelSenderProxy : public BlobChannelSender { |
public: |
+ // Asynchronously request the set of cache keys from the browser process. |
+ // Knowledge of the browser's cache allows the renderer to avoid re-encoding |
+ // and re-transferring image assets that are already tracked by the |
+ // browser-side cache. |
+ // |
+ // If |this| is used in the brief time before the response arrives, |
+ // the object will continue to work, but false negatives will be returned |
+ // for IsInEngineCache() and IsInClientCache(). |
BlobChannelSenderProxy(); |
~BlobChannelSenderProxy() override; |
@@ -30,10 +40,14 @@ class BLIMP_COMMON_EXPORT BlobChannelSenderProxy : public BlobChannelSender { |
bool IsInClientCache(const std::string& id) const; |
// BlobChannelSender implementation. |
+ std::vector<CacheStateEntry> GetCachedBlobIds() const override; |
void PutBlob(const BlobId& id, BlobDataPtr data) override; |
void DeliverBlob(const BlobId& id) override; |
private: |
+ void OnGetCacheStateComplete( |
+ mojo::Array<mojom::CacheStateEntryPtr> cache_state); |
+ |
// BlobChannel Mojo IPC stub, used for delivering blobs to the browser |
// process. |
mojom::BlobChannelPtr blob_channel_; |
@@ -43,6 +57,8 @@ class BLIMP_COMMON_EXPORT BlobChannelSenderProxy : public BlobChannelSender { |
// image encoding and transferral if the content is already in the system. |
base::hash_map<std::string, bool> replication_state_; |
+ base::WeakPtrFactory<BlobChannelSenderProxy> weak_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(BlobChannelSenderProxy); |
}; |