Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Side by Side Diff: remoting/host/native_messaging/log_message_handler.cc

Issue 2857983008: Fixing a crash in our native messaging host binaries (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698