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

Side by Side Diff: blimp/net/blob_channel/blob_channel_receiver.cc

Issue 1985863002: Incorporate BlobChannel into Blimp image encode/decode pipeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blobchannel-helium
Patch Set: Decoupled BlobChannelSenderHost from mojom::BlobChannel Created 4 years, 7 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/net/blob_channel/blob_channel_receiver.h" 5 #include "blimp/net/blob_channel/blob_channel_receiver.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "blimp/common/blob_cache/blob_cache.h" 9 #include "blimp/common/blob_cache/blob_cache.h"
10 #include "blimp/common/blob_cache/id_util.h"
10 11
11 namespace blimp { 12 namespace blimp {
12 13
13 BlobChannelReceiver::Delegate::Delegate() {} 14 BlobChannelReceiver::Delegate::Delegate() {}
14 15
15 BlobChannelReceiver::Delegate::~Delegate() { 16 BlobChannelReceiver::Delegate::~Delegate() {
16 DCHECK(receiver_); 17 DCHECK(receiver_);
17 } 18 }
18 19
19 void BlobChannelReceiver::Delegate::SetReceiver(BlobChannelReceiver* receiver) { 20 void BlobChannelReceiver::Delegate::SetReceiver(BlobChannelReceiver* receiver) {
(...skipping 17 matching lines...) Expand all
37 std::unique_ptr<Delegate> delegate) 38 std::unique_ptr<Delegate> delegate)
38 : cache_(std::move(cache)), delegate_(std::move(delegate)) { 39 : cache_(std::move(cache)), delegate_(std::move(delegate)) {
39 DCHECK(cache_); 40 DCHECK(cache_);
40 41
41 delegate_->SetReceiver(this); 42 delegate_->SetReceiver(this);
42 } 43 }
43 44
44 BlobChannelReceiverImpl::~BlobChannelReceiverImpl() {} 45 BlobChannelReceiverImpl::~BlobChannelReceiverImpl() {}
45 46
46 BlobDataPtr BlobChannelReceiverImpl::Get(const BlobId& id) { 47 BlobDataPtr BlobChannelReceiverImpl::Get(const BlobId& id) {
47 DVLOG(2) << "Get blob: " << id; 48 DVLOG(2) << "Get blob: " << BlobIdToString(id);
48 49
49 base::AutoLock lock(cache_lock_); 50 base::AutoLock lock(cache_lock_);
50 return cache_->Get(id); 51 return cache_->Get(id);
51 } 52 }
52 53
53 void BlobChannelReceiverImpl::OnBlobReceived(const BlobId& id, 54 void BlobChannelReceiverImpl::OnBlobReceived(const BlobId& id,
54 BlobDataPtr data) { 55 BlobDataPtr data) {
55 DVLOG(2) << "Blob received: " << id; 56 DVLOG(2) << "Blob received: " << BlobIdToString(id)
57 << ", size: " << data->data.size();
56 58
57 base::AutoLock lock(cache_lock_); 59 base::AutoLock lock(cache_lock_);
58 cache_->Put(id, data); 60 cache_->Put(id, data);
59 } 61 }
60 62
61 } // namespace blimp 63 } // namespace blimp
OLDNEW
« blimp/engine/session/blimp_engine_session.cc ('K') | « blimp/engine/session/blimp_engine_session.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698