| OLD | NEW |
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 ThreadLogMessagesMaster() { | 39 ThreadLogMessagesMaster() { |
| 40 DCHECK(!tls_.initialized()); | 40 DCHECK(!tls_.initialized()); |
| 41 tls_.Initialize(nullptr); | 41 tls_.Initialize(nullptr); |
| 42 DCHECK(tls_.initialized()); | 42 DCHECK(tls_.initialized()); |
| 43 | 43 |
| 44 DCHECK(!logging::GetLogMessageHandler()); | 44 DCHECK(!logging::GetLogMessageHandler()); |
| 45 logging::SetLogMessageHandler(LogMessageHandler); | 45 logging::SetLogMessageHandler(LogMessageHandler); |
| 46 } | 46 } |
| 47 | 47 |
| 48 ~ThreadLogMessagesMaster() { | 48 ~ThreadLogMessagesMaster() { |
| 49 DCHECK_EQ(logging::GetLogMessageHandler(), LogMessageHandler); | 49 DCHECK_EQ(logging::GetLogMessageHandler(), &LogMessageHandler); |
| 50 logging::SetLogMessageHandler(nullptr); | 50 logging::SetLogMessageHandler(nullptr); |
| 51 | 51 |
| 52 tls_.Free(); | 52 tls_.Free(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void SetThreadMessageList(std::vector<std::string>* message_list) { | 55 void SetThreadMessageList(std::vector<std::string>* message_list) { |
| 56 DCHECK_EQ(logging::GetLogMessageHandler(), LogMessageHandler); | 56 DCHECK_EQ(logging::GetLogMessageHandler(), &LogMessageHandler); |
| 57 DCHECK_NE(tls_.Get() != nullptr, message_list != nullptr); | 57 DCHECK_NE(tls_.Get() != nullptr, message_list != nullptr); |
| 58 tls_.Set(message_list); | 58 tls_.Set(message_list); |
| 59 } | 59 } |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 static bool LogMessageHandler(logging::LogSeverity severity, | 62 static bool LogMessageHandler(logging::LogSeverity severity, |
| 63 const char* file_path, | 63 const char* file_path, |
| 64 int line, | 64 int line, |
| 65 size_t message_start, | 65 size_t message_start, |
| 66 const std::string& string) { | 66 const std::string& string) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 92 ThreadLogMessages::ThreadLogMessages() | 92 ThreadLogMessages::ThreadLogMessages() |
| 93 : log_messages_() { | 93 : log_messages_() { |
| 94 g_master.Get().SetThreadMessageList(&log_messages_); | 94 g_master.Get().SetThreadMessageList(&log_messages_); |
| 95 } | 95 } |
| 96 | 96 |
| 97 ThreadLogMessages::~ThreadLogMessages() { | 97 ThreadLogMessages::~ThreadLogMessages() { |
| 98 g_master.Get().SetThreadMessageList(nullptr); | 98 g_master.Get().SetThreadMessageList(nullptr); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace crashpad | 101 } // namespace crashpad |
| OLD | NEW |