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

Unified Diff: content/gpu/gpu_child_thread.cc

Issue 2497833002: support multiple log message handlers in base/logging.h (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/proximity_auth/logging/logging_unittest.cc ('k') | content/gpu/gpu_main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/gpu/gpu_child_thread.cc
diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc
index a1076a99dcf5aa0ac59768c094f6a3d057d3c841..9a16b63b3c6b7189a523d28f586ec383c80a9c61 100644
--- a/content/gpu/gpu_child_thread.cc
+++ b/content/gpu/gpu_child_thread.cc
@@ -61,14 +61,12 @@ static base::LazyInstance<scoped_refptr<ThreadSafeSender> >
g_thread_safe_sender = LAZY_INSTANCE_INITIALIZER;
bool GpuProcessLogMessageHandler(int severity,
- const char* file, int line,
- size_t message_start,
+ const std::string& file,
+ int line,
const std::string& str) {
- std::string header = str.substr(0, message_start);
- std::string message = str.substr(message_start);
-
+ std::string header = file + "(" + std::to_string(line) + "):";
g_thread_safe_sender.Get()->Send(
- new GpuHostMsg_OnLogMessage(severity, header, message));
+ new GpuHostMsg_OnLogMessage(severity, header, str));
return false;
}
@@ -195,7 +193,8 @@ GpuChildThread::~GpuChildThread() {
void GpuChildThread::Shutdown() {
ChildThreadImpl::Shutdown();
- logging::SetLogMessageHandler(NULL);
+ if (!in_browser_process_)
+ logging::RemoveLogMessageHandler(GpuProcessLogMessageHandler);
}
void GpuChildThread::Init(const base::Time& process_start_time) {
@@ -333,7 +332,7 @@ void GpuChildThread::OnInitialize(const gpu::GpuPreferences& gpu_preferences) {
// We don't need to pipe log messages if we are running the GPU thread in
// the browser process.
if (!in_browser_process_)
- logging::SetLogMessageHandler(GpuProcessLogMessageHandler);
+ logging::AddLogMessageHandler(GpuProcessLogMessageHandler);
gpu::SyncPointManager* sync_point_manager = nullptr;
// Note SyncPointManager from ContentGpuClient cannot be owned by this.
« no previous file with comments | « components/proximity_auth/logging/logging_unittest.cc ('k') | content/gpu/gpu_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698