| OLD | NEW | 
| (Empty) |  | 
 |   1 // Copyright 2016 The Chromium Authors. All rights reserved. | 
 |   2 // Use of this source code is governed by a BSD-style license that can be | 
 |   3 // found in the LICENSE file. | 
 |   4  | 
 |   5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_RTC_STATS_DICTIONARY_H_ | 
 |   6 #define CHROME_BROWSER_MEDIA_WEBRTC_RTC_STATS_DICTIONARY_H_ | 
 |   7  | 
 |   8 #include <string> | 
 |   9 #include <vector> | 
 |  10  | 
 |  11 #include "base/memory/ref_counted.h" | 
 |  12 #include "base/values.h" | 
 |  13  | 
 |  14 namespace content { | 
 |  15  | 
 |  16 class RTCStatsDictionary; | 
 |  17  | 
 |  18 class RTCStatsReportDictionary | 
 |  19     : public base::RefCounted<RTCStatsReportDictionary> { | 
 |  20  public: | 
 |  21   explicit RTCStatsReportDictionary( | 
 |  22       std::unique_ptr<base::DictionaryValue> report); | 
 |  23  | 
 |  24   std::unique_ptr<RTCStatsDictionary> Get(const std::string id); | 
 |  25   std::vector<RTCStatsDictionary> Filter( | 
 |  26       bool(*filter)(const RTCStatsDictionary& dictionary)); | 
 |  27  | 
 |  28  private: | 
 |  29   friend class base::RefCounted<RTCStatsReportDictionary>; | 
 |  30   ~RTCStatsReportDictionary(); | 
 |  31  | 
 |  32   std::unique_ptr<base::DictionaryValue> report_; | 
 |  33 }; | 
 |  34  | 
 |  35 class RTCStatsDictionary { | 
 |  36  public: | 
 |  37   RTCStatsDictionary(RTCStatsReportDictionary* report, | 
 |  38                      const base::DictionaryValue* stats); | 
 |  39   RTCStatsDictionary(const RTCStatsDictionary& other); | 
 |  40   ~RTCStatsDictionary(); | 
 |  41  | 
 |  42   bool IsBoolean(const std::string& key) const; | 
 |  43   bool GetBoolean(const std::string& key) const; | 
 |  44  | 
 |  45   bool IsNumber(const std::string& key) const; | 
 |  46   double GetNumber(const std::string& key) const; | 
 |  47  | 
 |  48   bool IsString(const std::string& key) const; | 
 |  49   std::string GetString(const std::string& key) const; | 
 |  50  | 
 |  51   bool IsSequenceBoolean(const std::string& key) const; | 
 |  52   std::vector<bool> GetSequenceBoolean(const std::string& key) const; | 
 |  53  | 
 |  54   bool IsSequenceNumber(const std::string& key) const; | 
 |  55   std::vector<double> GetSequenceNumber(const std::string& key) const; | 
 |  56  | 
 |  57   bool IsSequenceString(const std::string& key) const; | 
 |  58   std::vector<std::string> GetSequenceString(const std::string& key) const; | 
 |  59  | 
 |  60  private: | 
 |  61   bool GetBoolean(const std::string& key, bool* out) const; | 
 |  62   bool GetNumber(const std::string& key, double* out) const; | 
 |  63   bool GetString(const std::string& key, std::string* out) const; | 
 |  64   bool GetSequenceBoolean( | 
 |  65       const std::string& key, std::vector<bool>* out) const; | 
 |  66   bool GetSequenceNumber( | 
 |  67       const std::string& key, std::vector<double>* out) const; | 
 |  68   bool GetSequenceString( | 
 |  69       const std::string& key, std::vector<std::string>* out) const; | 
 |  70  | 
 |  71   // The reference keeps the report alive which indirectly owns |stats_|. | 
 |  72   scoped_refptr<RTCStatsReportDictionary> report_; | 
 |  73   const base::DictionaryValue* stats_; | 
 |  74 }; | 
 |  75  | 
 |  76 }  // namespace content | 
 |  77  | 
 |  78 #endif  // CHROME_BROWSER_MEDIA_WEBRTC_RTC_STATS_DICTIONARY_H_ | 
| OLD | NEW |