Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: compiled/debug.h

Issue 29613616: Issue 6064 - Put C++ code into a configurable namespace (Closed) Base URL: https://github.com/adblockplus/adblockpluscore.git
Patch Set: rebase Created Dec. 12, 2017, 12:45 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « compiled/bindings/runtime_utils.cpp ('k') | compiled/filter/ActiveFilter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #pragma once 18 #pragma once
19 19
20 #include "base.h"
20 #include "library.h" 21 #include "library.h"
21 22
23 ABP_NS_BEGIN
22 class String; 24 class String;
23 25
24 struct console_type 26 struct console_type
25 { 27 {
26 static void log(const String& str) 28 static void log(const String& str)
27 { 29 {
28 LogString(str); 30 LogString(str);
29 } 31 }
30 32
31 static void log(int i) 33 static void log(int i)
32 { 34 {
33 LogInteger(i); 35 LogInteger(i);
34 } 36 }
35 37
36 static void log(const void* ptr) 38 static void log(const void* ptr)
37 { 39 {
38 LogPointer(ptr); 40 LogPointer(ptr);
39 } 41 }
40 42
41 static void error(const String& str) 43 static void error(const String& str)
42 { 44 {
43 LogError(str); 45 LogError(str);
44 } 46 }
45 }; 47 };
46 48
47 static console_type console; 49 static console_type console;
50 ABP_NS_END
48 51
49 #if defined(DEBUG) 52 #if defined(DEBUG)
50 inline void assert2(bool condition, const String& str) 53 inline void assert2(bool condition, const String& str)
51 { 54 {
52 if (!condition) 55 if (!condition)
53 console.error(str); 56 ABP_NS::console.error(str);
54 } 57 }
55 #else 58 #else
56 #define assert2(condition, str) 59 #define assert2(condition, str)
57 #endif 60 #endif
58 61
59 #if defined(__EMSCRIPTEN_TRACING__) 62 #if defined(__EMSCRIPTEN_TRACING__)
60 #include <emscripten/trace.h> 63 #include <emscripten/trace.h>
61 64
65 ABP_NS_BEGIN
66
62 inline void init_tracing() 67 inline void init_tracing()
63 { 68 {
64 emscripten_trace_configure("http://127.0.0.1:5000/", "MyApplication"); 69 emscripten_trace_configure("http://127.0.0.1:5000/", "MyApplication");
65 } 70 }
66 71
67 inline void shutdown_tracing() 72 inline void shutdown_tracing()
68 { 73 {
69 emscripten_trace_close(); 74 emscripten_trace_close();
70 } 75 }
71 76
72 inline void annotate_address(void* address, const char* name) 77 inline void annotate_address(void* address, const char* name)
73 { 78 {
74 emscripten_trace_annotate_address_type(address, name); 79 emscripten_trace_annotate_address_type(address, name);
75 } 80 }
76 81
77 inline void enter_context(const char* context) 82 inline void enter_context(const char* context)
78 { 83 {
79 emscripten_trace_enter_context(context); 84 emscripten_trace_enter_context(context);
80 } 85 }
81 86
82 inline void exit_context() 87 inline void exit_context()
83 { 88 {
84 emscripten_trace_exit_context(); 89 emscripten_trace_exit_context();
85 } 90 }
86 91
92 ABP_NS_END
93
87 #else // defined(__EMSCRIPTEN_TRACING__) 94 #else // defined(__EMSCRIPTEN_TRACING__)
88 95
96 ABP_NS_BEGIN
97
89 inline void init_tracing() 98 inline void init_tracing()
90 { 99 {
91 } 100 }
92 101
93 inline void shutdown_tracing() 102 inline void shutdown_tracing()
94 { 103 {
95 } 104 }
96 105
97 inline void annotate_address(void* address, const char* name) 106 inline void annotate_address(void* address, const char* name)
98 { 107 {
99 } 108 }
100 109
101 inline void enter_context(const char* context) 110 inline void enter_context(const char* context)
102 { 111 {
103 } 112 }
104 113
105 inline void exit_context() 114 inline void exit_context()
106 { 115 {
107 } 116 }
108 117
118 ABP_NS_END
119
109 #endif // defined(__EMSCRIPTEN_TRACING__) 120 #endif // defined(__EMSCRIPTEN_TRACING__)
OLDNEW
« no previous file with comments | « compiled/bindings/runtime_utils.cpp ('k') | compiled/filter/ActiveFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld