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

Side by Side Diff: components/nacl/renderer/plugin/utility.h

Issue 1631413002: NaCl cleanup: Remove not-very-useful debug logging in the plugin code (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 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 unified diff | Download patch
OLDNEW
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 COMPONENTS_NACL_RENDERER_PLUGIN_UTILITY_H_ 9 #ifndef COMPONENTS_NACL_RENDERER_PLUGIN_UTILITY_H_
10 #define COMPONENTS_NACL_RENDERER_PLUGIN_UTILITY_H_ 10 #define COMPONENTS_NACL_RENDERER_PLUGIN_UTILITY_H_
11 11
12 #include <stdint.h> 12 #include <stdint.h>
13 13
14 #include "components/nacl/renderer/ppb_nacl_private.h" 14 #include "components/nacl/renderer/ppb_nacl_private.h"
15 #include "native_client/src/shared/platform/nacl_threads.h"
16 #include "native_client/src/shared/platform/nacl_time.h"
17 15
18 #define SRPC_PLUGIN_DEBUG 1 16 #define SRPC_PLUGIN_DEBUG 1
19 17
20 namespace plugin { 18 namespace plugin {
21 19
22 const PPB_NaCl_Private* GetNaClInterface(); 20 const PPB_NaCl_Private* GetNaClInterface();
23 void SetNaClInterface(const PPB_NaCl_Private* nacl_interface); 21 void SetNaClInterface(const PPB_NaCl_Private* nacl_interface);
24 22
25 // Debugging print utility
26 extern int gNaClPluginDebugPrintEnabled;
27 extern int NaClPluginPrintLog(const char *format, ...);
28 extern int NaClPluginDebugPrintCheckEnv();
29 #if SRPC_PLUGIN_DEBUG
30 #define INIT_PLUGIN_LOGGING() do { \
31 if (-1 == ::plugin::gNaClPluginDebugPrintEnabled) { \
32 ::plugin::gNaClPluginDebugPrintEnabled = \
33 ::plugin::NaClPluginDebugPrintCheckEnv(); \
34 } \
35 } while (0)
36
37 #define PLUGIN_PRINTF(args) do { \
38 INIT_PLUGIN_LOGGING(); \
39 if (0 != ::plugin::gNaClPluginDebugPrintEnabled) { \
40 ::plugin::NaClPluginPrintLog("PLUGIN %" NACL_PRIu64 ": ", \
41 NaClGetTimeOfDayMicroseconds()); \
42 ::plugin::NaClPluginPrintLog args; \
43 } \
44 } while (0)
45
46 // MODULE_PRINTF is used in the module because PLUGIN_PRINTF uses a
47 // a timer that may not yet be initialized.
48 #define MODULE_PRINTF(args) do { \
49 INIT_PLUGIN_LOGGING(); \
50 if (0 != ::plugin::gNaClPluginDebugPrintEnabled) { \
51 ::plugin::NaClPluginPrintLog("MODULE: "); \
52 ::plugin::NaClPluginPrintLog args; \
53 } \
54 } while (0)
55 #else
56 # define PLUGIN_PRINTF(args) do { if (0) { printf args; } } while (0)
57 # define MODULE_PRINTF(args) do { if (0) { printf args; } } while (0)
58 /* allows DCE but compiler can still do format string checks */
59 #endif
60
61 } // namespace plugin 23 } // namespace plugin
62 24
63 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_UTILITY_H_ 25 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_UTILITY_H_
OLDNEW
« no previous file with comments | « components/nacl/renderer/plugin/pnacl_translate_thread.cc ('k') | components/nacl/renderer/plugin/utility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698