Title: [104344] trunk/Source/WebCore
Revision
104344
Author
[email protected]
Date
2012-01-06 14:54:54 -0800 (Fri, 06 Jan 2012)

Log Message

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:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (104343 => 104344)


--- trunk/Source/WebCore/CMakeLists.txt	2012-01-06 22:46:20 UTC (rev 104343)
+++ trunk/Source/WebCore/CMakeLists.txt	2012-01-06 22:54:54 UTC (rev 104344)
@@ -995,6 +995,7 @@
     page/FocusController.cpp
     page/Frame.cpp
     page/FrameActionScheduler.cpp
+    page/FrameDestructionObserver.cpp
     page/FrameTree.cpp
     page/FrameView.cpp
     page/Geolocation.cpp

Modified: trunk/Source/WebCore/ChangeLog (104343 => 104344)


--- trunk/Source/WebCore/ChangeLog	2012-01-06 22:46:20 UTC (rev 104343)
+++ trunk/Source/WebCore/ChangeLog	2012-01-06 22:54:54 UTC (rev 104344)
@@ -1,3 +1,30 @@
+2012-01-06  Adam Barth  <[email protected]>
+
+        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  <[email protected]>
 
         Fix Snow Leopard build.

Modified: trunk/Source/WebCore/GNUmakefile.list.am (104343 => 104344)


--- trunk/Source/WebCore/GNUmakefile.list.am	2012-01-06 22:46:20 UTC (rev 104343)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2012-01-06 22:54:54 UTC (rev 104344)
@@ -2664,6 +2664,8 @@
 	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 \

Modified: trunk/Source/WebCore/Target.pri (104343 => 104344)


--- trunk/Source/WebCore/Target.pri	2012-01-06 22:46:20 UTC (rev 104343)
+++ trunk/Source/WebCore/Target.pri	2012-01-06 22:54:54 UTC (rev 104344)
@@ -973,6 +973,7 @@
     page/FocusController.cpp \
     page/Frame.cpp \
     page/FrameActionScheduler.cpp \
+    page/FrameDestructionObserver.cpp \
     page/FrameTree.cpp \
     page/FrameView.cpp \
     page/Geolocation.cpp \

Modified: trunk/Source/WebCore/WebCore.gypi (104343 => 104344)


--- trunk/Source/WebCore/WebCore.gypi	2012-01-06 22:46:20 UTC (rev 104343)
+++ trunk/Source/WebCore/WebCore.gypi	2012-01-06 22:54:54 UTC (rev 104344)
@@ -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',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (104343 => 104344)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-01-06 22:46:20 UTC (rev 104343)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2012-01-06 22:54:54 UTC (rev 104344)
@@ -25252,16 +25252,24 @@
 			<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"
 				>
 			</File>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (104343 => 104344)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-01-06 22:46:20 UTC (rev 104343)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-01-06 22:54:54 UTC (rev 104344)
@@ -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;
 		};

Modified: trunk/Source/WebCore/page/Frame.cpp (104343 => 104344)


--- trunk/Source/WebCore/page/Frame.cpp	2012-01-06 22:46:20 UTC (rev 104343)
+++ trunk/Source/WebCore/page/Frame.cpp	2012-01-06 22:54:54 UTC (rev 104344)
@@ -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 @@
     }
 }
 
-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);

Modified: trunk/Source/WebCore/page/Frame.h (104343 => 104344)


--- trunk/Source/WebCore/page/Frame.h	2012-01-06 22:46:20 UTC (rev 104343)
+++ trunk/Source/WebCore/page/Frame.h	2012-01-06 22:54:54 UTC (rev 104344)
@@ -63,7 +63,7 @@
 namespace WebCore {
 
     class Document;
-    class Frame;
+    class FrameDestructionObserver;
     class FrameView;
     class HTMLTableCellElement;
     class RegularExpression;
@@ -74,18 +74,6 @@
     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*);

Added: trunk/Source/WebCore/page/FrameDestructionObserver.cpp (0 => 104344)


--- trunk/Source/WebCore/page/FrameDestructionObserver.cpp	                        (rev 0)
+++ trunk/Source/WebCore/page/FrameDestructionObserver.cpp	2012-01-06 22:54:54 UTC (rev 104344)
@@ -0,0 +1,51 @@
+/*
+ * 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;
+}
+
+}

Added: trunk/Source/WebCore/page/FrameDestructionObserver.h (0 => 104344)


--- trunk/Source/WebCore/page/FrameDestructionObserver.h	                        (rev 0)
+++ trunk/Source/WebCore/page/FrameDestructionObserver.h	2012-01-06 22:54:54 UTC (rev 104344)
@@ -0,0 +1,47 @@
+/*
+ * 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

Modified: trunk/Source/WebCore/plugins/DOMMimeType.h (104343 => 104344)


--- trunk/Source/WebCore/plugins/DOMMimeType.h	2012-01-06 22:46:20 UTC (rev 104343)
+++ trunk/Source/WebCore/plugins/DOMMimeType.h	2012-01-06 22:54:54 UTC (rev 104344)
@@ -21,6 +21,7 @@
 #define DOMMimeType_h
 
 #include "Frame.h"
+#include "FrameDestructionObserver.h"
 #include "PluginData.h"
 
 #include <wtf/Forward.h>

Modified: trunk/Source/WebCore/plugins/DOMPlugin.h (104343 => 104344)


--- trunk/Source/WebCore/plugins/DOMPlugin.h	2012-01-06 22:46:20 UTC (rev 104343)
+++ trunk/Source/WebCore/plugins/DOMPlugin.h	2012-01-06 22:54:54 UTC (rev 104344)
@@ -20,6 +20,7 @@
 #ifndef DOMPlugin_h
 #define DOMPlugin_h
 
+#include "FrameDestructionObserver.h"
 #include "DOMMimeType.h"
 #include <wtf/Forward.h>
 #include <wtf/RefPtr.h>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to