Commit e45e18f7 authored by abarth@webkit.org's avatar abarth@webkit.org

Move FrameDestructionObserver to its own file

https://bugs.webkit.org/show_bug.cgi?id=75693

Reviewed by Eric Seidel.

We should have one class per file, on general principles.  Also, this
make it possible to use this class in DOMWindow without introducing a
circular include dependency.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* page/Frame.cpp:
* page/Frame.h:
* page/FrameDestructionObserver.cpp: Added.
(WebCore::FrameDestructionObserver::FrameDestructionObserver):
(WebCore::FrameDestructionObserver::~FrameDestructionObserver):
(WebCore::FrameDestructionObserver::frameDestroyed):
* page/FrameDestructionObserver.h: Added.
(WebCore::FrameDestructionObserver::frame):
* plugins/DOMMimeType.h:
* plugins/DOMPlugin.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104344 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0d876f85
......@@ -995,6 +995,7 @@ SET(WebCore_SOURCES
page/FocusController.cpp
page/Frame.cpp
page/FrameActionScheduler.cpp
page/FrameDestructionObserver.cpp
page/FrameTree.cpp
page/FrameView.cpp
page/Geolocation.cpp
......
2012-01-06 Adam Barth <abarth@webkit.org>
Move FrameDestructionObserver to its own file
https://bugs.webkit.org/show_bug.cgi?id=75693
Reviewed by Eric Seidel.
We should have one class per file, on general principles. Also, this
make it possible to use this class in DOMWindow without introducing a
circular include dependency.
* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* page/Frame.cpp:
* page/Frame.h:
* page/FrameDestructionObserver.cpp: Added.
(WebCore::FrameDestructionObserver::FrameDestructionObserver):
(WebCore::FrameDestructionObserver::~FrameDestructionObserver):
(WebCore::FrameDestructionObserver::frameDestroyed):
* page/FrameDestructionObserver.h: Added.
(WebCore::FrameDestructionObserver::frame):
* plugins/DOMMimeType.h:
* plugins/DOMPlugin.h:
2012-01-06 Anders Carlsson <andersca@apple.com>
Fix Snow Leopard build.
......@@ -2664,6 +2664,8 @@ webcore_sources += \
Source/WebCore/page/Frame.h \
Source/WebCore/page/FrameActionScheduler.cpp \
Source/WebCore/page/FrameActionScheduler.h \
Source/WebCore/page/FrameDestructionObserver.cpp \
Source/WebCore/page/FrameDestructionObserver.h \
Source/WebCore/page/FrameTree.cpp \
Source/WebCore/page/FrameTree.h \
Source/WebCore/page/FrameView.cpp \
......
......@@ -973,6 +973,7 @@ SOURCES += \
page/FocusController.cpp \
page/Frame.cpp \
page/FrameActionScheduler.cpp \
page/FrameDestructionObserver.cpp \
page/FrameTree.cpp \
page/FrameView.cpp \
page/Geolocation.cpp \
......
......@@ -2996,6 +2996,8 @@
'page/Frame.cpp',
'page/FrameActionScheduler.cpp',
'page/FrameActionScheduler.h',
'page/FrameDestructionObserver.cpp',
'page/FrameDestructionObserver.h',
'page/FrameTree.cpp',
'page/FrameView.cpp',
'page/Geolocation.cpp',
......
......@@ -25252,14 +25252,22 @@
<File
RelativePath="..\page\Frame.h"
>
<File
RelativePath="..\page\FrameActionScheduler.cpp"
>
</File>
<File
RelativePath="..\page\FrameActionScheduler.h"
>
</File>
</File>
<File
RelativePath="..\page\FrameActionScheduler.cpp"
>
</File>
<File
RelativePath="..\page\FrameActionScheduler.h"
>
</File>
<File
RelativePath="..\page\FrameDestructionObserver.cpp"
>
</File>
<File
RelativePath="..\page\FrameDestructionObserver.h"
>
</File>
<File
RelativePath="..\page\FrameTree.cpp"
......@@ -3269,6 +3269,8 @@
973DC640145A9409002842C2 /* ExceptionCodeDescription.h in Headers */ = {isa = PBXBuildFile; fileRef = 973DC63E145A9409002842C2 /* ExceptionCodeDescription.h */; settings = {ATTRIBUTES = (Private, ); }; };
973E325610883B7C005BC493 /* ResourceLoadNotifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 973E325410883B7C005BC493 /* ResourceLoadNotifier.cpp */; };
973E325710883B7C005BC493 /* ResourceLoadNotifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 973E325510883B7C005BC493 /* ResourceLoadNotifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
974A862214B7ADBB003FDC76 /* FrameDestructionObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 974A862014B7ADBB003FDC76 /* FrameDestructionObserver.cpp */; };
974A862314B7ADBB003FDC76 /* FrameDestructionObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 974A862114B7ADBB003FDC76 /* FrameDestructionObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
974D2DA4146A535D00D51F8B /* SecurityPolicy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 974D2DA2146A535D00D51F8B /* SecurityPolicy.cpp */; };
974D2DA5146A535D00D51F8B /* SecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 974D2DA3146A535D00D51F8B /* SecurityPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; };
9752D38D1413104B003305BD /* JSHTMLSpanElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9752D38B1413104B003305BD /* JSHTMLSpanElement.cpp */; };
......@@ -10525,6 +10527,8 @@
973DC63E145A9409002842C2 /* ExceptionCodeDescription.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionCodeDescription.h; sourceTree = "<group>"; };
973E325410883B7C005BC493 /* ResourceLoadNotifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoadNotifier.cpp; sourceTree = "<group>"; };
973E325510883B7C005BC493 /* ResourceLoadNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadNotifier.h; sourceTree = "<group>"; };
974A862014B7ADBB003FDC76 /* FrameDestructionObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FrameDestructionObserver.cpp; sourceTree = "<group>"; };
974A862114B7ADBB003FDC76 /* FrameDestructionObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameDestructionObserver.h; sourceTree = "<group>"; };
974D2DA2146A535D00D51F8B /* SecurityPolicy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityPolicy.cpp; sourceTree = "<group>"; };
974D2DA3146A535D00D51F8B /* SecurityPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecurityPolicy.h; sourceTree = "<group>"; };
9752D38B1413104B003305BD /* JSHTMLSpanElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLSpanElement.cpp; sourceTree = "<group>"; };
......@@ -15668,6 +15672,8 @@
65BF022A0974816300C43196 /* Frame.h */,
A7B070D0130A409C00A3763C /* FrameActionScheduler.cpp */,
A7B070D1130A409C00A3763C /* FrameActionScheduler.h */,
974A862014B7ADBB003FDC76 /* FrameDestructionObserver.cpp */,
974A862114B7ADBB003FDC76 /* FrameDestructionObserver.h */,
65A21482097A3F5300B9050A /* FrameTree.cpp */,
65A21483097A3F5300B9050A /* FrameTree.h */,
65CBFEF70974F607001DAC25 /* FrameView.cpp */,
......@@ -24876,6 +24882,7 @@
E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */,
FD537353137B651800008DCE /* ZeroPole.h in Headers */,
974A862314B7ADBB003FDC76 /* FrameDestructionObserver.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -27779,6 +27786,7 @@
E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */,
FD537352137B651800008DCE /* ZeroPole.cpp in Sources */,
974A862214B7ADBB003FDC76 /* FrameDestructionObserver.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -47,6 +47,7 @@
#include "EventNames.h"
#include "FloatQuad.h"
#include "FocusController.h"
#include "FrameDestructionObserver.h"
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
#include "FrameView.h"
......@@ -235,24 +236,6 @@ Frame::~Frame()
}
}
FrameDestructionObserver::FrameDestructionObserver(Frame* frame)
: m_frame(frame)
{
if (m_frame)
m_frame->addDestructionObserver(this);
}
FrameDestructionObserver::~FrameDestructionObserver()
{
if (m_frame)
m_frame->removeDestructionObserver(this);
}
void FrameDestructionObserver::frameDestroyed()
{
m_frame = 0;
}
void Frame::addDestructionObserver(FrameDestructionObserver* observer)
{
m_destructionObservers.add(observer);
......
......@@ -63,7 +63,7 @@ typedef struct HBITMAP__* HBITMAP;
namespace WebCore {
class Document;
class Frame;
class FrameDestructionObserver;
class FrameView;
class HTMLTableCellElement;
class RegularExpression;
......@@ -74,18 +74,6 @@ namespace WebCore {
class TiledBackingStoreClient { };
#endif
class FrameDestructionObserver {
public:
explicit FrameDestructionObserver(Frame*);
virtual void frameDestroyed();
Frame* frame() const { return m_frame; }
protected:
virtual ~FrameDestructionObserver();
Frame* m_frame;
};
class Frame : public RefCounted<Frame>, public TiledBackingStoreClient {
public:
static PassRefPtr<Frame> create(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*);
......
/*
* Copyright (C) 2011 Google, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "FrameDestructionObserver.h"
#include "Frame.h"
namespace WebCore {
FrameDestructionObserver::FrameDestructionObserver(Frame* frame)
: m_frame(frame)
{
if (m_frame)
m_frame->addDestructionObserver(this);
}
FrameDestructionObserver::~FrameDestructionObserver()
{
if (m_frame)
m_frame->removeDestructionObserver(this);
}
void FrameDestructionObserver::frameDestroyed()
{
m_frame = 0;
}
}
/*
* Copyright (C) 2011 Google, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY GOOGLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FrameDestructionObserver_h
#define FrameDestructionObserver_h
namespace WebCore {
class Frame;
class FrameDestructionObserver {
public:
explicit FrameDestructionObserver(Frame*);
virtual void frameDestroyed();
Frame* frame() const { return m_frame; }
protected:
virtual ~FrameDestructionObserver();
Frame* m_frame;
};
}
#endif
......@@ -21,6 +21,7 @@
#define DOMMimeType_h
#include "Frame.h"
#include "FrameDestructionObserver.h"
#include "PluginData.h"
#include <wtf/Forward.h>
......
......@@ -20,6 +20,7 @@
#ifndef DOMPlugin_h
#define DOMPlugin_h
#include "FrameDestructionObserver.h"
#include "DOMMimeType.h"
#include <wtf/Forward.h>
#include <wtf/RefPtr.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment