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

Side by Side Diff: chrome/browser/media/router/mojo/media_router_mojo_impl.cc

Issue 2675033002: [Media Router] Add MediaSink subtypes (Closed)
Patch Set: resolve code review comments from Mark Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "chrome/browser/media/router/mojo/media_router_mojo_impl.h" 5 #include "chrome/browser/media/router/mojo/media_router_mojo_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 168
169 void MediaRouterMojoImpl::OnIssue(const IssueInfo& issue) { 169 void MediaRouterMojoImpl::OnIssue(const IssueInfo& issue) {
170 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 170 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
171 DVLOG_WITH_INSTANCE(1) << "OnIssue " << issue.title; 171 DVLOG_WITH_INSTANCE(1) << "OnIssue " << issue.title;
172 issue_manager_.AddIssue(issue); 172 issue_manager_.AddIssue(issue);
173 } 173 }
174 174
175 void MediaRouterMojoImpl::OnSinksReceived( 175 void MediaRouterMojoImpl::OnSinksReceived(
176 const std::string& media_source, 176 const std::string& media_source,
177 const std::vector<MediaSink>& sinks, 177 const std::vector<MediaSinkInternal>& internal_sinks,
178 const std::vector<url::Origin>& origins) { 178 const std::vector<url::Origin>& origins) {
179 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 179 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
180 DVLOG_WITH_INSTANCE(1) << "OnSinksReceived"; 180 DVLOG_WITH_INSTANCE(1) << "OnSinksReceived";
181 auto it = sinks_queries_.find(media_source); 181 auto it = sinks_queries_.find(media_source);
182 if (it == sinks_queries_.end()) { 182 if (it == sinks_queries_.end()) {
183 DVLOG_WITH_INSTANCE(1) << "Received sink list without MediaSinksQuery."; 183 DVLOG_WITH_INSTANCE(1) << "Received sink list without MediaSinksQuery.";
184 return; 184 return;
185 } 185 }
186 186
187 std::vector<MediaSink> sinks(internal_sinks.size());
imcheng 2017/03/01 22:54:18 This actually creates a vector with N default-cons
zhaobin 2017/03/03 23:56:42 Thanks a lot!
zhaobin 2017/03/03 23:56:42 Done.
188 for (const auto& internal_sink : internal_sinks)
189 sinks.push_back(internal_sink.sink());
190
187 auto* sinks_query = it->second.get(); 191 auto* sinks_query = it->second.get();
188 sinks_query->has_cached_result = true; 192 sinks_query->has_cached_result = true;
189 sinks_query->origins = origins; 193 sinks_query->origins = origins;
190 sinks_query->cached_sink_list = sinks; 194 sinks_query->cached_sink_list = sinks;
191 195
192 if (!sinks_query->observers.might_have_observers()) { 196 if (!sinks_query->observers.might_have_observers()) {
193 DVLOG_WITH_INSTANCE(1) 197 DVLOG_WITH_INSTANCE(1)
194 << "Received sink list without any active observers: " << media_source; 198 << "Received sink list without any active observers: " << media_source;
195 } else { 199 } else {
196 for (auto& observer : sinks_query->observers) { 200 for (auto& observer : sinks_query->observers) {
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 base::Unretained(this), source_id)); 933 base::Unretained(this), source_id));
930 } 934 }
931 935
932 void MediaRouterMojoImpl::DoUpdateMediaSinks( 936 void MediaRouterMojoImpl::DoUpdateMediaSinks(
933 const MediaSource::Id& source_id) { 937 const MediaSource::Id& source_id) {
934 DVLOG_WITH_INSTANCE(1) << "DoUpdateMediaSinks" << source_id; 938 DVLOG_WITH_INSTANCE(1) << "DoUpdateMediaSinks" << source_id;
935 media_route_provider_->UpdateMediaSinks(source_id); 939 media_route_provider_->UpdateMediaSinks(source_id);
936 } 940 }
937 941
938 } // namespace media_router 942 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698