LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/system_wrappers/source - field_trial_default.cc (source / functions) Hit Total Coverage
Test: output.info Lines: 0 25 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
       2             : //
       3             : // Use of this source code is governed by a BSD-style license
       4             : // that can be found in the LICENSE file in the root of the source
       5             : // tree. An additional intellectual property rights grant can be found
       6             : // in the file PATENTS.  All contributing project authors may
       7             : // be found in the AUTHORS file in the root of the source tree.
       8             : //
       9             : 
      10             : #include "webrtc/system_wrappers/include/field_trial.h"
      11             : #include "webrtc/system_wrappers/include/field_trial_default.h"
      12             : 
      13             : #include <string>
      14             : 
      15             : // Simple field trial implementation, which allows client to
      16             : // specify desired flags in InitFieldTrialsFromString.
      17             : namespace webrtc {
      18             : namespace field_trial {
      19             : 
      20             : static const char *trials_init_string = NULL;
      21             : 
      22           0 : std::string FindFullName(const std::string& name) {
      23           0 :   if (trials_init_string == NULL)
      24           0 :     return std::string();
      25             : 
      26           0 :   std::string trials_string(trials_init_string);
      27           0 :   if (trials_string.empty())
      28           0 :     return std::string();
      29             : 
      30             :   static const char kPersistentStringSeparator = '/';
      31           0 :   size_t next_item = 0;
      32           0 :   while (next_item < trials_string.length()) {
      33             : 
      34             :     // Find next name/value pair in field trial configuration string.
      35             :     size_t field_name_end = trials_string.find(
      36           0 :         kPersistentStringSeparator, next_item);
      37           0 :     if (field_name_end == trials_string.npos || field_name_end == next_item)
      38             :       break;
      39           0 :     size_t field_value_end = trials_string.find(
      40           0 :         kPersistentStringSeparator, field_name_end + 1);
      41           0 :     if (field_value_end == trials_string.npos ||
      42           0 :         field_value_end == field_name_end + 1)
      43             :       break;
      44             :     std::string field_name(trials_string, next_item,
      45           0 :         field_name_end - next_item);
      46             :     std::string field_value(trials_string, field_name_end + 1,
      47           0 :         field_value_end - field_name_end - 1);
      48           0 :     next_item = field_value_end + 1;
      49             : 
      50           0 :     if (name == field_name)
      51           0 :       return field_value;
      52             :   }
      53           0 :   return std::string();
      54             : }
      55             : 
      56             : // Optionally initialize field trial from a string.
      57           0 : void InitFieldTrialsFromString(const char* trials_string) {
      58           0 :   trials_init_string = trials_string;
      59           0 : }
      60             : 
      61           0 : const char* GetFieldTrialString() {
      62           0 :   return trials_init_string;
      63             : }
      64             : 
      65             : }  // namespace field_trial
      66             : }  // namespace webrtc

Generated by: LCOV version 1.13