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

Side by Side Diff: blimp/engine/mojo/blob_channel_service.cc

Issue 2189503004: BlobChannelService is modified to be Mojo Service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments. Created 4 years, 4 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 <string> 7 #include <string>
8 #include <unordered_map> 8 #include <unordered_map>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "blimp/net/blob_channel/blob_channel_sender.h" 13 #include "blimp/net/blob_channel/blob_channel_sender.h"
14 #include "mojo/public/cpp/system/buffer.h" 14 #include "mojo/public/cpp/system/buffer.h"
15 15
16 namespace blimp { 16 namespace blimp {
17 namespace engine { 17 namespace engine {
18 18
19 BlobChannelService::BlobChannelService(BlobChannelSender* blob_channel_sender, 19 BlobChannelService::BlobChannelService(BlobChannelSender* blob_channel_sender)
20 mojom::BlobChannelRequest request) 20 : blob_channel_sender_(blob_channel_sender) {
21 : binding_(this, std::move(request)),
22 blob_channel_sender_(blob_channel_sender) {
23 DCHECK(blob_channel_sender_); 21 DCHECK(blob_channel_sender_);
24 } 22 }
25 23
26 BlobChannelService::~BlobChannelService() {} 24 BlobChannelService::~BlobChannelService() {}
27 25
28 void BlobChannelService::GetCachedBlobIds( 26 void BlobChannelService::GetCachedBlobIds(
29 const BlobChannelService::GetCachedBlobIdsCallback& response_callback) { 27 const BlobChannelService::GetCachedBlobIdsCallback& response_callback) {
30 VLOG(1) << "BlobChannel::GetCachedBlobIds called."; 28 VLOG(1) << "BlobChannel::GetCachedBlobIds called.";
31 std::unordered_map<std::string, bool> cache_state; 29 std::unordered_map<std::string, bool> cache_state;
32 for (const auto& next_entry : blob_channel_sender_->GetCachedBlobIds()) { 30 for (const auto& next_entry : blob_channel_sender_->GetCachedBlobIds()) {
(...skipping 21 matching lines...) Expand all
54 52
55 scoped_refptr<BlobData> new_blob(new BlobData); 53 scoped_refptr<BlobData> new_blob(new BlobData);
56 new_blob->data.assign(reinterpret_cast<const char*>(mapping.get()), size); 54 new_blob->data.assign(reinterpret_cast<const char*>(mapping.get()), size);
57 blob_channel_sender_->PutBlob(id, std::move(new_blob)); 55 blob_channel_sender_->PutBlob(id, std::move(new_blob));
58 } 56 }
59 57
60 void BlobChannelService::DeliverBlob(const std::string& id) { 58 void BlobChannelService::DeliverBlob(const std::string& id) {
61 blob_channel_sender_->DeliverBlob(id); 59 blob_channel_sender_->DeliverBlob(id);
62 } 60 }
63 61
64 // static 62 void BlobChannelService::BindRequest(
65 void BlobChannelService::Create(
66 BlobChannelSender* blob_channel_sender,
67 mojo::InterfaceRequest<mojom::BlobChannel> request) { 63 mojo::InterfaceRequest<mojom::BlobChannel> request) {
68 // Object lifetime is managed by BlobChannelService's StrongBinding 64 // Object lifetime is managed by BlobChannelService's BindingSet
Kevin M 2016/07/28 18:14:47 This isn't the case anymore?
CJ 2016/07/28 19:54:15 Done.
69 // |binding_|. 65 // |bindings_|.
70 new BlobChannelService(blob_channel_sender, std::move(request)); 66 bindings_.AddBinding(this, std::move(request));
71 } 67 }
72 68
73 } // namespace engine 69 } // namespace engine
74 } // namespace blimp 70 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698