| Index: ppapi/native_client/src/trusted/plugin/utility.h
|
| diff --git a/ppapi/native_client/src/trusted/plugin/utility.h b/ppapi/native_client/src/trusted/plugin/utility.h
|
| index efd4e75eb1c543b0b752cd2e0044713e242de0b5..e670d8cc7b6bf8cc9a78478c0de53954f9a3c0d9 100644
|
| --- a/ppapi/native_client/src/trusted/plugin/utility.h
|
| +++ b/ppapi/native_client/src/trusted/plugin/utility.h
|
| @@ -1,5 +1,5 @@
|
| /*
|
| - * Copyright (c) 2011 The Native Client Authors. All rights reserved.
|
| + * Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| * Use of this source code is governed by a BSD-style license that can be
|
| * found in the LICENSE file.
|
| */
|
| @@ -12,6 +12,7 @@
|
| #include "native_client/src/include/nacl_macros.h"
|
| #include "native_client/src/include/portability.h"
|
| #include "native_client/src/shared/platform/nacl_threads.h"
|
| +#include "native_client/src/shared/platform/nacl_time.h"
|
|
|
| #define SRPC_PLUGIN_DEBUG 1
|
|
|
| @@ -32,20 +33,35 @@ extern int NaClPluginPrintLog(const char *format, ...);
|
| extern int NaClPluginDebugPrintCheckEnv();
|
| extern FILE* NaClPluginLogFileEnv();
|
| #if SRPC_PLUGIN_DEBUG
|
| -# define PLUGIN_PRINTF(args) do { \
|
| +#define INIT_PLUGIN_LOGGING() do { \
|
| if (-1 == ::plugin::gNaClPluginDebugPrintEnabled) { \
|
| ::plugin::gNaClPluginDebugPrintEnabled = \
|
| ::plugin::NaClPluginDebugPrintCheckEnv(); \
|
| ::plugin::gNaClPluginLogFile = ::plugin::NaClPluginLogFileEnv();\
|
| } \
|
| +} while (0)
|
| +
|
| +#define PLUGIN_PRINTF(args) do { \
|
| + INIT_PLUGIN_LOGGING(); \
|
| + if (0 != ::plugin::gNaClPluginDebugPrintEnabled) { \
|
| + ::plugin::NaClPluginPrintLog("PLUGIN %"NACL_PRIu64": ", \
|
| + NaClGetTimeOfDayMicroseconds()); \
|
| + ::plugin::NaClPluginPrintLog args; \
|
| + } \
|
| + } while (0)
|
| +
|
| +// MODULE_PRINTF is used in the module because PLUGIN_PRINTF uses a
|
| +// a timer that may not yet be initialized.
|
| +#define MODULE_PRINTF(args) do { \
|
| + INIT_PLUGIN_LOGGING(); \
|
| if (0 != ::plugin::gNaClPluginDebugPrintEnabled) { \
|
| - ::plugin::NaClPluginPrintLog("%08"NACL_PRIx32": ", \
|
| - NaClThreadId()); \
|
| + ::plugin::NaClPluginPrintLog("MODULE: "); \
|
| ::plugin::NaClPluginPrintLog args; \
|
| } \
|
| } while (0)
|
| #else
|
| # define PLUGIN_PRINTF(args) do { if (0) { printf args; } } while (0)
|
| +# define MODULE_PRINTF(args) do { if (0) { printf args; } } while (0)
|
| /* allows DCE but compiler can still do format string checks */
|
| #endif
|
|
|
|
|