Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_HOST_PLUGIN_HOST_LOG_HANDLER_H_ | |
| 6 #define REMOTING_HOST_PLUGIN_HOST_LOG_HANDLER_H_ | |
| 7 | |
| 8 #include "base/string16.h" | |
|
Wez
2011/08/31 01:30:16
I don't think we need string16 here?
garykac
2011/08/31 23:59:46
Done.
| |
| 9 #include "base/threading/platform_thread.h" | |
|
Wez
2011/08/31 01:30:16
I don't think we need platform threads here?
garykac
2011/08/31 23:59:46
Done.
| |
| 10 | |
| 11 namespace remoting { | |
| 12 | |
| 13 class HostNPScriptObject; | |
| 14 | |
| 15 class HostLogHandler { | |
| 16 public: | |
| 17 // Register/Unregister the log handler. | |
|
Wez
2011/08/31 01:30:16
nit: Lose /"Unregister".
garykac
2011/08/31 23:59:46
Done.
| |
| 18 // These should be called from the plugin init/destroy methods so that they | |
| 19 // are only called once per plugin process (not once per plugin instance). | |
| 20 static void RegisterLogMessageHandler(); | |
| 21 | |
| 22 // We don't have the corresponding UnregisterLogMessageHandler because it | |
| 23 // is not safe to call it when there are multiple threads that might be | |
| 24 // logging. | |
| 25 | |
| 26 static void RegisterLoggingScriptObject(HostNPScriptObject* script_object); | |
| 27 static void UnregisterLoggingScriptObject(HostNPScriptObject* script_object); | |
| 28 | |
| 29 private: | |
| 30 // A Log Message Handler that is called after each LOG message has been | |
| 31 // processed. This must be of type LogMessageHandlerFunction defined in | |
| 32 // base/logging.h. | |
| 33 static bool LogToUI(int severity, const char* file, int line, | |
| 34 size_t message_start, const std::string& str); | |
| 35 }; | |
| 36 | |
| 37 } // namespace remoting | |
| 38 | |
| 39 #endif // REMOTING_HOST_PLUGIN_HOST_LOG_HANDLER_H_ | |
| OLD | NEW |