OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "content/renderer/media/peer_connection_tracker.h" | 4 #include "content/renderer/media/peer_connection_tracker.h" |
5 | 5 |
6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/common/media/peer_connection_tracker_messages.h" | 8 #include "content/common/media/peer_connection_tracker_messages.h" |
9 #include "content/renderer/media/rtc_media_constraints.h" | 9 #include "content/renderer/media/rtc_media_constraints.h" |
10 #include "content/renderer/media/rtc_peer_connection_handler.h" | 10 #include "content/renderer/media/rtc_peer_connection_handler.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 result->SetString("type", report.type); | 239 result->SetString("type", report.type); |
240 | 240 |
241 return result.release(); | 241 return result.release(); |
242 } | 242 } |
243 | 243 |
244 class InternalStatsObserver : public webrtc::StatsObserver { | 244 class InternalStatsObserver : public webrtc::StatsObserver { |
245 public: | 245 public: |
246 InternalStatsObserver(int lid) | 246 InternalStatsObserver(int lid) |
247 : lid_(lid){} | 247 : lid_(lid){} |
248 | 248 |
249 virtual void OnComplete( | 249 void OnComplete(const std::vector<webrtc::StatsReport>& reports) override { |
250 const std::vector<webrtc::StatsReport>& reports) override { | |
251 base::ListValue list; | 250 base::ListValue list; |
252 | 251 |
253 for (size_t i = 0; i < reports.size(); ++i) { | 252 for (size_t i = 0; i < reports.size(); ++i) { |
254 base::DictionaryValue* report = GetDictValue(reports[i]); | 253 base::DictionaryValue* report = GetDictValue(reports[i]); |
255 if (report) | 254 if (report) |
256 list.Append(report); | 255 list.Append(report); |
257 } | 256 } |
258 | 257 |
259 if (!list.empty()) | 258 if (!list.empty()) |
260 RenderThreadImpl::current()->Send( | 259 RenderThreadImpl::current()->Send( |
261 new PeerConnectionTrackerHost_AddStats(lid_, list)); | 260 new PeerConnectionTrackerHost_AddStats(lid_, list)); |
262 } | 261 } |
263 | 262 |
264 protected: | 263 protected: |
265 virtual ~InternalStatsObserver() {} | 264 ~InternalStatsObserver() override {} |
266 | 265 |
267 private: | 266 private: |
268 int lid_; | 267 int lid_; |
269 }; | 268 }; |
270 | 269 |
271 PeerConnectionTracker::PeerConnectionTracker() : next_lid_(1) { | 270 PeerConnectionTracker::PeerConnectionTracker() : next_lid_(1) { |
272 } | 271 } |
273 | 272 |
274 PeerConnectionTracker::~PeerConnectionTracker() { | 273 PeerConnectionTracker::~PeerConnectionTracker() { |
275 } | 274 } |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 const std::string& value) { | 536 const std::string& value) { |
538 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end()) | 537 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end()) |
539 return; | 538 return; |
540 | 539 |
541 RenderThreadImpl::current()->Send( | 540 RenderThreadImpl::current()->Send( |
542 new PeerConnectionTrackerHost_UpdatePeerConnection( | 541 new PeerConnectionTrackerHost_UpdatePeerConnection( |
543 peer_connection_id_map_[pc_handler], type, value)); | 542 peer_connection_id_map_[pc_handler], type, value)); |
544 } | 543 } |
545 | 544 |
546 } // namespace content | 545 } // namespace content |
OLD | NEW |