Chromium Code Reviews| Index: blimp/engine/renderer/blob_channel_sender_proxy.cc |
| diff --git a/blimp/engine/renderer/blob_channel_sender_proxy.cc b/blimp/engine/renderer/blob_channel_sender_proxy.cc |
| index 8b689d36c73dd840878105bb72a926845ebe97be..ba664bd0894c0c350fa702c55b0a6e7b2aa408e5 100644 |
| --- a/blimp/engine/renderer/blob_channel_sender_proxy.cc |
| +++ b/blimp/engine/renderer/blob_channel_sender_proxy.cc |
| @@ -22,7 +22,21 @@ mojom::BlobChannelPtr GetConnectedBlobChannel() { |
| } // namespace |
| BlobChannelSenderProxy::BlobChannelSenderProxy() |
| - : blob_channel_(GetConnectedBlobChannel()) {} |
| + : blob_channel_(GetConnectedBlobChannel()), weak_factory_(this) { |
| + // 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(). |
|
Wez
2016/06/21 00:33:33
This is a property the caller needs to be aware of
Kevin M
2016/06/21 21:23:52
Done, moved to header file.
|
| + // |
| + // TODO(kmarshall): Switch to observer push model (vs. the current pull model) |
| + // once cache invalidations are introduced. |
| + blob_channel_->GetCacheState(base::Bind( |
| + &BlobChannelSenderProxy::GotCacheState, weak_factory_.GetWeakPtr())); |
| +} |
| BlobChannelSenderProxy::~BlobChannelSenderProxy() {} |
| @@ -52,5 +66,21 @@ void BlobChannelSenderProxy::DeliverBlob(const std::string& id) { |
| blob_channel_->DeliverBlob(id); |
| } |
| +std::vector<BlobChannelSender::CacheState> |
| +BlobChannelSenderProxy::GetCacheState() const { |
| + NOTREACHED(); |
| + return std::vector<BlobChannelSender::CacheState>(); |
|
Wez
2016/06/21 00:33:33
Why not-implemented? Why not return a copy of repl
Kevin M
2016/06/21 21:23:52
Done.
Wez
2016/06/22 19:54:23
(Or is it the case that no-one will ever call this
Kevin M
2016/06/22 23:52:52
Yes, that is the case. <_<
|
| +} |
| + |
| +void BlobChannelSenderProxy::GotCacheState( |
| + mojo::Array<mojom::CacheStateEntryPtr> cache_state) { |
| + VLOG(1) << "Received cache state from browser (" << cache_state.size() |
| + << " items)"; |
| + replication_state_.clear(); |
| + for (const auto& next_item : cache_state) { |
| + replication_state_[next_item->id] = next_item->is_replicated; |
| + } |
| +} |
| + |
| } // namespace engine |
| } // namespace blimp |