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

Unified Diff: components/cast_channel/cast_socket_service.h

Issue 2942993003: [cast_channel] Make CastMessageHandler a CastSocket::Observer instead of CastTransport::Delegate (Closed)
Patch Set: resolve code review comments from Derek and Mark Created 3 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 side-by-side diff with in-line comments
Download patch
Index: components/cast_channel/cast_socket_service.h
diff --git a/components/cast_channel/cast_socket_service.h b/components/cast_channel/cast_socket_service.h
index d7d016ba41806bc6f48babb97d43c1526b83308f..e01072620507ec56e43f47321a17223a7111d172 100644
--- a/components/cast_channel/cast_socket_service.h
+++ b/components/cast_channel/cast_socket_service.h
@@ -36,6 +36,13 @@ class CastSocketService : public RefcountedKeyedService {
// otherwise.
CastSocket* GetSocket(int channel_id) const;
+ // Returns an observer corresponding to |id|.
+ CastSocket::Observer* GetObserver(const std::string& id);
+
+ // Adds |observer| to |socket_observer_map_| keyed by |id|.
+ void AddObserver(const std::string& id,
+ std::unique_ptr<CastSocket::Observer> observer);
+
private:
~CastSocketService() override;
@@ -48,6 +55,12 @@ class CastSocketService : public RefcountedKeyedService {
// The collection of CastSocket keyed by channel_id.
std::map<int, std::unique_ptr<CastSocket>> sockets_;
+ // Map of CastSocket::Observer keyed by observer id. For extension side
+ // observers, id is extension_id; For browser side observers, id is a hard
+ // coded string.
+ std::map<std::string, std::unique_ptr<CastSocket::Observer>>
+ socket_observer_map_;
+
THREAD_CHECKER(thread_checker_);
DISALLOW_COPY_AND_ASSIGN(CastSocketService);

Powered by Google App Engine
This is Rietveld 408576698