Match DebugAnnotator::{begin|end}Event() calls The tests for whether ScopedPerfEventHelper::~ScopedPerfEventHelper() should call DebugAnnotator::endEvent() were not valid: - The test in ScopedPerfEventHelper::begin() simply checks whether a DebugAnnotator has been initialized. - In addition, ScopedPerfEventHelper::~ScopedPerfEventHelper() also checks whether DebugAnnotator::getStatus() returns true, which will always be false when the generic LoggingAnnotator is pluged in. - The check in ScopedPerfEventHelper::~ScopedPerfEventHelper() must take into account whether EGL_Initialize() or EGL_Terminate() changed g_debugAnnotator, and whether ScopedPerfEventHelper::begin() called DebugAnnotator::beginEvent(), and so a matching endEvent() should be called. The check in ScopedPerfEventHelper::~ScopedPerfEventHelper() is now simplified. Bug: angleproject:6158 Change-Id: I7fbd19cd0a372ef3ce3600c5d3fc50234b53ca38 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3072564 Commit-Queue: Ian Elliott <ianelliott@google.com> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>