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

Unified Diff: blimp/net/blob_channel/blob_channel_sender.h

Issue 1887013003: Blimp: Add BlobChannelSender implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blobchannel-blobcache
Patch Set: Remove erroneous namespace Created 4 years, 8 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_sender.h
diff --git a/blimp/net/blob_channel/blob_channel_sender.h b/blimp/net/blob_channel/blob_channel_sender.h
new file mode 100644
index 0000000000000000000000000000000000000000..8af3c4f9b2383dc0215256cc1974f187196e198a
--- /dev/null
+++ b/blimp/net/blob_channel/blob_channel_sender.h
@@ -0,0 +1,53 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BLIMP_NET_BLOB_CHANNEL_BLOB_CHANNEL_SENDER_H_
+#define BLIMP_NET_BLOB_CHANNEL_BLOB_CHANNEL_SENDER_H_
+
+#include <set>
+#include <string>
+#include <vector>
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
Wez 2016/04/15 17:15:16 You don't seem to use WeakPtr.
Kevin M 2016/04/15 22:42:57 Done.
+#include "base/observer_list.h"
Wez 2016/04/15 17:15:17 Nor observer lists.
Kevin M 2016/04/15 22:42:57 Done.
+#include "base/threading/thread_checker.h"
+#include "blimp/net/blimp_message_processor.h"
Wez 2016/04/15 17:15:16 Nor BlimpMessageProcessor.
Kevin M 2016/04/15 22:42:57 Done.
+#include "blimp/net/blimp_net_export.h"
+
+namespace blimp {
+
+class BlobCache;
+class BlobSenderBindings;
+
+class BLIMP_NET_EXPORT BlobChannelSender {
nyquist 2016/04/15 17:12:52 Should there be a short comment explaining this cl
Kevin M 2016/04/15 22:42:57 Done.
+ public:
+ BlobChannelSender(BlobCache* cache, BlobSenderBindings* bindings);
Wez 2016/04/15 17:15:16 Ownership of bare-pointer parameters needs to be c
Kevin M 2016/04/15 22:42:57 Clarified ownership (or lack thereof.) Addressed
+ ~BlobChannelSender();
+
+ // Stores a blob inside the BlobCache.
Wez 2016/04/15 17:15:16 That's an implementation detail, surely? Conceptu
Kevin M 2016/04/15 22:42:57 It puts the blob into the channel, where it can be
+ // Must be called on the main thread.
Wez 2016/04/15 17:15:16 There is no "main thread", nor any concept of thre
Kevin M 2016/04/15 22:42:57 Done.
+ void Put(const std::string& id, std::unique_ptr<std::vector<uint8_t>> data);
+
+ // Sends the blob |id| to the remote side.
+ // Must be called on the main thread.
+ void Push(const std::string& id);
+
+ private:
+ BlobCache* cache_;
+ BlobSenderBindings* bindings_;
+
+ // A listing of the cache items in the receiver's cache.
+ // Used for suppressing redundant data transfers.
Wez 2016/04/15 17:15:16 This tells me what it's for, but not what it actua
Kevin M 2016/04/15 22:42:57 Done.
+ // TODO(kmarshall): Replace with a Bloom filter.
Wez 2016/04/15 17:15:16 nit: Remove this TODO; we will _probably_ want to
Kevin M 2016/04/15 22:42:57 Done.
+ std::set<std::string> client_cache_state_;
Wez 2016/04/15 17:15:16 This name doesn't help me understand what this set
Kevin M 2016/04/15 22:42:57 Done. "receiver_cache_contents_"
+
+ base::ThreadChecker thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(BlobChannelSender);
+};
+
+} // namespace blimp
+
+#endif // BLIMP_NET_BLOB_CHANNEL_BLOB_CHANNEL_SENDER_H_

Powered by Google App Engine
This is Rietveld 408576698