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

Unified Diff: base/threading/thread_checker_unittest.cc

Issue 2542403003: Make ThreadChecker zero-sized
Patch Set: Created 4 years 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 | « base/threading/thread_checker.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/thread_checker_unittest.cc
diff --git a/base/threading/thread_checker_unittest.cc b/base/threading/thread_checker_unittest.cc
index 96455e66c704efee659099ff6db2fd484b4b550e..baec975ca43a98d60626a3ac2d0fda01c6e830ee 100644
--- a/base/threading/thread_checker_unittest.cc
+++ b/base/threading/thread_checker_unittest.cc
@@ -6,11 +6,13 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/sequence_token.h"
#include "base/test/test_simple_task_runner.h"
#include "base/threading/simple_thread.h"
+#include "base/threading/thread_checker.h"
#include "base/threading/thread_checker_impl.h"
#include "base/threading/thread_task_runner_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -18,6 +20,18 @@
namespace base {
namespace {
+#if !DCHECK_IS_ON()
+class ClassWithThreadChecker {
+ BASE_EXPORT size_t SilenceUnusedWarnings() {
+ return x + (y.CalledOnValidThread() ? 1 : 0);
+ }
+ uint32_t x;
+ ThreadChecker y;
+};
+
+static_assert(sizeof(ClassWithThreadChecker) == sizeof(uint32_t), "ThreadCheckerShouldHaveZeroSize");
+#endif
+
// A thread that runs a callback.
class RunCallbackThread : public SimpleThread {
public:
« no previous file with comments | « base/threading/thread_checker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698