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

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 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
« no previous file with comments | « components/cast_channel/cast_socket.cc ('k') | components/cast_channel/cast_socket_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..54cd715d7b40b98a0f83a7a65e48ef54dc4bbc40 100644
--- a/components/cast_channel/cast_socket_service.h
+++ b/components/cast_channel/cast_socket_service.h
@@ -36,6 +36,15 @@ 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|. Return raw pointer
+ // of the newly added observer.
+ CastSocket::Observer* AddObserver(
+ const std::string& id,
+ std::unique_ptr<CastSocket::Observer> observer);
+
private:
~CastSocketService() override;
@@ -48,6 +57,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);
« no previous file with comments | « components/cast_channel/cast_socket.cc ('k') | components/cast_channel/cast_socket_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698