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

Side by Side Diff: blimp/engine/renderer/blob_channel_sender_proxy.h

Issue 2056993003: Add Mojo IPC for seeding new Renderer with Browser's cached blob state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blobchannel-master
Patch Set: use a better upstream branch for the patch Created 4 years, 6 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 #ifndef BLIMP_ENGINE_RENDERER_BLOB_CHANNEL_SENDER_PROXY_H_ 5 #ifndef BLIMP_ENGINE_RENDERER_BLOB_CHANNEL_SENDER_PROXY_H_
6 #define BLIMP_ENGINE_RENDERER_BLOB_CHANNEL_SENDER_PROXY_H_ 6 #define BLIMP_ENGINE_RENDERER_BLOB_CHANNEL_SENDER_PROXY_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector>
10 11
11 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/memory/weak_ptr.h"
12 #include "blimp/common/blimp_common_export.h" 14 #include "blimp/common/blimp_common_export.h"
13 #include "blimp/engine/mojo/blob_channel.mojom.h" 15 #include "blimp/engine/mojo/blob_channel.mojom.h"
14 #include "blimp/net/blob_channel/blob_channel_sender.h" 16 #include "blimp/net/blob_channel/blob_channel_sender.h"
15 17
16 namespace blimp { 18 namespace blimp {
17 namespace engine { 19 namespace engine {
18 20
19 // Class for sending blobs (e.g. images) from the renderer to the browser 21 // Class for sending blobs (e.g. images) from the renderer to the browser
20 // process. 22 // process.
21 class BLIMP_COMMON_EXPORT BlobChannelSenderProxy : public BlobChannelSender { 23 class BLIMP_COMMON_EXPORT BlobChannelSenderProxy : public BlobChannelSender {
22 public: 24 public:
23 BlobChannelSenderProxy(); 25 BlobChannelSenderProxy();
24 ~BlobChannelSenderProxy() override; 26 ~BlobChannelSenderProxy() override;
25 27
26 // Returns true if the blob is known to exist within the Engine cache. 28 // Returns true if the blob is known to exist within the Engine cache.
27 bool IsInEngineCache(const std::string& id) const; 29 bool IsInEngineCache(const std::string& id) const;
28 30
29 // Returns true if the blob has been delivered to the Client cache. 31 // Returns true if the blob has been delivered to the Client cache.
30 bool IsInClientCache(const std::string& id) const; 32 bool IsInClientCache(const std::string& id) const;
31 33
32 // BlobChannelSender implementation. 34 // BlobChannelSender implementation.
35 std::vector<CacheState> GetCacheState() const override;
33 void PutBlob(const BlobId& id, BlobDataPtr data) override; 36 void PutBlob(const BlobId& id, BlobDataPtr data) override;
34 void DeliverBlob(const BlobId& id) override; 37 void DeliverBlob(const BlobId& id) override;
35 38
36 private: 39 private:
40 void GotCacheState(mojo::Array<mojom::CacheStateEntryPtr> cache_state);
Wez 2016/06/21 00:33:33 nit: OnGetCacheStateComplete()?
Kevin M 2016/06/21 21:23:52 Done.
41
37 // BlobChannel Mojo IPC stub, used for delivering blobs to the browser 42 // BlobChannel Mojo IPC stub, used for delivering blobs to the browser
38 // process. 43 // process.
39 mojom::BlobChannelPtr blob_channel_; 44 mojom::BlobChannelPtr blob_channel_;
40 45
41 // Local copy of the cache state for the local and remote BlobChannel. 46 // Local copy of the cache state for the local and remote BlobChannel.
42 // Knowledge of the cache state enables callers to avoid unnecessary 47 // Knowledge of the cache state enables callers to avoid unnecessary
43 // image encoding and transferral if the content is already in the system. 48 // image encoding and transferral if the content is already in the system.
44 base::hash_map<std::string, bool> replication_state_; 49 base::hash_map<std::string, bool> replication_state_;
45 50
51 base::WeakPtrFactory<BlobChannelSenderProxy> weak_factory_;
52
46 DISALLOW_COPY_AND_ASSIGN(BlobChannelSenderProxy); 53 DISALLOW_COPY_AND_ASSIGN(BlobChannelSenderProxy);
47 }; 54 };
48 55
49 } // namespace engine 56 } // namespace engine
50 } // namespace blimp 57 } // namespace blimp
51 58
52 #endif // BLIMP_ENGINE_RENDERER_BLOB_CHANNEL_SENDER_PROXY_H_ 59 #endif // BLIMP_ENGINE_RENDERER_BLOB_CHANNEL_SENDER_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698