Handle account removal correctly on all platforms.
[chromium-blink-merge.git] / gpu / command_buffer / service / logger.h
blob46914435461a8f9908c2b762f5c018c9d258d5e9
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_
10 #include <string>
12 #include "base/callback.h"
13 #include "gpu/gpu_export.h"
15 namespace gpu {
16 namespace gles2 {
18 typedef base::Callback<void(int32 id, const std::string& msg)> MsgCallback;
20 class DebugMarkerManager;
22 class GPU_EXPORT Logger {
23 public:
24 static const int kMaxLogMessages = 256;
26 explicit Logger(const DebugMarkerManager* debug_marker_manager);
27 ~Logger();
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
35 // bug.
36 void set_log_synthesized_gl_errors(bool enabled) {
37 log_synthesized_gl_errors_ = enabled;
40 void SetMsgCallback(const MsgCallback& callback);
42 private:
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);
54 } // namespace gles2
55 } // namespace gpu
57 #endif // GPU_COMMAND_BUFFER_SERVICE_LOGGER_H_