From 06a57e831ec8c749a216849f463481abe30125a8 Mon Sep 17 00:00:00 2001 From: sergeyu Date: Thu, 19 Feb 2015 16:54:13 -0800 Subject: [PATCH] Fix remoting client to log renderer type in the JS console. Previously renderer type was logged only for PNaCl version of the plugin. BUG=459103 Review URL: https://codereview.chromium.org/925993003 Cr-Commit-Position: refs/heads/master@{#317200} --- remoting/client/plugin/chromoting_instance.cc | 17 +++++++++++++++-- remoting/client/plugin/chromoting_instance.h | 3 +++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc index c75f57a638d7..c5d657776aa4 100644 --- a/remoting/client/plugin/chromoting_instance.cc +++ b/remoting/client/plugin/chromoting_instance.cc @@ -642,7 +642,7 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { if (data.GetBoolean("enableVideoDecodeRenderer", &enable_video_decode_renderer) && enable_video_decode_renderer) { - LOG(ERROR) << "Initializing 3D renderer."; + LogToWebapp("Initializing 3D renderer."); video_renderer_.reset(new PepperVideoRenderer3D()); if (!video_renderer_->Initialize(this, context_, this)) video_renderer_.reset(); @@ -650,7 +650,7 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { // If we didn't initialize 3D renderer then use the 2D renderer. if (!video_renderer_) { - LOG(ERROR) << "Initializing 2D renderer."; + LogToWebapp("Initializing 2D renderer."); video_renderer_.reset(new PepperVideoRenderer2D()); if (!video_renderer_->Initialize(this, context_, this)) video_renderer_.reset(); @@ -1136,4 +1136,17 @@ bool ChromotingInstance::IsConnected() { (client_->connection_state() == protocol::ConnectionToHost::CONNECTED); } +void ChromotingInstance::LogToWebapp(const std::string& message) { + DCHECK(plugin_task_runner_->BelongsToCurrentThread()); + + LOG(ERROR) << message; + +#if !defined(OS_NACL) + // Log messages are forwarded to the webapp only in PNaCl version of the + // plugin, so ProcessLogToUI() needs to be called explicitly in the non-PNaCl + // version. + ProcessLogToUI(message); +#endif // !defined(OS_NACL) +} + } // namespace remoting diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h index f6e8d32e9fc4..2d2cbaadae8a 100644 --- a/remoting/client/plugin/chromoting_instance.h +++ b/remoting/client/plugin/chromoting_instance.h @@ -230,6 +230,9 @@ class ChromotingInstance : public ClientUserInterface, bool pairing_supported, const protocol::SecretFetchedCallback& secret_fetched_callback); + // Helper to log messages in the JS console in the webapp. + void LogToWebapp(const std::string& message); + bool initialized_; PepperPluginThreadDelegate plugin_thread_delegate_; -- 2.11.4.GIT