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

Unified Diff: src/unique.h

Issue 1326493002: Make unsafe Unique<T> constructor private. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« 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: src/unique.h
diff --git a/src/unique.h b/src/unique.h
index 68fb86956cd2f15a2030055b802a4d5d6ca82765..68a45963b860ed8ff0d50e14f679ff2b5698e4a7 100644
--- a/src/unique.h
+++ b/src/unique.h
@@ -32,7 +32,7 @@ class UniqueSet;
// Careful! Comparison of two Uniques is only correct if both were created
// in the same "era" of GC or if at least one is a non-movable object.
template <typename T>
-class Unique {
+class Unique final {
public:
Unique<T>() : raw_address_(NULL) {}
@@ -54,10 +54,6 @@ class Unique {
handle_ = handle;
}
- // TODO(titzer): this is a hack to migrate to Unique<T> incrementally.
- Unique(Address raw_address, Handle<T> handle)
- : raw_address_(raw_address), handle_(handle) { }
-
// Constructor for handling automatic up casting.
// Eg. Unique<JSFunction> can be passed when Unique<Object> is expected.
template <class S> Unique(Unique<S> uniq) {
@@ -129,15 +125,16 @@ class Unique {
return Unique<T>(reinterpret_cast<Address>(*handle), handle);
}
- friend class UniqueSet<T>; // Uses internal details for speed.
- template <class U>
- friend class Unique; // For comparing raw_address values.
+ private:
+ Unique(Address raw_address, Handle<T> handle)
+ : raw_address_(raw_address), handle_(handle) {}
- protected:
Address raw_address_;
Handle<T> handle_;
- friend class SideEffectsTracker;
+ friend class UniqueSet<T>; // Uses internal details for speed.
+ template <class U>
+ friend class Unique; // For comparing raw_address values.
};
template <typename T>
« 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