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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 namespace blink { | 28 namespace blink { |
29 | 29 |
30 RTCStatsResponse* RTCStatsResponse::create() | 30 RTCStatsResponse* RTCStatsResponse::create() |
31 { | 31 { |
32 return new RTCStatsResponse(); | 32 return new RTCStatsResponse(); |
33 } | 33 } |
34 | 34 |
35 RTCStatsResponse::RTCStatsResponse() | 35 RTCStatsResponse::RTCStatsResponse() |
36 { | 36 { |
37 ScriptWrappable::init(this); | |
38 } | 37 } |
39 | 38 |
40 RTCStatsReport* RTCStatsResponse::namedItem(const AtomicString& name) | 39 RTCStatsReport* RTCStatsResponse::namedItem(const AtomicString& name) |
41 { | 40 { |
42 if (m_idmap.find(name) != m_idmap.end()) | 41 if (m_idmap.find(name) != m_idmap.end()) |
43 return m_result[m_idmap.get(name)]; | 42 return m_result[m_idmap.get(name)]; |
44 return nullptr; | 43 return nullptr; |
45 } | 44 } |
46 | 45 |
47 size_t RTCStatsResponse::addReport(const String& id, const String& type, double
timestamp) | 46 size_t RTCStatsResponse::addReport(const String& id, const String& type, double
timestamp) |
48 { | 47 { |
49 m_result.append(RTCStatsReport::create(id, type, timestamp)); | 48 m_result.append(RTCStatsReport::create(id, type, timestamp)); |
50 m_idmap.add(id, m_result.size() - 1); | 49 m_idmap.add(id, m_result.size() - 1); |
51 return m_result.size() - 1; | 50 return m_result.size() - 1; |
52 } | 51 } |
53 | 52 |
54 void RTCStatsResponse::addStatistic(size_t report, const String& name, const Str
ing& value) | 53 void RTCStatsResponse::addStatistic(size_t report, const String& name, const Str
ing& value) |
55 { | 54 { |
56 ASSERT_WITH_SECURITY_IMPLICATION(report >= 0 && report < m_result.size()); | 55 ASSERT_WITH_SECURITY_IMPLICATION(report >= 0 && report < m_result.size()); |
57 m_result[report]->addStatistic(name, value); | 56 m_result[report]->addStatistic(name, value); |
58 } | 57 } |
59 | 58 |
60 void RTCStatsResponse::trace(Visitor* visitor) | 59 void RTCStatsResponse::trace(Visitor* visitor) |
61 { | 60 { |
62 visitor->trace(m_result); | 61 visitor->trace(m_result); |
63 RTCStatsResponseBase::trace(visitor); | 62 RTCStatsResponseBase::trace(visitor); |
64 } | 63 } |
65 | 64 |
66 } // namespace blink | 65 } // namespace blink |
OLD | NEW |