| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 // A collection of debugging related interfaces. | 7 // A collection of debugging related interfaces. |
| 8 | 8 |
| 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_UTILITY_H_ | 9 #ifndef NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_UTILITY_H_ |
| 10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_UTILITY_H_ | 10 #define NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_UTILITY_H_ |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 if (-1 == ::plugin::gNaClPluginDebugPrintEnabled) { \ | 37 if (-1 == ::plugin::gNaClPluginDebugPrintEnabled) { \ |
| 38 ::plugin::gNaClPluginDebugPrintEnabled = \ | 38 ::plugin::gNaClPluginDebugPrintEnabled = \ |
| 39 ::plugin::NaClPluginDebugPrintCheckEnv(); \ | 39 ::plugin::NaClPluginDebugPrintCheckEnv(); \ |
| 40 ::plugin::gNaClPluginLogFile = ::plugin::NaClPluginLogFileEnv();\ | 40 ::plugin::gNaClPluginLogFile = ::plugin::NaClPluginLogFileEnv();\ |
| 41 } \ | 41 } \ |
| 42 } while (0) | 42 } while (0) |
| 43 | 43 |
| 44 #define PLUGIN_PRINTF(args) do { \ | 44 #define PLUGIN_PRINTF(args) do { \ |
| 45 INIT_PLUGIN_LOGGING(); \ | 45 INIT_PLUGIN_LOGGING(); \ |
| 46 if (0 != ::plugin::gNaClPluginDebugPrintEnabled) { \ | 46 if (0 != ::plugin::gNaClPluginDebugPrintEnabled) { \ |
| 47 ::plugin::NaClPluginPrintLog("PLUGIN %"NACL_PRIu64": ", \ | 47 ::plugin::NaClPluginPrintLog("PLUGIN %" NACL_PRIu64 ": ", \ |
| 48 NaClGetTimeOfDayMicroseconds()); \ | 48 NaClGetTimeOfDayMicroseconds()); \ |
| 49 ::plugin::NaClPluginPrintLog args; \ | 49 ::plugin::NaClPluginPrintLog args; \ |
| 50 } \ | 50 } \ |
| 51 } while (0) | 51 } while (0) |
| 52 | 52 |
| 53 // MODULE_PRINTF is used in the module because PLUGIN_PRINTF uses a | 53 // MODULE_PRINTF is used in the module because PLUGIN_PRINTF uses a |
| 54 // a timer that may not yet be initialized. | 54 // a timer that may not yet be initialized. |
| 55 #define MODULE_PRINTF(args) do { \ | 55 #define MODULE_PRINTF(args) do { \ |
| 56 INIT_PLUGIN_LOGGING(); \ | 56 INIT_PLUGIN_LOGGING(); \ |
| 57 if (0 != ::plugin::gNaClPluginDebugPrintEnabled) { \ | 57 if (0 != ::plugin::gNaClPluginDebugPrintEnabled) { \ |
| 58 ::plugin::NaClPluginPrintLog("MODULE: "); \ | 58 ::plugin::NaClPluginPrintLog("MODULE: "); \ |
| 59 ::plugin::NaClPluginPrintLog args; \ | 59 ::plugin::NaClPluginPrintLog args; \ |
| 60 } \ | 60 } \ |
| 61 } while (0) | 61 } while (0) |
| 62 #else | 62 #else |
| 63 # define PLUGIN_PRINTF(args) do { if (0) { printf args; } } while (0) | 63 # define PLUGIN_PRINTF(args) do { if (0) { printf args; } } while (0) |
| 64 # define MODULE_PRINTF(args) do { if (0) { printf args; } } while (0) | 64 # define MODULE_PRINTF(args) do { if (0) { printf args; } } while (0) |
| 65 /* allows DCE but compiler can still do format string checks */ | 65 /* allows DCE but compiler can still do format string checks */ |
| 66 #endif | 66 #endif |
| 67 | 67 |
| 68 } // namespace plugin | 68 } // namespace plugin |
| 69 | 69 |
| 70 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_UTILITY_H_ | 70 #endif // NATIVE_CLIENT_SRC_TRUSTED_PLUGIN_UTILITY_H_ |
| OLD | NEW |