Commit a9922b67 authored by timothy@apple.com's avatar timothy@apple.com

Adds an event loop abstraction to platform. This abstraction will be

used by the JavaScriptDebugServer to implement pausing.

Reviewed by Kevin McCullough.

* platform/EventLoop.h: Added.
(WebCore::EventLoop::EventLoop):
(WebCore::EventLoop::ended): Return m_ended.
* platform/mac/EventLoopMac.mm: Added.
(WebCore::EventLoop::cycle): Call nextEventMatchingMask and then sendEvent.
* platform/win/EventLoopWin.cpp: Added.
(WebCore::EventLoop::cycle): Call GetMessage, TranslateMessage and DispatchMessage.
* WebCore.xcodeproj/project.pbxproj: Add new files.
* WebCore.vcproj/WebCore.vcproj: Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33400 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c6e45715
2008-05-13 Timothy Hatcher <timothy@apple.com>
Adds an event loop abstraction to platform. This abstraction will be
used by the JavaScriptDebugServer to implement pausing.
Reviewed by Kevin McCullough.
* platform/EventLoop.h: Added.
(WebCore::EventLoop::EventLoop):
(WebCore::EventLoop::ended): Return m_ended.
* platform/mac/EventLoopMac.mm: Added.
(WebCore::EventLoop::cycle): Call nextEventMatchingMask and then sendEvent.
* platform/win/EventLoopWin.cpp: Added.
(WebCore::EventLoop::cycle): Call GetMessage, TranslateMessage and DispatchMessage.
* WebCore.xcodeproj/project.pbxproj: Add new files.
* WebCore.vcproj/WebCore.vcproj: Ditto.
2008-05-13 Timothy Hatcher <timothy@apple.com>
Breaks out ObjectPropertiesSection from PropertiesSidebarPane
......@@ -4175,6 +4175,10 @@
RelativePath="..\platform\DragImage.h"
>
</File>
<File
RelativePath="..\platform\EventLoop.h"
>
</File>
<File
RelativePath="..\platform\FileChooser.cpp"
>
......@@ -4458,6 +4462,10 @@
RelativePath="..\platform\win\EditorWin.cpp"
>
</File>
<File
RelativePath="..\platform\win\EventLoopWin.cpp"
>
</File>
<File
RelativePath="..\platform\win\FileChooserWin.cpp"
>
......
......@@ -343,6 +343,8 @@
1C5FAEE70DCFDA6800D58F78 /* JSJavaScriptCallFrameCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C5FAEE60DCFDA6800D58F78 /* JSJavaScriptCallFrameCustom.cpp */; };
1CA19CAE0DC1145F0065A994 /* JavaScriptCallFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CA19CAC0DC1145F0065A994 /* JavaScriptCallFrame.h */; };
1CA19CAF0DC1145F0065A994 /* JavaScriptCallFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1CA19CAD0DC1145F0065A994 /* JavaScriptCallFrame.cpp */; };
1CA19E050DC255950065A994 /* EventLoopMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CA19E030DC255950065A994 /* EventLoopMac.mm */; };
1CA19E160DC255CA0065A994 /* EventLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CA19E150DC255CA0065A994 /* EventLoop.h */; };
1CAF34810A6C405200ABE06E /* WebScriptObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CAF347E0A6C405200ABE06E /* WebScriptObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
1CAF34820A6C405200ABE06E /* WebScriptObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CAF347F0A6C405200ABE06E /* WebScriptObject.mm */; };
1CAF34830A6C405200ABE06E /* WebScriptObjectPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CAF34800A6C405200ABE06E /* WebScriptObjectPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -4814,6 +4816,8 @@
1C904DF90BA9D2C80081E9D0 /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
1CA19CAC0DC1145F0065A994 /* JavaScriptCallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptCallFrame.h; sourceTree = "<group>"; };
1CA19CAD0DC1145F0065A994 /* JavaScriptCallFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JavaScriptCallFrame.cpp; sourceTree = "<group>"; };
1CA19E030DC255950065A994 /* EventLoopMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EventLoopMac.mm; sourceTree = "<group>"; };
1CA19E150DC255CA0065A994 /* EventLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventLoop.h; sourceTree = "<group>"; };
1CAF347E0A6C405200ABE06E /* WebScriptObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptObject.h; sourceTree = "<group>"; };
1CAF347F0A6C405200ABE06E /* WebScriptObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebScriptObject.mm; sourceTree = "<group>"; };
1CAF34800A6C405200ABE06E /* WebScriptObjectPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebScriptObjectPrivate.h; sourceTree = "<group>"; };
......@@ -8935,6 +8939,7 @@
F58784F002DE375901EA4122 /* CursorMac.mm */,
A795463D0B5C4C80007B438F /* DragDataMac.mm */,
A7CFB3D40B7ED1180070C32D /* DragImageMac.mm */,
1CA19E030DC255950065A994 /* EventLoopMac.mm */,
066C772C0AB603D200238CC4 /* FileChooserMac.mm */,
514B3F750C722055000530DF /* FileSystemMac.mm */,
935C476C09AC4D6300A6AAB4 /* FoundationExtras.h */,
......@@ -12427,6 +12432,7 @@
A79546420B5C4CB4007B438F /* DragData.cpp */,
A7CFB3D00B7ED10A0070C32D /* DragImage.h */,
A7CFB3CF0B7ED10A0070C32D /* DragImage.cpp */,
1CA19E150DC255CA0065A994 /* EventLoop.h */,
BC073BA90C399B1F000F5979 /* FloatConversion.h */,
934FE9E40B5CA539003E4A73 /* FileChooser.cpp */,
066C772A0AB603B700238CC4 /* FileChooser.h */,
......@@ -15055,6 +15061,7 @@
BCD0FC4F0DBD720B00B2F630 /* DOMRGBColorInternal.h in Headers */,
BC99812E0DBE807A008CE9EF /* DOMAbstractViewFrame.h in Headers */,
1CA19CAE0DC1145F0065A994 /* JavaScriptCallFrame.h in Headers */,
1CA19E160DC255CA0065A994 /* EventLoop.h in Headers */,
511F23180DC160DA004F0032 /* LocalStorageTask.h in Headers */,
511F231A0DC160DA004F0032 /* LocalStorageThread.h in Headers */,
BC5A12E00DC0414800C9AFAD /* CSSReflectValue.h in Headers */,
......@@ -16768,6 +16775,7 @@
F916C48D0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp in Sources */,
BCD0FBD00DBD625E00B2F630 /* DOMAbstractView.mm in Sources */,
1CA19CAF0DC1145F0065A994 /* JavaScriptCallFrame.cpp in Sources */,
1CA19E050DC255950065A994 /* EventLoopMac.mm in Sources */,
511F23170DC160DA004F0032 /* LocalStorageTask.cpp in Sources */,
511F23190DC160DA004F0032 /* LocalStorageThread.cpp in Sources */,
BC5A12DF0DC0414800C9AFAD /* CSSReflectValue.cpp in Sources */,
/*
* Copyright (C) 2008 Apple 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 APPLE 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 EventLoop_h
#define EventLoop_h
#include <wtf/Noncopyable.h>
namespace WebCore {
class EventLoop : Noncopyable {
public:
EventLoop()
: m_ended(false)
{
}
void cycle();
bool ended() const { return m_ended; }
private:
bool m_ended;
};
} // namespace WebCore
#endif // EventLoop_h
/*
* Copyright (C) 2008 Apple 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 APPLE 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 "EventLoop.h"
namespace WebCore {
void EventLoop::cycle()
{
// FIXME: Should this use NSRunLoopCommonModes? Switching to NSRunLoopCommonModes causes Safari to hang in a tight loop.
[NSApp setWindowsNeedUpdate:YES];
NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode dequeue:YES];
[NSApp sendEvent:event];
}
} // namespace WebCore
/*
* Copyright (C) 2008 Apple 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 APPLE 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 "EventLoop.h"
namespace WebCore {
void EventLoop::cycle()
{
MSG msg;
if (!GetMessage(&msg, 0, 0, 0)) {
m_ended = true;
return;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
} // namespace WebCore
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