| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 RTCLegacyStatsReport* RTCStatsResponse::namedItem(const AtomicString& name) { | 35 RTCLegacyStatsReport* RTCStatsResponse::namedItem(const AtomicString& name) { |
| 36 if (m_idmap.find(name) != m_idmap.end()) | 36 if (m_idmap.find(name) != m_idmap.end()) |
| 37 return m_result[m_idmap.get(name)]; | 37 return m_result[m_idmap.get(name)]; |
| 38 return nullptr; | 38 return nullptr; |
| 39 } | 39 } |
| 40 | 40 |
| 41 void RTCStatsResponse::addStats(const WebRTCLegacyStats& stats) { | 41 void RTCStatsResponse::addStats(const WebRTCLegacyStats& stats) { |
| 42 m_result.push_back(RTCLegacyStatsReport::create(stats.id(), stats.type(), | 42 m_result.push_back(RTCLegacyStatsReport::create(stats.id(), stats.type(), |
| 43 stats.timestamp())); | 43 stats.timestamp())); |
| 44 m_idmap.add(stats.id(), m_result.size() - 1); | 44 m_idmap.insert(stats.id(), m_result.size() - 1); |
| 45 RTCLegacyStatsReport* report = m_result[m_result.size() - 1].get(); | 45 RTCLegacyStatsReport* report = m_result[m_result.size() - 1].get(); |
| 46 | 46 |
| 47 for (std::unique_ptr<WebRTCLegacyStatsMemberIterator> member( | 47 for (std::unique_ptr<WebRTCLegacyStatsMemberIterator> member( |
| 48 stats.iterator()); | 48 stats.iterator()); |
| 49 !member->isEnd(); member->next()) { | 49 !member->isEnd(); member->next()) { |
| 50 report->addStatistic(member->name(), member->valueToString()); | 50 report->addStatistic(member->name(), member->valueToString()); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 DEFINE_TRACE(RTCStatsResponse) { | 54 DEFINE_TRACE(RTCStatsResponse) { |
| 55 visitor->trace(m_result); | 55 visitor->trace(m_result); |
| 56 RTCStatsResponseBase::trace(visitor); | 56 RTCStatsResponseBase::trace(visitor); |
| 57 } | 57 } |
| 58 | 58 |
| 59 } // namespace blink | 59 } // namespace blink |
| OLD | NEW |