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 d34e482459821a550b0341e15ef83613107680ea..1ee09f7ac10f79d8d8df34ba2ddbc2cdd59b3b18 100644 |
--- a/blimp/engine/renderer/blob_channel_sender_proxy.h |
+++ b/blimp/engine/renderer/blob_channel_sender_proxy.h |
@@ -5,10 +5,14 @@ |
#ifndef BLIMP_ENGINE_RENDERER_BLOB_CHANNEL_SENDER_PROXY_H_ |
#define BLIMP_ENGINE_RENDERER_BLOB_CHANNEL_SENDER_PROXY_H_ |
+#include <map> |
#include <memory> |
#include <string> |
+#include <unordered_map> |
+#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 +24,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; |
@@ -34,10 +46,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( |
+ const std::unordered_map<std::string, bool>& cache_state); |
+ |
// Testing constructor, used to supply a BlobChannel Mojo proxy directly. |
explicit BlobChannelSenderProxy(mojom::BlobChannelPtr blob_channel); |
@@ -50,6 +66,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); |
}; |