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

Unified Diff: content/gpu/gpu_main.cc

Issue 2034393004: Allow multiple logging::LogMessage{Handler,Listener}s Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments, format Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/gpu/gpu_main.cc
diff --git a/content/gpu/gpu_main.cc b/content/gpu/gpu_main.cc
index cc326628adae5463536525a2d2c8c478547c1453..4c9e33e48fddd331b937b47111879fc80ca33059 100644
--- a/content/gpu/gpu_main.cc
+++ b/content/gpu/gpu_main.cc
@@ -119,15 +119,14 @@ bool StartSandboxWindows(const sandbox::SandboxInterfaceInfo*);
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& str) {
+void GpuProcessLogMessageListener(int severity,
+ const char* file, int line,
+ size_t message_start,
+ const std::string& str) {
std::string header = str.substr(0, message_start);
std::string message = str.substr(message_start);
deferred_messages.Get().push(
new GpuHostMsg_OnLogMessage(severity, header, message));
- return false;
}
} // namespace anonymous
@@ -165,7 +164,7 @@ int GpuMain(const MainFunctionParams& parameters) {
#endif
- logging::SetLogMessageHandler(GpuProcessLogMessageHandler);
+ logging::AddLogMessageListener(GpuProcessLogMessageListener);
if (command_line.HasSwitch(switches::kSupportsDualGpus)) {
std::string types = command_line.GetSwitchValueASCII(
@@ -384,7 +383,7 @@ int GpuMain(const MainFunctionParams& parameters) {
dead_on_arrival = true;
}
- logging::SetLogMessageHandler(NULL);
+ logging::RemoveLogMessageListener(GpuProcessLogMessageListener);
std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory;
if (gpu::GetNativeGpuMemoryBufferType() != gfx::EMPTY_BUFFER)

Powered by Google App Engine
This is Rietveld 408576698