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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 // callback might be doing. | 399 // callback might be doing. |
400 TRACE_EVENT_ASYNC_END0("webrtc", "getStats_Native", this); | 400 TRACE_EVENT_ASYNC_END0("webrtc", "getStats_Native", this); |
401 request_->requestSucceeded(response); | 401 request_->requestSucceeded(response); |
402 request_ = nullptr; // must be freed on the main thread. | 402 request_ = nullptr; // must be freed on the main thread. |
403 } | 403 } |
404 | 404 |
405 void AddReport(LocalRTCStatsResponse* response, const Report& report) { | 405 void AddReport(LocalRTCStatsResponse* response, const Report& report) { |
406 int idx = response->addReport(blink::WebString::fromUTF8(report.id), | 406 int idx = response->addReport(blink::WebString::fromUTF8(report.id), |
407 blink::WebString::fromUTF8(report.type), | 407 blink::WebString::fromUTF8(report.type), |
408 report.timestamp); | 408 report.timestamp); |
| 409 blink::WebString name, value_str; |
409 for (const auto& value : report.values) { | 410 for (const auto& value : report.values) { |
410 response->addStatistic(idx, | 411 const StatsReport::ValuePtr& v = value.second; |
411 blink::WebString::fromUTF8(value.second->display_name()), | 412 name = blink::WebString::fromUTF8(value.second->display_name()); |
412 blink::WebString::fromUTF8(value.second->ToString())); | 413 |
| 414 if (v->type() == StatsReport::Value::kString) |
| 415 value_str = blink::WebString::fromUTF8(v->string_val()); |
| 416 if (v->type() == StatsReport::Value::kStaticString) |
| 417 value_str = blink::WebString::fromUTF8(v->static_string_val()); |
| 418 else |
| 419 value_str = blink::WebString::fromUTF8(v->ToString()); |
| 420 |
| 421 response->addStatistic(idx, name, value_str); |
413 } | 422 } |
414 } | 423 } |
415 | 424 |
416 rtc::scoped_refptr<LocalRTCStatsRequest> request_; | 425 rtc::scoped_refptr<LocalRTCStatsRequest> request_; |
417 const scoped_refptr<base::SingleThreadTaskRunner> main_thread_; | 426 const scoped_refptr<base::SingleThreadTaskRunner> main_thread_; |
418 base::ThreadChecker signaling_thread_checker_; | 427 base::ThreadChecker signaling_thread_checker_; |
419 }; | 428 }; |
420 | 429 |
421 void GetStatsOnSignalingThread( | 430 void GetStatsOnSignalingThread( |
422 const scoped_refptr<webrtc::PeerConnectionInterface>& pc, | 431 const scoped_refptr<webrtc::PeerConnectionInterface>& pc, |
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1459 base::WaitableEvent event(false, false); | 1468 base::WaitableEvent event(false, false); |
1460 thread->PostTask(FROM_HERE, | 1469 thread->PostTask(FROM_HERE, |
1461 base::Bind(&RunSynchronousClosure, closure, | 1470 base::Bind(&RunSynchronousClosure, closure, |
1462 base::Unretained(trace_event_name), | 1471 base::Unretained(trace_event_name), |
1463 base::Unretained(&event))); | 1472 base::Unretained(&event))); |
1464 event.Wait(); | 1473 event.Wait(); |
1465 } | 1474 } |
1466 } | 1475 } |
1467 | 1476 |
1468 } // namespace content | 1477 } // namespace content |
OLD | NEW |