| LEFT | RIGHT |
| 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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 | |
| 20 #include <emscripten/trace.h> | |
| 21 | 19 |
| 22 #include "library.h" | 20 #include "library.h" |
| 23 | 21 |
| 24 #if defined(assert) | 22 #if defined(assert) |
| 25 #undef assert | 23 #undef assert |
| 26 #endif | 24 #endif |
| 27 | 25 |
| 28 class String; | 26 class String; |
| 29 | 27 |
| 30 struct console_type | 28 struct console_type |
| (...skipping 24 matching lines...) Expand all Loading... |
| 55 #if defined(DEBUG) | 53 #if defined(DEBUG) |
| 56 inline void assert(bool condition, const String& str) | 54 inline void assert(bool condition, const String& str) |
| 57 { | 55 { |
| 58 if (!condition) | 56 if (!condition) |
| 59 console.error(str); | 57 console.error(str); |
| 60 } | 58 } |
| 61 #else | 59 #else |
| 62 #define assert(condition, str) | 60 #define assert(condition, str) |
| 63 #endif | 61 #endif |
| 64 | 62 |
| 63 #if defined(__EMSCRIPTEN_TRACING__) |
| 64 #include <emscripten/trace.h> |
| 65 |
| 66 inline void init_tracing() |
| 67 { |
| 68 emscripten_trace_configure("http://127.0.0.1:5000/", "MyApplication"); |
| 69 } |
| 70 |
| 71 inline void shutdown_tracing() |
| 72 { |
| 73 emscripten_trace_close(); |
| 74 } |
| 75 |
| 65 inline void annotate_address(void* address, const char* name) | 76 inline void annotate_address(void* address, const char* name) |
| 66 { | 77 { |
| 67 #if defined(__EMSCRIPTEN_TRACING__) | |
| 68 emscripten_trace_annotate_address_type(address, name); | 78 emscripten_trace_annotate_address_type(address, name); |
| 69 #endif | |
| 70 } | 79 } |
| 71 | 80 |
| 72 inline void enter_context(const char* context) | 81 inline void enter_context(const char* context) |
| 73 { | 82 { |
| 74 #if defined(__EMSCRIPTEN_TRACING__) | |
| 75 emscripten_trace_enter_context(context); | 83 emscripten_trace_enter_context(context); |
| 76 #endif | |
| 77 } | 84 } |
| 78 | 85 |
| 79 inline void exit_context() | 86 inline void exit_context() |
| 80 { | 87 { |
| 81 #if defined(__EMSCRIPTEN_TRACING__) | |
| 82 emscripten_trace_exit_context(); | 88 emscripten_trace_exit_context(); |
| 83 #endif | |
| 84 } | 89 } |
| 90 |
| 91 #else // defined(__EMSCRIPTEN_TRACING__) |
| 92 |
| 93 inline void init_tracing() |
| 94 { |
| 95 } |
| 96 |
| 97 inline void shutdown_tracing() |
| 98 { |
| 99 } |
| 100 |
| 101 inline void annotate_address(void* address, const char* name) |
| 102 { |
| 103 } |
| 104 |
| 105 inline void enter_context(const char* context) |
| 106 { |
| 107 } |
| 108 |
| 109 inline void exit_context() |
| 110 { |
| 111 } |
| 112 |
| 113 #endif // defined(__EMSCRIPTEN_TRACING__) |
| LEFT | RIGHT |