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: Created Nov. 21, 2017, 1:53 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)
(...skipping 17 matching lines...) Expand all
49 #if defined(DEBUG) 51 #if defined(DEBUG)
50 inline void assert2(bool condition, const String& str) 52 inline void assert2(bool condition, const String& str)
51 { 53 {
52 if (!condition) 54 if (!condition)
53 console.error(str); 55 console.error(str);
54 } 56 }
55 #else 57 #else
56 #define assert2(condition, str) 58 #define assert2(condition, str)
57 #endif 59 #endif
58 60
61 ABP_NS_END
62
59 #if defined(__EMSCRIPTEN_TRACING__) 63 #if defined(__EMSCRIPTEN_TRACING__)
60 #include <emscripten/trace.h> 64 #include <emscripten/trace.h>
61 65
66 ABP_NS_BEGIN
67
62 inline void init_tracing() 68 inline void init_tracing()
63 { 69 {
64 emscripten_trace_configure("http://127.0.0.1:5000/", "MyApplication"); 70 emscripten_trace_configure("http://127.0.0.1:5000/", "MyApplication");
65 } 71 }
66 72
67 inline void shutdown_tracing() 73 inline void shutdown_tracing()
68 { 74 {
69 emscripten_trace_close(); 75 emscripten_trace_close();
70 } 76 }
71 77
72 inline void annotate_address(void* address, const char* name) 78 inline void annotate_address(void* address, const char* name)
73 { 79 {
74 emscripten_trace_annotate_address_type(address, name); 80 emscripten_trace_annotate_address_type(address, name);
75 } 81 }
76 82
77 inline void enter_context(const char* context) 83 inline void enter_context(const char* context)
78 { 84 {
79 emscripten_trace_enter_context(context); 85 emscripten_trace_enter_context(context);
80 } 86 }
81 87
82 inline void exit_context() 88 inline void exit_context()
83 { 89 {
84 emscripten_trace_exit_context(); 90 emscripten_trace_exit_context();
85 } 91 }
86 92
93 ABP_NS_END
94
87 #else // defined(__EMSCRIPTEN_TRACING__) 95 #else // defined(__EMSCRIPTEN_TRACING__)
88 96
97 ABP_NS_BEGIN
98
89 inline void init_tracing() 99 inline void init_tracing()
90 { 100 {
91 } 101 }
92 102
93 inline void shutdown_tracing() 103 inline void shutdown_tracing()
94 { 104 {
95 } 105 }
96 106
97 inline void annotate_address(void* address, const char* name) 107 inline void annotate_address(void* address, const char* name)
98 { 108 {
99 } 109 }
100 110
101 inline void enter_context(const char* context) 111 inline void enter_context(const char* context)
102 { 112 {
103 } 113 }
104 114
105 inline void exit_context() 115 inline void exit_context()
106 { 116 {
107 } 117 }
108 118
119 ABP_NS_END
120
109 #endif // defined(__EMSCRIPTEN_TRACING__) 121 #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