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

Unified Diff: content/gpu/gpu_main.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 | « content/gpu/gpu_child_thread.cc ('k') | ios/chrome/browser/crash_report/breakpad_helper.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/gpu/gpu_main.cc
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index 51c2868899c077360575fbf89cab0518e99bc7a0..0394165c9698e85de5da787f491a9777eac8996e 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -102,13 +102,12 @@ base::LazyInstance<GpuChildThread::DeferredMessages> deferred_messages =
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) + "):";
deferred_messages.Get().push(
- new GpuHostMsg_OnLogMessage(severity, header, message));
+ new GpuHostMsg_OnLogMessage(severity, header, str));
return false;
}
@@ -191,7 +190,7 @@ int GpuMain(const MainFunctionParams& parameters) {
#endif
- logging::SetLogMessageHandler(GpuProcessLogMessageHandler);
+ logging::AddLogMessageHandler(GpuProcessLogMessageHandler);
#if defined(OS_WIN)
// OK to use default non-UI message loop because all GPU windows run on
@@ -249,7 +248,7 @@ int GpuMain(const MainFunctionParams& parameters) {
const bool init_success = gpu_init.InitializeAndStartSandbox(command_line);
const bool dead_on_arrival = !init_success;
- logging::SetLogMessageHandler(NULL);
+ logging::RemoveLogMessageHandler(GpuProcessLogMessageHandler);
GetContentClient()->SetGpuInfo(gpu_init.gpu_info());
std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory;
« no previous file with comments | « content/gpu/gpu_child_thread.cc ('k') | ios/chrome/browser/crash_report/breakpad_helper.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698