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

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

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/renderer/blob_channel_sender_proxy.h ('k') | blimp/net/blob_channel/blob_channel_sender.h » ('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.cc
diff --git a/blimp/engine/renderer/blob_channel_sender_proxy.cc b/blimp/engine/renderer/blob_channel_sender_proxy.cc
index 1e8e7660a58a82d55bc6e17b648032d5dc8f2104..4c466abf5eaff0fb0c44538dd8e3db8031a13cad 100644
--- a/blimp/engine/renderer/blob_channel_sender_proxy.cc
+++ b/blimp/engine/renderer/blob_channel_sender_proxy.cc
@@ -4,6 +4,7 @@
#include "blimp/engine/renderer/blob_channel_sender_proxy.h"
+#include <unordered_map>
#include <utility>
#include "blimp/common/blob_cache/id_util.h"
@@ -61,13 +62,17 @@ mojo::ScopedSharedBufferHandle SharedMemoryBlob::CreateRemoteHandle() {
} // namespace
BlobChannelSenderProxy::BlobChannelSenderProxy()
- : BlobChannelSenderProxy(GetConnectedBlobChannel()) {}
+ : blob_channel_(GetConnectedBlobChannel()), weak_factory_(this) {
+ blob_channel_->GetCachedBlobIds(
+ base::Bind(&BlobChannelSenderProxy::OnGetCacheStateComplete,
+ weak_factory_.GetWeakPtr()));
+}
BlobChannelSenderProxy::~BlobChannelSenderProxy() {}
BlobChannelSenderProxy::BlobChannelSenderProxy(
mojom::BlobChannelPtr blob_channel)
- : blob_channel_(std::move(blob_channel)) {}
+ : blob_channel_(std::move(blob_channel)), weak_factory_(this) {}
// static
std::unique_ptr<BlobChannelSenderProxy> BlobChannelSenderProxy::CreateForTest(
@@ -110,5 +115,21 @@ void BlobChannelSenderProxy::DeliverBlob(const std::string& id) {
blob_channel_->DeliverBlob(id);
}
+std::vector<BlobChannelSender::CacheStateEntry>
+BlobChannelSenderProxy::GetCachedBlobIds() const {
+ NOTREACHED();
+ return std::vector<BlobChannelSender::CacheStateEntry>();
+}
+
+void BlobChannelSenderProxy::OnGetCacheStateComplete(
+ const std::unordered_map<std::string, bool>& 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.first] = next_item.second;
+ }
+}
+
} // namespace engine
} // namespace blimp
« no previous file with comments | « blimp/engine/renderer/blob_channel_sender_proxy.h ('k') | blimp/net/blob_channel/blob_channel_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698