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

Unified Diff: base/memory/ref_counted_unittest.nc

Issue 2723423002: Start BindStateBase ref count from 1 instead of 0 (Closed)
Patch Set: . Created 3 years, 9 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
« base/memory/ref_counted_unittest.cc ('K') | « base/memory/ref_counted_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/ref_counted_unittest.nc
diff --git a/base/memory/ref_counted_unittest.nc b/base/memory/ref_counted_unittest.nc
new file mode 100644
index 0000000000000000000000000000000000000000..5022779214a2ae082d9487360974b9ad4e3cba73
--- /dev/null
+++ b/base/memory/ref_counted_unittest.nc
@@ -0,0 +1,25 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/memory/ref_counted.h"
+
+namespace base {
+
+class InitialRefCountIsZero : public base::RefCounted<InitialRefCountIsZero> {
+ public:
+ InitialRefCountIsZero() {}
+ private:
+ friend class base::RefCounted<InitialRefCountIsZero>;
+ ~InitialRefCountIsZero() {}
+};
+
+#if defined(NCTEST_ADOPT_REF_TO_ZERO_START) // [r"fatal error: static_assert failed \"Use AdoptRef only for the reference count starts from one\.\""]
+
+void WontCompile() {
+ AdoptRef(new InitialRefCountIsZero());
+}
+
+#endif
+
+} // namespace base
« base/memory/ref_counted_unittest.cc ('K') | « base/memory/ref_counted_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698