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

Side by Side Diff: chrome/browser/media/router/discovery/mdns/cast_media_sink_service.h

Issue 2974523002: [cast_channel] Make CastSocketService a global leaky singleton (Closed)
Patch Set: merge with master Created 3 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/media/router/discovery/mdns/cast_media_sink_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MDNS_CAST_MEDIA_SINK_SERVICE_H_ 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MDNS_CAST_MEDIA_SINK_SERVICE_H_
6 #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MDNS_CAST_MEDIA_SINK_SERVICE_H_ 6 #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MDNS_CAST_MEDIA_SINK_SERVICE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 10
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "chrome/browser/media/router/discovery/mdns/dns_sd_delegate.h" 14 #include "chrome/browser/media/router/discovery/mdns/dns_sd_delegate.h"
15 #include "chrome/browser/media/router/discovery/mdns/dns_sd_registry.h" 15 #include "chrome/browser/media/router/discovery/mdns/dns_sd_registry.h"
16 #include "chrome/browser/media/router/discovery/media_sink_service_base.h" 16 #include "chrome/browser/media/router/discovery/media_sink_service_base.h"
17 #include "components/cast_channel/cast_channel_enum.h" 17 #include "components/cast_channel/cast_channel_enum.h"
18 #include "components/cast_channel/cast_socket.h" 18 #include "components/cast_channel/cast_socket.h"
19 #include "content/public/browser/browser_thread.h"
19 #include "net/base/ip_endpoint.h" 20 #include "net/base/ip_endpoint.h"
20 21
21 namespace cast_channel { 22 namespace cast_channel {
22 class CastSocketService; 23 class CastSocketService;
23 } // namespace cast_channel 24 } // namespace cast_channel
24 25
25 namespace content { 26 namespace content {
26 class BrowserContext; 27 class BrowserContext;
27 } // namespace content 28 } // namespace content
28 29
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 int channel_id, 113 int channel_id,
113 bool audio_only); 114 bool audio_only);
114 115
115 // Raw pointer to DnsSdRegistry instance, which is a global leaky singleton 116 // Raw pointer to DnsSdRegistry instance, which is a global leaky singleton
116 // and lives as long as the browser process. 117 // and lives as long as the browser process.
117 DnsSdRegistry* dns_sd_registry_ = nullptr; 118 DnsSdRegistry* dns_sd_registry_ = nullptr;
118 119
119 // Service list from current round of discovery. 120 // Service list from current round of discovery.
120 DnsSdRegistry::DnsSdServiceList current_services_; 121 DnsSdRegistry::DnsSdServiceList current_services_;
121 122
122 // Service managing creating and removing cast channels. 123 // Raw pointer of leaky singleton CastSocketService, which manages creating
123 scoped_refptr<cast_channel::CastSocketService> cast_socket_service_; 124 // and removing Cast sockets.
125 cast_channel::CastSocketService* const cast_socket_service_;
126
127 std::unique_ptr<cast_channel::CastSocket::Observer,
128 content::BrowserThread::DeleteOnIOThread>
129 observer_;
124 130
125 THREAD_CHECKER(thread_checker_); 131 THREAD_CHECKER(thread_checker_);
126 132
127 DISALLOW_COPY_AND_ASSIGN(CastMediaSinkService); 133 DISALLOW_COPY_AND_ASSIGN(CastMediaSinkService);
128 }; 134 };
129 135
130 } // namespace media_router 136 } // namespace media_router
131 137
132 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MDNS_CAST_MEDIA_SINK_SERVICE_H_ 138 #endif // CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MDNS_CAST_MEDIA_SINK_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media/router/discovery/mdns/cast_media_sink_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698