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

Unified Diff: core/fxcrt/cfx_retain_ptr_unittest.cpp

Issue 2560783003: Catch stray Retains() and Releases() outside of RetainPtr<>. (Closed)
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
Index: core/fxcrt/cfx_retain_ptr_unittest.cpp
diff --git a/core/fxcrt/cfx_retain_ptr_unittest.cpp b/core/fxcrt/cfx_retain_ptr_unittest.cpp
index 692beb82ffdf3eadd21d408007a2617ea31a5d85..1389cd802b0fe26cbd47c6b7cff65aa8364be542 100644
--- a/core/fxcrt/cfx_retain_ptr_unittest.cpp
+++ b/core/fxcrt/cfx_retain_ptr_unittest.cpp
@@ -14,12 +14,18 @@ namespace {
class PseudoRetainable {
public:
PseudoRetainable() : retain_count_(0), release_count_(0) {}
- void Retain() { ++retain_count_; }
- void Release() { ++release_count_; }
int retain_count() const { return retain_count_; }
int release_count() const { return release_count_; }
private:
+ template <typename U>
+ friend struct ::ReleaseDeleter;
+ template <typename U>
+ friend class ::CFX_RetainPtr;
+
+ void Retain() { ++retain_count_; }
+ void Release() { ++release_count_; }
+
int retain_count_;
int release_count_;
};

Powered by Google App Engine
This is Rietveld 408576698