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

Side by Side Diff: remoting/host/plugin/host_log_handler.cc

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: willchan comments + rebase Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/plugin/host_log_handler.h" 5 #include "remoting/host/plugin/host_log_handler.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "remoting/base/util.h" 8 #include "remoting/base/util.h"
9 #include "remoting/host/plugin/host_script_object.h" 9 #include "remoting/host/plugin/host_script_object.h"
10 10
11 namespace remoting { 11 namespace remoting {
12 12
13 // Records whether or not we have a scriptable object registered for logging. 13 // Records whether or not we have a scriptable object registered for logging.
14 // This is set inside the lock, but is read (in LogToUI) outside of a lock so 14 // This is set inside the lock, but is read (in LogToUI) outside of a lock so
15 // that we don't needlessly slow down the system when we log. 15 // that we don't needlessly slow down the system when we log.
16 static bool g_has_logging_scriptable_object = false; 16 static bool g_has_logging_scriptable_object = false;
17 17
18 // The lock that protects the logging globals. 18 // The lock that protects the logging globals.
19 static base::LazyInstance<base::Lock, 19 static base::LazyInstance<base::Lock,
20 base::LeakyLazyInstanceTraits<base::Lock> > 20 base::LeakyLazyInstanceTraits<base::Lock> >
21 g_logging_lock(base::LINKER_INITIALIZED); 21 g_logging_lock = LAZY_INSTANCE_INITIALIZER;
22 22
23 // The scriptable object that will display the log information to the user. 23 // The scriptable object that will display the log information to the user.
24 static HostNPScriptObject* g_logging_scriptable_object = NULL; 24 static HostNPScriptObject* g_logging_scriptable_object = NULL;
25 25
26 // The previously registered LogMessageHandler. If not NULL, we call this after 26 // The previously registered LogMessageHandler. If not NULL, we call this after
27 // we're doing processing the log message. 27 // we're doing processing the log message.
28 static logging::LogMessageHandlerFunction g_logging_old_handler = NULL; 28 static logging::LogMessageHandlerFunction g_logging_old_handler = NULL;
29 29
30 // Set to true when we register our global log handler so that we don't try 30 // Set to true when we register our global log handler so that we don't try
31 // to register it twice. 31 // to register it twice.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 115
116 // Call the next log handler in the chain. 116 // Call the next log handler in the chain.
117 if (g_logging_old_handler) 117 if (g_logging_old_handler)
118 return (g_logging_old_handler)(severity, file, line, message_start, str); 118 return (g_logging_old_handler)(severity, file, line, message_start, str);
119 119
120 return false; 120 return false;
121 } 121 }
122 122
123 } // namespace remoting 123 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/local_input_monitor_thread_win.cc ('k') | third_party/leveldatabase/env_chromium.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698