| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "init_webrtc.h" | 5 #include "init_webrtc.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/metrics/field_trial.h" | |
| 12 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 13 #include "base/native_library.h" | 12 #include "base/native_library.h" |
| 14 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 15 #include "base/trace_event/trace_event.h" | 14 #include "base/trace_event/trace_event.h" |
| 16 #include "third_party/webrtc_overrides/webrtc/base/logging.h" | 15 #include "third_party/webrtc_overrides/webrtc/base/logging.h" |
| 17 #include "third_party/webrtc/system_wrappers/interface/cpu_info.h" | 16 #include "third_party/webrtc/system_wrappers/interface/cpu_info.h" |
| 18 #include "third_party/webrtc/system_wrappers/interface/event_tracer.h" | 17 #include "third_party/webrtc/system_wrappers/interface/event_tracer.h" |
| 19 | 18 |
| 20 const unsigned char* GetCategoryGroupEnabled(const char* category_group) { | 19 const unsigned char* GetCategoryGroupEnabled(const char* category_group) { |
| 21 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); | 20 return TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); |
| 22 } | 21 } |
| 23 | 22 |
| 24 void AddTraceEvent(char phase, | 23 void AddTraceEvent(char phase, |
| 25 const unsigned char* category_group_enabled, | 24 const unsigned char* category_group_enabled, |
| 26 const char* name, | 25 const char* name, |
| 27 unsigned long long id, | 26 unsigned long long id, |
| 28 int num_args, | 27 int num_args, |
| 29 const char** arg_names, | 28 const char** arg_names, |
| 30 const unsigned char* arg_types, | 29 const unsigned char* arg_types, |
| 31 const unsigned long long* arg_values, | 30 const unsigned long long* arg_values, |
| 32 unsigned char flags) { | 31 unsigned char flags) { |
| 33 TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_group_enabled, name, id, | 32 TRACE_EVENT_API_ADD_TRACE_EVENT(phase, category_group_enabled, name, id, |
| 34 num_args, arg_names, arg_types, arg_values, | 33 num_args, arg_names, arg_types, arg_values, |
| 35 NULL, flags); | 34 NULL, flags); |
| 36 } | 35 } |
| 37 | 36 |
| 38 namespace webrtc { | 37 namespace webrtc { |
| 39 // Define webrtc::field_trial::FindFullName to provide webrtc with a field trial | |
| 40 // implementation. | |
| 41 namespace field_trial { | |
| 42 std::string FindFullName(const std::string& trial_name) { | |
| 43 return base::FieldTrialList::FindFullName(trial_name); | |
| 44 } | |
| 45 } // namespace field_trial | |
| 46 | 38 |
| 47 // Define webrtc::metrics functions to provide webrtc with implementations. | 39 // Define webrtc::metrics functions to provide webrtc with implementations. |
| 48 namespace metrics { | 40 namespace metrics { |
| 49 | 41 |
| 50 // This class doesn't actually exist, so don't go looking for it :) | 42 // This class doesn't actually exist, so don't go looking for it :) |
| 51 // This type is just fwd declared here in order to use it as an opaque type | 43 // This type is just fwd declared here in order to use it as an opaque type |
| 52 // between the Histogram functions in this file. | 44 // between the Histogram functions in this file. |
| 53 class Histogram; | 45 class Histogram; |
| 54 | 46 |
| 55 Histogram* HistogramFactoryGetCounts( | 47 Histogram* HistogramFactoryGetCounts( |
| (...skipping 22 matching lines...) Expand all Loading... |
| 78 } // namespace webrtc | 70 } // namespace webrtc |
| 79 | 71 |
| 80 bool InitializeWebRtcModule() { | 72 bool InitializeWebRtcModule() { |
| 81 // Workaround for crbug.com/176522 | 73 // Workaround for crbug.com/176522 |
| 82 // On Linux, we can't fetch the number of cores after the sandbox has been | 74 // On Linux, we can't fetch the number of cores after the sandbox has been |
| 83 // initialized, so we call DetectNumberOfCores() here, to cache the value. | 75 // initialized, so we call DetectNumberOfCores() here, to cache the value. |
| 84 webrtc::CpuInfo::DetectNumberOfCores(); | 76 webrtc::CpuInfo::DetectNumberOfCores(); |
| 85 webrtc::SetupEventTracer(&GetCategoryGroupEnabled, &AddTraceEvent); | 77 webrtc::SetupEventTracer(&GetCategoryGroupEnabled, &AddTraceEvent); |
| 86 return true; | 78 return true; |
| 87 } | 79 } |
| OLD | NEW |