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

Unified Diff: blimp/engine/mojo/blob_channel_service.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: use a better upstream branch for the patch Created 4 years, 6 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
Index: blimp/engine/mojo/blob_channel_service.cc
diff --git a/blimp/engine/mojo/blob_channel_service.cc b/blimp/engine/mojo/blob_channel_service.cc
index 0234df60698b3a2c2628537b7e66cfd9ae44bfd9..7e0d740007bf9b0c4af82f8e96bb70f84a799c43 100644
--- a/blimp/engine/mojo/blob_channel_service.cc
+++ b/blimp/engine/mojo/blob_channel_service.cc
@@ -4,6 +4,8 @@
#include "blimp/engine/mojo/blob_channel_service.h"
+#include <vector>
+
#include "blimp/net/blob_channel/blob_channel_sender.h"
namespace blimp {
@@ -18,6 +20,24 @@ BlobChannelService::BlobChannelService(BlobChannelSender* blob_channel_sender,
BlobChannelService::~BlobChannelService() {}
+void BlobChannelService::GetCacheState(
+ const BlobChannelService::GetCacheStateCallback& callback) {
+ VLOG(1) << "BlobChannel::GetCacheState called.";
+
+ // Get the cache state & marshal the contents to the Mojo response.
Wez 2016/06/21 00:33:33 "marshal the contents to ... response" sounds odd
Kevin M 2016/06/21 21:23:51 Done.
+ std::vector<BlobChannelSender::CacheState> cache_state =
+ blob_channel_sender_->GetCacheState();
+ auto output = mojo::Array<mojom::CacheStateEntryPtr>::New(cache_state.size());
+ for (size_t i = 0; i < cache_state.size(); ++i) {
+ mojom::CacheStateEntryPtr converted(mojom::CacheStateEntry::New());
+ converted->id = cache_state[i].id;
+ converted->is_replicated = cache_state[i].is_replicated;
+ output[i] = std::move(converted);
+ }
+
+ callback.Run(std::move(output));
+}
+
void BlobChannelService::PutBlob(const mojo::String& id,
const mojo::String& data) {
blob_channel_sender_->PutBlob(id, new BlobData(data));

Powered by Google App Engine
This is Rietveld 408576698