Fix incorrect private access

(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
This commit is contained in:
rossberg@chromium.org 2014-10-21 13:37:49 +00:00
parent 8330178b4c
commit 077809fc67
2 changed files with 17 additions and 21 deletions

View File

@ -14,36 +14,33 @@ namespace internal {
// ---------------------------------------------------------------------------
// Initialization.
struct Interface::ValueCreate {
static void Construct(Interface* ptr) {
::new (ptr) Interface(VALUE + 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;
};
struct Interface::ConstCreate {
static void Construct(Interface* ptr) {
::new (ptr) Interface(VALUE + CONST + FROZEN);
}
};
base::LazyInstance<Interface, Interface::Cache::ValueCreate>::type
Interface::Cache::value_interface = LAZY_INSTANCE_INITIALIZER;
namespace {
base::LazyInstance<Interface, Interface::ValueCreate>::type 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.
}

View 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,