From b3055f34650cd066a349e1e8cba294b05513ef2e Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 3 May 2016 12:04:47 +0800 Subject: [PATCH] vulkan: constify DebugReportCallbackList::Message Sending a message should not modify the state of DebugReportCallbackList, conceptually. Bug: 28120066 Change-Id: I7b30b4a41492b4e670408f34a6bffe8b56295afd --- vulkan/libvulkan/debug_report.cpp | 4 ++-- vulkan/libvulkan/debug_report.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vulkan/libvulkan/debug_report.cpp b/vulkan/libvulkan/debug_report.cpp index 0388fdcd0e..988655e64f 100644 --- a/vulkan/libvulkan/debug_report.cpp +++ b/vulkan/libvulkan/debug_report.cpp @@ -58,9 +58,9 @@ void DebugReportCallbackList::Message(VkDebugReportFlagsEXT flags, size_t location, int32_t message_code, const char* layer_prefix, - const char* message) { + const char* message) const { std::shared_lock lock(rwmutex_); - Node* node = &head_; + const Node* node = &head_; while ((node = node->next)) { if ((node->flags & flags) != 0) { node->callback(flags, object_type, object, location, message_code, diff --git a/vulkan/libvulkan/debug_report.h b/vulkan/libvulkan/debug_report.h index 7a03d4ab24..6f70f18088 100644 --- a/vulkan/libvulkan/debug_report.h +++ b/vulkan/libvulkan/debug_report.h @@ -52,7 +52,7 @@ class DebugReportCallbackList { size_t location, int32_t message_code, const char* layer_prefix, - const char* message); + const char* message) const; static Node* FromHandle(VkDebugReportCallbackEXT handle) { return reinterpret_cast(uintptr_t(handle)); @@ -78,7 +78,7 @@ class DebugReportCallbackList { }; // TODO(jessehall): replace with std::shared_mutex when available in libc++ - std::shared_timed_mutex rwmutex_; + mutable std::shared_timed_mutex rwmutex_; Node head_; }; -- 2.11.0