tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

LoggingAnnotator.cpp (1725B)


      1 //
      2 // Copyright 2017 The ANGLE Project Authors. All rights reserved.
      3 // Use of this source code is governed by a BSD-style license that can be
      4 // found in the LICENSE file.
      5 //
      6 // LoggingAnnotator.cpp: DebugAnnotator implementing logging
      7 //
      8 
      9 #include "libANGLE/LoggingAnnotator.h"
     10 
     11 #include "libANGLE/trace.h"
     12 
     13 namespace angle
     14 {
     15 
     16 bool LoggingAnnotator::getStatus(const gl::Context *context)
     17 {
     18    return false;
     19 }
     20 
     21 void LoggingAnnotator::beginEvent(gl::Context *context,
     22                                  EntryPoint entryPoint,
     23                                  const char *eventName,
     24                                  const char *eventMessage)
     25 {
     26    ANGLE_TRACE_EVENT_BEGIN0("gpu.angle", eventName);
     27 }
     28 
     29 void LoggingAnnotator::endEvent(gl::Context *context, const char *eventName, EntryPoint entryPoint)
     30 {
     31    ANGLE_TRACE_EVENT_END0("gpu.angle", eventName);
     32 }
     33 
     34 void LoggingAnnotator::setMarker(gl::Context *context, const char *markerName)
     35 {
     36    ANGLE_TRACE_EVENT_INSTANT0("gpu.angle", markerName);
     37 }
     38 
     39 void LoggingAnnotator::logMessage(const gl::LogMessage &msg) const
     40 {
     41    auto *plat = ANGLEPlatformCurrent();
     42    if (plat != nullptr)
     43    {
     44        switch (msg.getSeverity())
     45        {
     46            case gl::LOG_FATAL:
     47            case gl::LOG_ERR:
     48                plat->logError(plat, msg.getMessage().c_str());
     49                break;
     50            case gl::LOG_WARN:
     51                plat->logWarning(plat, msg.getMessage().c_str());
     52                break;
     53            case gl::LOG_INFO:
     54                plat->logInfo(plat, msg.getMessage().c_str());
     55                break;
     56            default:
     57                UNREACHABLE();
     58        }
     59    }
     60    gl::Trace(msg.getSeverity(), msg.getMessage().c_str());
     61 }
     62 
     63 }  // namespace angle