Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3259)

Unified Diff: blimp/engine/renderer/blob_channel_sender_proxy.h

Issue 2056993003: Add Mojo IPC for seeding new Renderer with Browser's cached blob state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blobchannel-master
Patch Set: STL containers yay Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/engine/mojo/blob_channel_service.cc ('k') | blimp/engine/renderer/blob_channel_sender_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « blimp/engine/mojo/blob_channel_service.cc ('k') | blimp/engine/renderer/blob_channel_sender_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698