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

Unified Diff: src/interface.cc

Issue 669733007: Fix incorrect private access (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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 | « src/interface.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interface.cc
diff --git a/src/interface.cc b/src/interface.cc
index d325c0e4d845fe0284b340a54768c4bd60f8da42..a45804cf5275eb3674695bd42c73d2c44a20ef7e 100644
--- a/src/interface.cc
+++ b/src/interface.cc
@@ -14,36 +14,33 @@ namespace internal {
// ---------------------------------------------------------------------------
// Initialization.
-struct Interface::ValueCreate {
- static void Construct(Interface* ptr) {
- ::new (ptr) Interface(VALUE + FROZEN);
- }
-};
-
-
-struct Interface::ConstCreate {
- static void Construct(Interface* ptr) {
- ::new (ptr) Interface(VALUE + CONST + FROZEN);
- }
+struct Interface::Cache {
+ template<int flags>
+ struct Create {
+ static void Construct(Interface* ptr) { ::new (ptr) Interface(flags); }
+ };
+ typedef Create<VALUE + FROZEN> ValueCreate;
+ typedef Create<VALUE + CONST + FROZEN> ConstCreate;
+
+ static base::LazyInstance<Interface, ValueCreate>::type value_interface;
+ static base::LazyInstance<Interface, ConstCreate>::type const_interface;
};
-namespace {
- base::LazyInstance<Interface, Interface::ValueCreate>::type value_interface =
- LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<Interface, Interface::Cache::ValueCreate>::type
+ Interface::Cache::value_interface = LAZY_INSTANCE_INITIALIZER;
- base::LazyInstance<Interface, Interface::ConstCreate>::type const_interface =
- LAZY_INSTANCE_INITIALIZER;
-}
+base::LazyInstance<Interface, Interface::Cache::ConstCreate>::type
+ Interface::Cache::const_interface = LAZY_INSTANCE_INITIALIZER;
Interface* Interface::NewValue() {
- return value_interface.Pointer(); // Cached.
+ return Cache::value_interface.Pointer(); // Cached.
}
Interface* Interface::NewConst() {
- return const_interface.Pointer(); // Cached.
+ return Cache::const_interface.Pointer(); // Cached.
}
« no previous file with comments | « src/interface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698