| OLD | NEW |
| 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_sender_impl.h" | 5 #include "blimp/net/blob_channel/blob_channel_sender_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 std::vector<BlobChannelSender::CacheStateEntry> | 25 std::vector<BlobChannelSender::CacheStateEntry> |
| 26 BlobChannelSenderImpl::GetCachedBlobIds() const { | 26 BlobChannelSenderImpl::GetCachedBlobIds() const { |
| 27 const auto cache_state = cache_->GetCachedBlobIds(); | 27 const auto cache_state = cache_->GetCachedBlobIds(); |
| 28 std::vector<CacheStateEntry> output; | 28 std::vector<CacheStateEntry> output; |
| 29 output.reserve(cache_state.size()); | 29 output.reserve(cache_state.size()); |
| 30 for (const std::string& cached_id : cache_state) { | 30 for (const std::string& cached_id : cache_state) { |
| 31 CacheStateEntry next_output; | 31 CacheStateEntry next_output; |
| 32 next_output.id = cached_id; | 32 next_output.id = cached_id; |
| 33 next_output.was_delivered = | 33 next_output.was_delivered = |
| 34 ContainsKey(receiver_cache_contents_, cached_id); | 34 base::ContainsKey(receiver_cache_contents_, cached_id); |
| 35 output.push_back(next_output); | 35 output.push_back(next_output); |
| 36 } | 36 } |
| 37 return output; | 37 return output; |
| 38 } | 38 } |
| 39 | 39 |
| 40 void BlobChannelSenderImpl::PutBlob(const BlobId& id, BlobDataPtr data) { | 40 void BlobChannelSenderImpl::PutBlob(const BlobId& id, BlobDataPtr data) { |
| 41 DCHECK(data); | 41 DCHECK(data); |
| 42 DCHECK(!id.empty()); | 42 DCHECK(!id.empty()); |
| 43 | 43 |
| 44 if (cache_->Contains(id)) { | 44 if (cache_->Contains(id)) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 59 DVLOG(3) << "Suppressed redundant push: " << BlobIdToString(id); | 59 DVLOG(3) << "Suppressed redundant push: " << BlobIdToString(id); |
| 60 return; | 60 return; |
| 61 } | 61 } |
| 62 receiver_cache_contents_.insert(id); | 62 receiver_cache_contents_.insert(id); |
| 63 | 63 |
| 64 VLOG(2) << "Deliver blob: " << BlobIdToString(id); | 64 VLOG(2) << "Deliver blob: " << BlobIdToString(id); |
| 65 delegate_->DeliverBlob(id, cache_->Get(id)); | 65 delegate_->DeliverBlob(id, cache_->Get(id)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace blimp | 68 } // namespace blimp |
| OLD | NEW |