diff options
-rw-r--r-- | chromium/base/trace_event/category_registry.h | 15 | ||||
-rw-r--r-- | chromium/base/trace_event/trace_log.h | 6 | ||||
-rw-r--r-- | chromium/build/config/compiler/BUILD.gn | 8 |
3 files changed, 24 insertions, 5 deletions
diff --git a/chromium/base/trace_event/category_registry.h b/chromium/base/trace_event/category_registry.h index a6439d94595..a2bdb2c8b29 100644 --- a/chromium/base/trace_event/category_registry.h +++ b/chromium/base/trace_event/category_registry.h @@ -83,6 +83,21 @@ class BASE_EXPORT CategoryRegistry { #endif } + static constexpr const unsigned char* GetBuiltinCategoryEnabled( + const char* category_group) { +#if defined(OS_WIN) && defined(COMPONENT_BUILD) + // The address cannot be evaluated at compile-time in Windows compoment + // builds. + return nullptr; +#else + for (size_t i = 0; i < BuiltinCategories::Size(); ++i) { + if (StrEqConstexpr(category_group, BuiltinCategories::At(i))) + return categories_[i].state_ptr(); + } + return nullptr; +#endif + } + // Returns whether |category| points at one of the meta categories that // shouldn't be displayed in the tracing UI. static bool IsMetaCategory(const TraceCategory* category); diff --git a/chromium/base/trace_event/trace_log.h b/chromium/base/trace_event/trace_log.h index 55f6825e5c2..fbc251ec118 100644 --- a/chromium/base/trace_event/trace_log.h +++ b/chromium/base/trace_event/trace_log.h @@ -221,11 +221,7 @@ class BASE_EXPORT TraceLog : public MemoryDumpProvider { const unsigned char* category_group_enabled); static constexpr const unsigned char* GetBuiltinCategoryEnabled( const char* name) { - TraceCategory* builtin_category = - CategoryRegistry::GetBuiltinCategoryByName(name); - if (builtin_category) - return builtin_category->state_ptr(); - return nullptr; + return CategoryRegistry::GetBuiltinCategoryEnabled(name); } // Called by TRACE_EVENT* macros, don't call this directly. diff --git a/chromium/build/config/compiler/BUILD.gn b/chromium/build/config/compiler/BUILD.gn index be485fd89b9..d1a60792d22 100644 --- a/chromium/build/config/compiler/BUILD.gn +++ b/chromium/build/config/compiler/BUILD.gn @@ -1491,6 +1491,14 @@ config("default_warnings") { cflags += [ "-Wno-maybe-uninitialized" ] cflags += [ "-Wno-deprecated-declarations" ] + # GCC assumes 'this' is never nullptr and optimizes away code + # like "if (this == nullptr) ...": [1]. However, some Chromium + # code relies on these types of null pointer checks [2], so + # disable this optimization. + # [1] https://gcc.gnu.org/gcc-6/porting_to.html#this-cannot-be-null + # [2] https://crbug.com/784492#c13 + cflags += [ "-fno-delete-null-pointer-checks" ] + # -Wcomment gives too many false positives in the case a # backslash ended comment line is followed by a new line of # comments |