OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/media/rtc_peer_connection_handler.h" | 5 #include "content/renderer/media/rtc_peer_connection_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 private: | 226 private: |
227 blink::WebRTCVoidRequest webkit_request_; | 227 blink::WebRTCVoidRequest webkit_request_; |
228 SessionDescriptionRequestTracker tracker_; | 228 SessionDescriptionRequestTracker tracker_; |
229 }; | 229 }; |
230 | 230 |
231 // Class mapping responses from calls to libjingle | 231 // Class mapping responses from calls to libjingle |
232 // GetStats into a blink::WebRTCStatsCallback. | 232 // GetStats into a blink::WebRTCStatsCallback. |
233 class StatsResponse : public webrtc::StatsObserver { | 233 class StatsResponse : public webrtc::StatsObserver { |
234 public: | 234 public: |
235 explicit StatsResponse(const scoped_refptr<LocalRTCStatsRequest>& request) | 235 explicit StatsResponse(const scoped_refptr<LocalRTCStatsRequest>& request) |
236 : request_(request.get()), response_(request_->createResponse().get()) {} | 236 : request_(request.get()), response_(request_->createResponse().get()) { |
237 // Measure the overall time it takes to satisfy a getStats request. | |
238 TRACE_EVENT_ASYNC_BEGIN0("webrtc", "getStats_Native", this); | |
239 } | |
237 | 240 |
238 virtual void OnComplete( | 241 virtual void OnComplete( |
239 const std::vector<webrtc::StatsReport>& reports) OVERRIDE { | 242 const std::vector<webrtc::StatsReport>& reports) OVERRIDE { |
240 TRACE_EVENT0("webrtc", "StatsResponse::OnComplete") | 243 TRACE_EVENT0("webrtc", "StatsResponse::OnComplete") |
no longer working on chromium
2014/06/02 11:03:21
do we still need this TRACE_EVENT0?
tommi (sloooow) - chröme
2014/06/02 11:27:48
Yes, this one is still valuable. It covers the ca
| |
241 for (std::vector<webrtc::StatsReport>::const_iterator it = reports.begin(); | 244 for (std::vector<webrtc::StatsReport>::const_iterator it = reports.begin(); |
242 it != reports.end(); ++it) { | 245 it != reports.end(); ++it) { |
243 if (it->values.size() > 0) { | 246 if (it->values.size() > 0) { |
244 AddReport(*it); | 247 AddReport(*it); |
245 } | 248 } |
246 } | 249 } |
250 | |
251 // Record the getSync operation as done before calling into Blink so that | |
252 // we don't skew the perf measurements of the native code with whatever the | |
253 // callback might be doing. | |
254 TRACE_EVENT_ASYNC_END0("webrtc", "getStats_Native", this); | |
255 | |
247 request_->requestSucceeded(response_); | 256 request_->requestSucceeded(response_); |
248 } | 257 } |
249 | 258 |
250 private: | 259 private: |
251 void AddReport(const webrtc::StatsReport& report) { | 260 void AddReport(const webrtc::StatsReport& report) { |
252 int idx = response_->addReport(blink::WebString::fromUTF8(report.id), | 261 int idx = response_->addReport(blink::WebString::fromUTF8(report.id), |
253 blink::WebString::fromUTF8(report.type), | 262 blink::WebString::fromUTF8(report.type), |
254 report.timestamp); | 263 report.timestamp); |
255 for (webrtc::StatsReport::Values::const_iterator value_it = | 264 for (webrtc::StatsReport::Values::const_iterator value_it = |
256 report.values.begin(); | 265 report.values.begin(); |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
861 webrtc::SessionDescriptionInterface* native_desc = | 870 webrtc::SessionDescriptionInterface* native_desc = |
862 dependency_factory_->CreateSessionDescription(type, sdp, error); | 871 dependency_factory_->CreateSessionDescription(type, sdp, error); |
863 | 872 |
864 LOG_IF(ERROR, !native_desc) << "Failed to create native session description." | 873 LOG_IF(ERROR, !native_desc) << "Failed to create native session description." |
865 << " Type: " << type << " SDP: " << sdp; | 874 << " Type: " << type << " SDP: " << sdp; |
866 | 875 |
867 return native_desc; | 876 return native_desc; |
868 } | 877 } |
869 | 878 |
870 } // namespace content | 879 } // namespace content |
OLD | NEW |