1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file contains the Logger class.
7 #ifndef GPU_COMMAND_BUFFER_SERVICE_LOGGER_H_
8 #define GPU_COMMAND_BUFFER_SERVICE_LOGGER_H_
12 #include "base/callback.h"
13 #include "gpu/gpu_export.h"
18 typedef base::Callback
<void(int32 id
, const std::string
& msg
)> MsgCallback
;
20 class DebugMarkerManager
;
22 class GPU_EXPORT Logger
{
24 static const int kMaxLogMessages
= 256;
26 explicit Logger(const DebugMarkerManager
* debug_marker_manager
);
29 void LogMessage(const char* filename
, int line
, const std::string
& msg
);
30 const std::string
& GetLogPrefix() const;
32 // Defaults to true. Set to false for the gpu_unittests as they
33 // are explicitly checking errors are generated and so don't need the numerous
34 // messages. Otherwise, chromium code that generates these errors likely has a
36 void set_log_synthesized_gl_errors(bool enabled
) {
37 log_synthesized_gl_errors_
= enabled
;
40 void SetMsgCallback(const MsgCallback
& callback
);
43 // Uses the current marker to add information to logs.
44 const DebugMarkerManager
* debug_marker_manager_
;
45 std::string this_in_hex_
;
47 int log_message_count_
;
48 bool log_synthesized_gl_errors_
;
50 MsgCallback msg_callback_
;
51 DISALLOW_COPY_AND_ASSIGN(Logger
);
57 #endif // GPU_COMMAND_BUFFER_SERVICE_LOGGER_H_