Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(866)

Unified Diff: gpu/command_buffer/common/cmd_buffer_common.h

Issue 2275203002: Make command buffer commands and immediate data volatile (Closed)
Patch Set: std::copy->const_cast+memcpy Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/client/ring_buffer_test.cc ('k') | gpu/command_buffer/common/gles2_cmd_format_autogen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/common/cmd_buffer_common.h
diff --git a/gpu/command_buffer/common/cmd_buffer_common.h b/gpu/command_buffer/common/cmd_buffer_common.h
index e8989be2894cd07a60fa4a04dce85e53d5d398c0..38acf4a6e9cde51386ed95daa102638c080c65b0 100644
--- a/gpu/command_buffer/common/cmd_buffer_common.h
+++ b/gpu/command_buffer/common/cmd_buffer_common.h
@@ -79,6 +79,11 @@ struct CommandHeader {
DCHECK_GE(size_in_bytes, sizeof(T)); // NOLINT
Init(T::kCmdId, ComputeNumEntries(size_in_bytes));
}
+
+ static CommandHeader FromVolatile(const volatile CommandHeader& other) {
+ // const_cast is safe because the copy constructor is trivial.
+ return const_cast<const CommandHeader&>(other);
+ }
};
static_assert(sizeof(CommandHeader) == 4,
« no previous file with comments | « gpu/command_buffer/client/ring_buffer_test.cc ('k') | gpu/command_buffer/common/gles2_cmd_format_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698