| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/host/native_messaging/log_message_handler.h" | 5 #include "remoting/host/native_messaging/log_message_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 std::string message = str.substr(message_start); | 118 std::string message = str.substr(message_start); |
| 119 base::TrimWhitespaceASCII(message, base::TRIM_ALL, &message); | 119 base::TrimWhitespaceASCII(message, base::TRIM_ALL, &message); |
| 120 | 120 |
| 121 std::unique_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue); | 121 std::unique_ptr<base::DictionaryValue> dictionary(new base::DictionaryValue); |
| 122 dictionary->SetString("type", kDebugMessageTypeName); | 122 dictionary->SetString("type", kDebugMessageTypeName); |
| 123 dictionary->SetString("severity", severity_string); | 123 dictionary->SetString("severity", severity_string); |
| 124 dictionary->SetString("message", message); | 124 dictionary->SetString("message", message); |
| 125 dictionary->SetString("file", file); | 125 dictionary->SetString("file", file); |
| 126 dictionary->SetInteger("line", line); | 126 dictionary->SetInteger("line", line); |
| 127 | 127 |
| 128 // Protect against this instance being torn down after the delegate is run. |
| 129 base::WeakPtr<LogMessageHandler> self = weak_ptr_factory_.GetWeakPtr(); |
| 128 delegate_.Run(std::move(dictionary)); | 130 delegate_.Run(std::move(dictionary)); |
| 129 | 131 |
| 130 suppress_logging_ = false; | 132 if (self) { |
| 133 suppress_logging_ = false; |
| 134 } |
| 131 } | 135 } |
| 132 | 136 |
| 133 } // namespace remoting | 137 } // namespace remoting |
| OLD | NEW |