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/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "content/common/media/peer_connection_tracker_messages.h" | 7 #include "content/common/media/peer_connection_tracker_messages.h" |
8 #include "content/renderer/media/rtc_media_constraints.h" | 8 #include "content/renderer/media/rtc_media_constraints.h" |
9 #include "content/renderer/media/rtc_peer_connection_handler.h" | 9 #include "content/renderer/media/rtc_peer_connection_handler.h" |
10 #include "content/renderer/render_thread_impl.h" | 10 #include "content/renderer/render_thread_impl.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // Builds a DictionaryValue from the StatsReport. | 153 // Builds a DictionaryValue from the StatsReport. |
154 // The caller takes the ownership of the returned value. | 154 // The caller takes the ownership of the returned value. |
155 // Note: | 155 // Note: |
156 // The format must be consistent with what webrtc_internals.js expects. | 156 // The format must be consistent with what webrtc_internals.js expects. |
157 // If you change it here, you must change webrtc_internals.js as well. | 157 // If you change it here, you must change webrtc_internals.js as well. |
158 static base::DictionaryValue* GetDictValueStats( | 158 static base::DictionaryValue* GetDictValueStats( |
159 const webrtc::StatsReport& report) { | 159 const webrtc::StatsReport& report) { |
160 if (report.values.empty()) | 160 if (report.values.empty()) |
161 return NULL; | 161 return NULL; |
162 | 162 |
163 DictionaryValue* dict = new base::DictionaryValue(); | 163 base::DictionaryValue* dict = new base::DictionaryValue(); |
164 dict->SetDouble("timestamp", report.timestamp); | 164 dict->SetDouble("timestamp", report.timestamp); |
165 | 165 |
166 base::ListValue* values = new base::ListValue(); | 166 base::ListValue* values = new base::ListValue(); |
167 dict->Set("values", values); | 167 dict->Set("values", values); |
168 | 168 |
169 for (size_t i = 0; i < report.values.size(); ++i) { | 169 for (size_t i = 0; i < report.values.size(); ++i) { |
170 values->AppendString(report.values[i].name); | 170 values->AppendString(report.values[i].name); |
171 values->AppendString(report.values[i].value); | 171 values->AppendString(report.values[i].value); |
172 } | 172 } |
173 return dict; | 173 return dict; |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 const std::string& value) { | 444 const std::string& value) { |
445 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end()) | 445 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end()) |
446 return; | 446 return; |
447 | 447 |
448 RenderThreadImpl::current()->Send( | 448 RenderThreadImpl::current()->Send( |
449 new PeerConnectionTrackerHost_UpdatePeerConnection( | 449 new PeerConnectionTrackerHost_UpdatePeerConnection( |
450 peer_connection_id_map_[pc_handler], type, value)); | 450 peer_connection_id_map_[pc_handler], type, value)); |
451 } | 451 } |
452 | 452 |
453 } // namespace content | 453 } // namespace content |
OLD | NEW |