| Index: remoting/client/plugin/chromoting_instance.cc
|
| diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
|
| index 2c2ab84493cca4345e29b47d54b10d7a46870153..757783802d9d6fb02e98b2677f0a4c5e22c96196 100644
|
| --- a/remoting/client/plugin/chromoting_instance.cc
|
| +++ b/remoting/client/plugin/chromoting_instance.cc
|
| @@ -170,8 +170,8 @@ ChromotingInstance::ChromotingInstance(PP_Instance pp_instance)
|
| thread_wrapper_ =
|
| jingle_glue::JingleThreadWrapper::WrapTaskRunner(plugin_task_runner_);
|
|
|
| - // Register a global log handler.
|
| - ChromotingInstance::RegisterLogMessageHandler();
|
| + // Register a log listener.
|
| + log_to_ui_ = base::MakeUnique<LogToUI>();
|
|
|
| nacl_io_init_ppapi(pp_instance, pp::Module::Get()->get_browser_interface());
|
| mount("", "/etc", "memfs", 0, "");
|
| @@ -1036,15 +1036,6 @@ void ChromotingInstance::UpdatePerfStatsInUI() {
|
| PostLegacyJsonMessage("onPerfStats", std::move(data));
|
| }
|
|
|
| -// static
|
| -void ChromotingInstance::RegisterLogMessageHandler() {
|
| - base::AutoLock lock(g_logging_lock.Get());
|
| -
|
| - // Set up log message handler.
|
| - // This is not thread-safe so we need it within our lock.
|
| - logging::SetLogMessageHandler(&LogToUI);
|
| -}
|
| -
|
| void ChromotingInstance::RegisterLoggingInstance() {
|
| base::AutoLock lock(g_logging_lock.Get());
|
| g_logging_instance = pp_instance();
|
| @@ -1061,10 +1052,20 @@ void ChromotingInstance::UnregisterLoggingInstance() {
|
| g_logging_instance = 0;
|
| }
|
|
|
| -// static
|
| -bool ChromotingInstance::LogToUI(int severity, const char* file, int line,
|
| - size_t message_start,
|
| - const std::string& str) {
|
| +class LogToUI : logging::LogMessageListener {
|
| + public:
|
| + void OnMessage(int severity,
|
| + const char* file,
|
| + int line,
|
| + size_t message_start,
|
| + const std::string& str) override;
|
| +};
|
| +
|
| +void LogToUI::OnMessage(int severity,
|
| + const char* file,
|
| + int line,
|
| + size_t message_start,
|
| + const std::string& str) {
|
| PP_LogLevel log_level = PP_LOGLEVEL_ERROR;
|
| switch (severity) {
|
| case logging::LOG_INFO:
|
| @@ -1097,8 +1098,6 @@ bool ChromotingInstance::LogToUI(int severity, const char* file, int line,
|
| // may crash before the message is delivered to the console.
|
| if (severity == logging::LOG_FATAL)
|
| base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1));
|
| -
|
| - return false;
|
| }
|
|
|
| bool ChromotingInstance::IsConnected() {
|
|
|