15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/*
25c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (C) 2012 Google Inc. All rights reserved.
35c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without
55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * modification, are permitted provided that the following conditions
65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * are met:
75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 1.  Redistributions of source code must retain the above copyright
85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *     notice, this list of conditions and the following disclaimer.
95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 2.  Redistributions in binary form must reproduce the above copyright
105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *     notice, this list of conditions and the following disclaimer in the
115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *     documentation and/or other materials provided with the distribution.
125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) */
245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#ifndef RTCStatsReport_h
265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#define RTCStatsReport_h
275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
28197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch#include "bindings/core/v8/ScriptWrappable.h"
2953e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "wtf/HashMap.h"
3053e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "wtf/Vector.h"
31e52495584422c5edb5b2944981473a2e208da323Torne (Richard Coles)#include "wtf/text/StringHash.h"
3253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "wtf/text/WTFString.h"
335c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
34c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink {
355c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
36197021e6b966cfb06891637935ef33fff06433d1Ben Murdochclass RTCStatsReport FINAL : public GarbageCollectedFinalized<RTCStatsReport>, public ScriptWrappable {
377242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    DEFINE_WRAPPERTYPEINFO();
385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)public:
39197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    static RTCStatsReport* create(const String& id, const String& type, double timestamp);
405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
41926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    double timestamp() const { return m_timestamp; }
42926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    String id() { return m_id; }
43926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    String type() { return m_type; }
44926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    String stat(const String& name) { return m_stats.get(name); }
45926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    Vector<String> names() const;
465c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
47926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // DEPRECATED
48197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    RTCStatsReport* local();
49926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // DEPRECATED
50197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    RTCStatsReport* remote();
51926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
52926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    void addStatistic(const String& name, const String& value);
535c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
54d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)    void trace(Visitor*) { }
55d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles)
565c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)private:
57926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    RTCStatsReport(const String& id, const String& type, double timestamp);
585c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
59926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    String m_id;
60926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    String m_type;
61926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    double m_timestamp;
62926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    HashMap<String, String> m_stats;
635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)};
645c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
65c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)} // namespace blink
665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
675c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif // RTCStatsReport_h
68