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

Unified Diff: blimp/net/blob_channel/blob_channel_receiver.cc

Issue 1970463004: Blimp: Add BlobChannel Helium messages and delegate impls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: haibinlu feedback 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 side-by-side diff with in-line comments
Download patch
Index: blimp/net/blob_channel/blob_channel_receiver.cc
diff --git a/blimp/net/blob_channel/blob_channel_receiver.cc b/blimp/net/blob_channel/blob_channel_receiver.cc
index 7200dd3219e3b17cb3fb460793c1ff1e4d11181c..5819854a5b0998f37ece339bbc2ec669b62d70f6 100644
--- a/blimp/net/blob_channel/blob_channel_receiver.cc
+++ b/blimp/net/blob_channel/blob_channel_receiver.cc
@@ -13,39 +13,45 @@ namespace blimp {
BlobChannelReceiver::Delegate::Delegate() {}
BlobChannelReceiver::Delegate::~Delegate() {
- DCHECK(!receiver_);
+ DCHECK(receiver_);
}
void BlobChannelReceiver::Delegate::SetReceiver(BlobChannelReceiver* receiver) {
+ DCHECK(receiver);
+ DCHECK(!receiver_);
+
receiver_ = receiver;
}
void BlobChannelReceiver::Delegate::OnBlobReceived(const BlobId& id,
BlobDataPtr data) {
- if (receiver_) {
- receiver_->OnBlobReceived(id, data);
- }
+ receiver_->OnBlobReceived(id, data);
}
-BlobChannelReceiver::BlobChannelReceiver(std::unique_ptr<BlobCache> cache,
- std::unique_ptr<Delegate> delegate)
+BlobChannelReceiver::BlobChannelReceiver() {}
+
+BlobChannelReceiver::~BlobChannelReceiver() {}
+
+BlobChannelReceiverImpl::BlobChannelReceiverImpl(
+ std::unique_ptr<BlobCache> cache,
+ std::unique_ptr<Delegate> delegate)
: cache_(std::move(cache)), delegate_(std::move(delegate)) {
DCHECK(cache_);
+
delegate_->SetReceiver(this);
}
-BlobChannelReceiver::~BlobChannelReceiver() {
- delegate_->SetReceiver(nullptr);
Wez 2016/05/20 21:46:17 Did you mean to remove the SetReceiver(nullptr) ca
Kevin M 2016/05/23 20:48:07 Nope, it was just unnecessary, since |delegate_| i
-}
+BlobChannelReceiverImpl::~BlobChannelReceiverImpl() {}
-BlobDataPtr BlobChannelReceiver::Get(const BlobId& id) {
+BlobDataPtr BlobChannelReceiverImpl::Get(const BlobId& id) {
DVLOG(2) << "Get blob: " << id;
base::AutoLock lock(cache_lock_);
return cache_->Get(id);
}
-void BlobChannelReceiver::OnBlobReceived(const BlobId& id, BlobDataPtr data) {
+void BlobChannelReceiverImpl::OnBlobReceived(const BlobId& id,
+ BlobDataPtr data) {
DVLOG(2) << "Blob received: " << id;
base::AutoLock lock(cache_lock_);

Powered by Google App Engine
This is Rietveld 408576698