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

Unified Diff: third_party/base/stl_util.h

Issue 2262473002: Introduce pdfium::FakeUniquePtr for keys to sets of unique ptrs. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: unordered_set Created 4 years, 4 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
« fpdfsdk/javascript/app.cpp ('K') | « fpdfsdk/javascript/app.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/base/stl_util.h
diff --git a/third_party/base/stl_util.h b/third_party/base/stl_util.h
index 2d1846724c3094161ce910986fd13be10c7b9f62..013a4c8bc17479f59d9501ce3a94ea630273ba66 100644
--- a/third_party/base/stl_util.h
+++ b/third_party/base/stl_util.h
@@ -27,6 +27,15 @@ bool ContainsValue(const Collection& collection, const Value& value) {
collection.end();
}
+// Means of generating a key for std::set<std::unique_ptr> that avoids
brucedawson 2016/08/19 20:59:46 std::set is no longer correct for its first use. P
Tom Sepez 2016/08/19 21:16:42 Done.
+// the side effect of destroying the key.
+template <class T>
+class LeakPtr : public std::unique_ptr<T> {
brucedawson 2016/08/19 20:59:46 The name is not intuitively meaningful to me. I'm
Tom Sepez 2016/08/19 21:16:42 I've thought of (modulo hyphens and camelCase): d
+ public:
+ using std::unique_ptr<T>::unique_ptr;
+ ~LeakPtr() { std::unique_ptr<T>::release(); }
+};
+
// Convenience routine for "int-fected" code, so that the stl collection
// size_t size() method return values will be checked.
template <typename ResultType, typename Collection>
« fpdfsdk/javascript/app.cpp ('K') | « fpdfsdk/javascript/app.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698