OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "remoting/client/plugin/chromoting_instance.h" | 5 #include "remoting/client/plugin/chromoting_instance.h" |
6 | 6 |
7 #include <nacl_io/nacl_io.h> | 7 #include <nacl_io/nacl_io.h> |
8 #include <sys/mount.h> | 8 #include <sys/mount.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 data->SetDouble("maxRoundtripLatency", perf_tracker_.round_trip_ms().Max()); | 1036 data->SetDouble("maxRoundtripLatency", perf_tracker_.round_trip_ms().Max()); |
1037 PostLegacyJsonMessage("onPerfStats", std::move(data)); | 1037 PostLegacyJsonMessage("onPerfStats", std::move(data)); |
1038 } | 1038 } |
1039 | 1039 |
1040 // static | 1040 // static |
1041 void ChromotingInstance::RegisterLogMessageHandler() { | 1041 void ChromotingInstance::RegisterLogMessageHandler() { |
1042 base::AutoLock lock(g_logging_lock.Get()); | 1042 base::AutoLock lock(g_logging_lock.Get()); |
1043 | 1043 |
1044 // Set up log message handler. | 1044 // Set up log message handler. |
1045 // This is not thread-safe so we need it within our lock. | 1045 // This is not thread-safe so we need it within our lock. |
1046 logging::SetLogMessageHandler(&LogToUI); | 1046 logging::AddLogMessageHandler(&LogToUI); |
1047 } | 1047 } |
1048 | 1048 |
1049 void ChromotingInstance::RegisterLoggingInstance() { | 1049 void ChromotingInstance::RegisterLoggingInstance() { |
1050 base::AutoLock lock(g_logging_lock.Get()); | 1050 base::AutoLock lock(g_logging_lock.Get()); |
1051 g_logging_instance = pp_instance(); | 1051 g_logging_instance = pp_instance(); |
1052 } | 1052 } |
1053 | 1053 |
1054 void ChromotingInstance::UnregisterLoggingInstance() { | 1054 void ChromotingInstance::UnregisterLoggingInstance() { |
1055 base::AutoLock lock(g_logging_lock.Get()); | 1055 base::AutoLock lock(g_logging_lock.Get()); |
1056 | 1056 |
1057 // Don't unregister unless we're the currently registered instance. | 1057 // Don't unregister unless we're the currently registered instance. |
1058 if (pp_instance() != g_logging_instance) | 1058 if (pp_instance() != g_logging_instance) |
1059 return; | 1059 return; |
1060 | 1060 |
1061 // Unregister this instance for logging. | 1061 // Unregister this instance for logging. |
1062 g_logging_instance = 0; | 1062 g_logging_instance = 0; |
1063 } | 1063 } |
1064 | 1064 |
1065 // static | 1065 // static |
1066 bool ChromotingInstance::LogToUI(int severity, const char* file, int line, | 1066 bool ChromotingInstance::LogToUI(int severity, const std::string& file, |
1067 size_t message_start, | 1067 int line, const std::string& str) { |
1068 const std::string& str) { | |
1069 PP_LogLevel log_level = PP_LOGLEVEL_ERROR; | 1068 PP_LogLevel log_level = PP_LOGLEVEL_ERROR; |
1070 switch (severity) { | 1069 switch (severity) { |
1071 case logging::LOG_INFO: | 1070 case logging::LOG_INFO: |
1072 log_level = PP_LOGLEVEL_TIP; | 1071 log_level = PP_LOGLEVEL_TIP; |
1073 break; | 1072 break; |
1074 case logging::LOG_WARNING: | 1073 case logging::LOG_WARNING: |
1075 log_level = PP_LOGLEVEL_WARNING; | 1074 log_level = PP_LOGLEVEL_WARNING; |
1076 break; | 1075 break; |
1077 case logging::LOG_ERROR: | 1076 case logging::LOG_ERROR: |
1078 case logging::LOG_FATAL: | 1077 case logging::LOG_FATAL: |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 if (is_custom_counts_histogram) { | 1126 if (is_custom_counts_histogram) { |
1128 uma.HistogramCustomCounts(histogram_name, value, histogram_min, | 1127 uma.HistogramCustomCounts(histogram_name, value, histogram_min, |
1129 histogram_max, histogram_buckets); | 1128 histogram_max, histogram_buckets); |
1130 } else { | 1129 } else { |
1131 uma.HistogramCustomTimes(histogram_name, value, histogram_min, | 1130 uma.HistogramCustomTimes(histogram_name, value, histogram_min, |
1132 histogram_max, histogram_buckets); | 1131 histogram_max, histogram_buckets); |
1133 } | 1132 } |
1134 } | 1133 } |
1135 | 1134 |
1136 } // namespace remoting | 1135 } // namespace remoting |
OLD | NEW |