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

Side by Side 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: Mojo mapz 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "blimp/engine/mojo/blob_channel_service.h" 5 #include "blimp/engine/mojo/blob_channel_service.h"
6 6
7 #include <vector>
8
9 #include "base/memory/ptr_util.h"
7 #include "blimp/net/blob_channel/blob_channel_sender.h" 10 #include "blimp/net/blob_channel/blob_channel_sender.h"
8 11
9 namespace blimp { 12 namespace blimp {
10 namespace engine { 13 namespace engine {
11 14
12 BlobChannelService::BlobChannelService(BlobChannelSender* blob_channel_sender, 15 BlobChannelService::BlobChannelService(BlobChannelSender* blob_channel_sender,
13 mojom::BlobChannelRequest request) 16 mojom::BlobChannelRequest request)
14 : binding_(this, std::move(request)), 17 : binding_(this, std::move(request)),
15 blob_channel_sender_(blob_channel_sender) { 18 blob_channel_sender_(blob_channel_sender) {
16 DCHECK(blob_channel_sender_); 19 DCHECK(blob_channel_sender_);
17 } 20 }
18 21
19 BlobChannelService::~BlobChannelService() {} 22 BlobChannelService::~BlobChannelService() {}
20 23
24 void BlobChannelService::GetCachedBlobIds(
25 const BlobChannelService::GetCachedBlobIdsCallback& callback) {
Wez 2016/07/01 00:30:20 nit: |callback| seems unnecessarily generic - this
Kevin M 2016/07/18 16:58:16 Done.
26 VLOG(1) << "BlobChannel::GetCachedBlobIds called.";
27 mojo::Map<mojo::String, bool> output;
Wez 2016/07/01 00:30:20 nit: cache_state, for consistency w/ other call si
Kevin M 2016/07/18 16:58:16 Done.
28 for (const auto& next_entry : blob_channel_sender_->GetCachedBlobIds()) {
29 output[next_entry.id] = next_entry.was_delivered;
30 }
31 callback.Run(std::move(output));
32 }
33
21 void BlobChannelService::PutBlob(const mojo::String& id, 34 void BlobChannelService::PutBlob(const mojo::String& id,
22 const mojo::String& data) { 35 const mojo::String& data) {
23 blob_channel_sender_->PutBlob(id, new BlobData(data)); 36 blob_channel_sender_->PutBlob(id, new BlobData(data));
24 } 37 }
25 38
26 void BlobChannelService::DeliverBlob(const mojo::String& id) { 39 void BlobChannelService::DeliverBlob(const mojo::String& id) {
27 blob_channel_sender_->DeliverBlob(id); 40 blob_channel_sender_->DeliverBlob(id);
28 } 41 }
29 42
30 // static 43 // static
31 void BlobChannelService::Create( 44 void BlobChannelService::Create(
32 BlobChannelSender* blob_channel_sender, 45 BlobChannelSender* blob_channel_sender,
33 mojo::InterfaceRequest<mojom::BlobChannel> request) { 46 mojo::InterfaceRequest<mojom::BlobChannel> request) {
34 // Object lifetime is managed by BlobChannelService's StrongBinding 47 // Object lifetime is managed by BlobChannelService's StrongBinding
35 // |binding_|. 48 // |binding_|.
36 new BlobChannelService(blob_channel_sender, std::move(request)); 49 new BlobChannelService(blob_channel_sender, std::move(request));
37 } 50 }
38 51
39 } // namespace engine 52 } // namespace engine
40 } // namespace blimp 53 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698