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

Unified Diff: base/task_scheduler/task_traits.cc

Issue 1897483002: TaskScheduler: Add static_assert in TaskTraits::operator==. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@6_threadpool
Patch Set: add static_assert message Created 4 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/task_traits.cc
diff --git a/base/task_scheduler/task_traits.cc b/base/task_scheduler/task_traits.cc
index ad0e37f887166009b9608cf680a90d505e276f45..d8904493cc4271a09618440b806d18e4be173079 100644
--- a/base/task_scheduler/task_traits.cc
+++ b/base/task_scheduler/task_traits.cc
@@ -4,6 +4,8 @@
#include "base/task_scheduler/task_traits.h"
+#include <stddef.h>
+
#include <ostream>
namespace base {
@@ -35,6 +37,10 @@ TaskTraits& TaskTraits::WithShutdownBehavior(
}
bool TaskTraits::operator==(const TaskTraits& other) const {
+ static_assert(sizeof(TaskTraits) ==
+ offsetof(TaskTraits, shutdown_behavior_) +
+ sizeof(TaskTraits::shutdown_behavior_),
+ "TaskTraits members changed. Update operator==.");
return with_file_io_ == other.with_file_io_ && priority_ == other.priority_ &&
shutdown_behavior_ == other.shutdown_behavior_;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698