Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BLIMP_ENGINE_RENDERER_BLOB_CHANNEL_SENDER_HOST_H_ | |
| 6 #define BLIMP_ENGINE_RENDERER_BLOB_CHANNEL_SENDER_HOST_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/containers/hash_tables.h" | |
| 12 #include "blimp/common/blimp_common_export.h" | |
| 13 #include "blimp/engine/mojo/blob_channel.mojom.h" | |
| 14 | |
| 15 namespace blimp { | |
| 16 namespace engine { | |
| 17 | |
| 18 // Host object for communicating with the BlobChannel service across the | |
| 19 // renderer/browser IPC boundary. | |
|
Wez
2016/05/21 01:08:04
Communicating with the BlobChannel service doesn't
Kevin M
2016/05/27 22:35:30
Description updated.
| |
| 20 class BLIMP_COMMON_EXPORT BlobChannelSenderHost { | |
|
nyquist
2016/05/24 00:05:41
This is a little bit confusing naming to me. In //
Kevin M
2016/05/27 22:35:30
Done, it's now "proxy".
| |
| 21 public: | |
| 22 // Represents the known cached state of a given blob. | |
| 23 // Flags can be combined with boolean AND. | |
|
Wez
2016/05/21 01:08:04
Give a little context as to what these actually me
Kevin M
2016/05/27 22:35:31
Done.
| |
| 24 enum ReplicationState { NOT_STORED = 0, ENGINE = 1 << 1, CLIENT = 1 << 2 }; | |
| 25 | |
| 26 BlobChannelSenderHost(); | |
| 27 ~BlobChannelSenderHost(); | |
| 28 | |
| 29 // Indicates whether a given blob is stored on the engine, the client, | |
| 30 // or both. | |
| 31 // The return value is an integer composed of AND'd ReplicationState flags. | |
| 32 // TODO(kmarshall): Synchronize state with data on the Browser side. | |
| 33 int GetReplicationState(const std::string& id) const; | |
|
Wez
2016/05/21 01:08:04
Would it be cleaner to provide separate IsInClient
Kevin M
2016/05/27 22:35:30
Done.
| |
| 34 | |
| 35 // Conditionally stores a blob in the local portion of BlobChannel, if it | |
| 36 // doesn't already contain the blob. | |
|
Wez
2016/05/21 01:08:04
It's not clear what "local portion" means here.
Kevin M
2016/05/27 22:35:31
Comments for implementation have been removed.
| |
| 37 // See the documentation for BlobChannel::Put(). | |
| 38 void Put(const std::string& id, const std::string& data); | |
| 39 | |
| 40 // Conditionally sends a blob to the remote side of the BlobChannel, if it | |
| 41 // doesn't already have the blob | |
| 42 // See the documentation for BlobChannel::Push(). | |
| 43 void Push(const std::string& id); | |
|
Wez
2016/05/21 01:08:04
Put & Push are just mirroring the BlobChannelSende
Kevin M
2016/05/27 22:35:30
Done.
| |
| 44 | |
| 45 private: | |
| 46 // BlobChannel Mojo IPC stub. | |
|
Wez
2016/05/21 01:08:04
Which is used for...? Receiving the BlobChannel IP
Kevin M
2016/05/27 22:35:31
Done.
| |
| 47 mojom::BlobChannelPtr blob_channel_; | |
| 48 | |
| 49 // Local copy of the cache state for the local and remote BlobChannel. | |
| 50 // TODO(kmarshall): Synchronize with browser side copy. | |
| 51 base::hash_map<std::string, int> replication_state_; | |
|
Wez
2016/05/21 01:08:04
Wait... so this class is used in the _renderer_?
Kevin M
2016/05/27 22:35:30
Acknowledged.
| |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(BlobChannelSenderHost); | |
| 54 }; | |
| 55 | |
| 56 } // namespace engine | |
| 57 } // namespace blimp | |
| 58 | |
| 59 #endif // BLIMP_ENGINE_RENDERER_BLOB_CHANNEL_SENDER_HOST_H_ | |
| OLD | NEW |