Chromium Code Reviews| Index: third_party/WebKit/Source/web/WebFrameImplBase.h |
| diff --git a/third_party/WebKit/Source/web/WebFrameImplBase.h b/third_party/WebKit/Source/web/WebFrameImplBase.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..55c86cb03dab891799a70e0421a5d99e356600dc |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/web/WebFrameImplBase.h |
| @@ -0,0 +1,45 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef WebFrameImplBase_h |
| +#define WebFrameImplBase_h |
| + |
| +#include "platform/heap/Handle.h" |
| +#include "wtf/text/AtomicString.h" |
| + |
| +namespace blink { |
| + |
| +class Frame; |
| +class FrameHost; |
| +class FrameOwner; |
| + |
| +// WebFrameImplBase exists to avoid the diamond inheritance problem: |
| +// - The public interfaces WebLocalFrame/WebRemoteFrame extend WebFrame. |
| +// - WebLocalFrameImpl implements WebLocalFrame and WebRemoteFrameImpl |
| +// implements WebRemoteFrame. |
| +// - The private implementations should share some functionality, but cannot |
| +// inherit from a common base class inheriting WebFrame. This would result in |
| +// WebFrame beind inherited from two different base classes. |
| +// |
| +// To get around this, only the private implementations have WebFrameImplBase as |
| +// a base class. WebFrame exposes a virtual accessor to retrieve the underlying |
| +// implementation as an instance of the base class, but has no inheritance |
| +// relationship with it. The cost is a virtual indirection, but this is nicer |
| +// than the previous manual dispatch emulating real virtual dispatch. |
| +class WebFrameImplBase : public RefCountedWillBeGarbageCollectedFinalized<WebFrameImplBase> { |
| +public: |
| + virtual ~WebFrameImplBase(); |
| + |
| + virtual void initializeCoreFrame(FrameHost*, FrameOwner*, const AtomicString& name, const AtomicString& fallbackName) = 0; |
| + // TODO(dcheng): Rename this to coreFrame()? This probably also shouldn't be const... |
| + virtual Frame* frame() const = 0; |
| + |
| +#if ENABLE(OILPAN) |
|
haraken
2015/11/24 02:30:53
I guess ENABLE(OILPAN) won't be needed.
dcheng
2015/11/24 06:55:07
Hmm, is ENABLE(OILPAN) universally enabled? Right
haraken
2015/11/24 07:00:33
We normally don't add #if ENABLE(OILPAN) to a trac
dcheng
2015/11/24 07:50:24
Makes sense. Done.
|
| + DECLARE_VIRTUAL_TRACE(); |
| +#endif |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // WebFrameImplBase_h |