Fix incorrect private access
authorrossberg@chromium.org <rossberg@chromium.org>
Tue, 21 Oct 2014 13:37:49 +0000 (13:37 +0000)
committerrossberg@chromium.org <rossberg@chromium.org>
Tue, 21 Oct 2014 13:37:49 +0000 (13:37 +0000)
(I'm puzzled why GCC did not report this error.)

TBR=bmeurer@chromium.org
BUG=

Review URL: https://codereview.chromium.org/669733007

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24776 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/interface.cc
src/interface.h

index d325c0e..a45804c 100644 (file)
@@ -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.
 }
 
 
index ae54963..19f89ce 100644 (file)
@@ -172,8 +172,7 @@ class Interface : public ZoneObject {
   // ---------------------------------------------------------------------------
   // Implementation.
  private:
-  struct ValueCreate;
-  struct ConstCreate;
+  struct Cache;
 
   enum Flags {    // All flags are monotonic
     NONE = 0,