Changeset 207156 in webkit
- Timestamp:
- Oct 11, 2016 12:35:36 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r207151 r207156 1 2016-10-11 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Add SynchronizedFixedQueue class 4 https://bugs.webkit.org/show_bug.cgi?id=162478 5 6 Reviewed by Geoffrey Garen. 7 8 This class represents a simple producer/consumer worker. It facilitates 9 synchronizing enqueuing to and dequeuing from a fixed size-queue. It uses 10 a single lock and a single condition to synchronize all its members among 11 the working threads. This means a single thread is active at any time and 12 and the other threads are blocked waiting for the lock to be released. Or 13 they are sleeping waiting for the condition to be satisfied. 14 15 * WTF.xcodeproj/project.pbxproj: 16 * wtf/SynchronizedFixedQueue.h: Added. 17 (WTF::SynchronizedFixedQueue::SynchronizedFixedQueue): 18 (WTF::SynchronizedFixedQueue::open): Restore the queue to its original state. 19 (WTF::SynchronizedFixedQueue::close): Wake all the sleeping threads with a closing state. 20 (WTF::SynchronizedFixedQueue::isOpen): Does the queue accept new items? 21 (WTF::SynchronizedFixedQueue::enqueue): Enqueue an item into the queue. 22 (WTF::SynchronizedFixedQueue::dequeue): Dequeue an item form the queue. 23 1 24 2016-10-11 Alex Christensen <achristensen@webkit.org> 2 25 -
trunk/Source/WTF/WTF.xcodeproj/project.pbxproj
r206691 r207156 120 120 539EB0631D55284200C82EF7 /* LEBDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 539EB0621D55284200C82EF7 /* LEBDecoder.h */; }; 121 121 553071CA1C40427200384898 /* TinyLRUCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 553071C91C40427200384898 /* TinyLRUCache.h */; }; 122 5597F82F1D94B9970066BC21 /* SynchronizedFixedQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 5597F82C1D94B9970066BC21 /* SynchronizedFixedQueue.h */; }; 122 123 5C7C88D41D0A3A0A009D2F6D /* UniqueRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C7C88D31D0A3A0A009D2F6D /* UniqueRef.h */; }; 123 124 70A993FE1AD7151300FA615B /* SymbolRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 70A993FC1AD7151300FA615B /* SymbolRegistry.cpp */; }; … … 464 465 539EB0621D55284200C82EF7 /* LEBDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LEBDecoder.h; sourceTree = "<group>"; }; 465 466 553071C91C40427200384898 /* TinyLRUCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TinyLRUCache.h; sourceTree = "<group>"; }; 467 5597F82C1D94B9970066BC21 /* SynchronizedFixedQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SynchronizedFixedQueue.h; sourceTree = "<group>"; }; 466 468 5B43383A5D0B463C9433D933 /* IndexMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexMap.h; sourceTree = "<group>"; }; 467 469 5C7C88D31D0A3A0A009D2F6D /* UniqueRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UniqueRef.h; sourceTree = "<group>"; }; … … 1024 1026 0FDDBFA51666DFA300C55FEF /* StringPrintStream.cpp */, 1025 1027 0FDDBFA61666DFA300C55FEF /* StringPrintStream.h */, 1028 5597F82C1D94B9970066BC21 /* SynchronizedFixedQueue.h */, 1026 1029 0FB317C31C488001007E395A /* SystemTracing.h */, 1027 1030 A8A4731A151A825B004123FF /* TemporaryChange.h */, … … 1408 1411 1A6BB769162F300500DD16DB /* StreamBuffer.h in Headers */, 1409 1412 A8A4743B151A825B004123FF /* StringBuffer.h in Headers */, 1413 5597F82F1D94B9970066BC21 /* SynchronizedFixedQueue.h in Headers */, 1410 1414 A8A4743D151A825B004123FF /* StringBuilder.h in Headers */, 1411 1415 430B47891AAAAC1A001223DA /* StringCommon.h in Headers */, -
trunk/Tools/ChangeLog
r207153 r207156 1 2016-10-11 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Add SynchronizedFixedQueue class 4 https://bugs.webkit.org/show_bug.cgi?id=162478 5 6 Reviewed by Geoffrey Garen. 7 8 Add a new test for SynchronizedFixedQueue. The test defines a new class 9 called ToUpperConverter which converts strings from lower case to upper 10 case. It creates two threads : (1) produce thread and (2) consume thread. 11 Here is what each thread does: 12 13 1. Main threads: Enqueues lower case strings into m_lowerQueue. 14 2. Produce thread: Dequeues lower case strings from m_lowerQueue and 15 enqueue their upper case strings in the m_upperQueue. 16 3. Consume thread: Dequeues upper case strings from m_upperQueue. 17 18 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 19 * TestWebKitAPI/Tests/WTF/SynchronizedFixedQueue.cpp: Added. 20 (TestWebKitAPI::textItem): A helper function which returns a lower case string given an index. 21 (TestWebKitAPI::toUpper): A helper function which Returns the upper case of a string. 22 (TestWebKitAPI::ToUpperConverter::ToUpperConverter): 23 (TestWebKitAPI::ToUpperConverter::produceQueue): Returns a workQueue for the produce thread. 24 (TestWebKitAPI::ToUpperConverter::consumeQueue): Returns a workQueue for the consume thread. 25 (TestWebKitAPI::ToUpperConverter::startProducing): Creates a thread for the producer. 26 (TestWebKitAPI::ToUpperConverter::startConsuming): Creates a thread for the consumer. 27 (TestWebKitAPI::ToUpperConverter::start): Starts both the producer and the consumer threads. 28 (TestWebKitAPI::ToUpperConverter::stopProducing): Terminates the producer thread. 29 (TestWebKitAPI::ToUpperConverter::stopConsuming): Terminates the consumer thread. 30 (TestWebKitAPI::ToUpperConverter::stop): Terminates both the producer and the consumer threads. 31 (TestWebKitAPI::ToUpperConverter::enqueueLower): Adds a lower case string to the m_lowerQueue on the main thread. 32 (TestWebKitAPI::ToUpperConverter::isProducing): Returns whether the producing thread is active. 33 (TestWebKitAPI::ToUpperConverter::isConsuming): Returns whether the consuming thread is active. 34 (TestWebKitAPI::ToUpperConverter::produceCount): Returns the number of produced elements. 35 (TestWebKitAPI::ToUpperConverter::consumeCount): Returns the number of consumed elements. 36 (TestWebKitAPI::TEST): 37 1 38 2016-10-11 Megan Gardner <megan_gardner@apple.com> 2 39 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r206922 r207156 141 141 536770341CC8022800D425B1 /* WebScriptObjectDescription.mm in Sources */ = {isa = PBXBuildFile; fileRef = 536770331CC8022800D425B1 /* WebScriptObjectDescription.mm */; }; 142 142 536770361CC81B6100D425B1 /* WebScriptObjectDescription.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 536770351CC812F900D425B1 /* WebScriptObjectDescription.html */; }; 143 5597F8361D9596C80066BC21 /* SynchronizedFixedQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5597F8341D9596C80066BC21 /* SynchronizedFixedQueue.cpp */; }; 143 144 5714ECB91CA8B5B000051AC8 /* DownloadRequestOriginalURL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5714ECB81CA8B58800051AC8 /* DownloadRequestOriginalURL.html */; }; 144 145 5714ECBB1CA8BFE400051AC8 /* DownloadRequestOriginalURLFrame.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5714ECBA1CA8BFD100051AC8 /* DownloadRequestOriginalURLFrame.html */; }; … … 917 918 536770331CC8022800D425B1 /* WebScriptObjectDescription.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebScriptObjectDescription.mm; sourceTree = "<group>"; }; 918 919 536770351CC812F900D425B1 /* WebScriptObjectDescription.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = WebScriptObjectDescription.html; sourceTree = "<group>"; }; 920 5597F8341D9596C80066BC21 /* SynchronizedFixedQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SynchronizedFixedQueue.cpp; sourceTree = "<group>"; }; 919 921 5714ECB81CA8B58800051AC8 /* DownloadRequestOriginalURL.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = DownloadRequestOriginalURL.html; sourceTree = "<group>"; }; 920 922 5714ECBA1CA8BFD100051AC8 /* DownloadRequestOriginalURLFrame.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = DownloadRequestOriginalURLFrame.html; sourceTree = "<group>"; }; … … 1796 1798 C01363C713C3997300EF3964 /* StringOperators.cpp */, 1797 1799 7C74D42D188228F300E5ED57 /* StringView.cpp */, 1800 5597F8341D9596C80066BC21 /* SynchronizedFixedQueue.cpp */, 1798 1801 0BCD85691485C98B00EA2003 /* TemporaryChange.cpp */, 1799 1802 5C5E633D1D0B67940085A025 /* UniqueRef.cpp */, … … 2290 2293 7C83DF371D0A590C00FEBCF3 /* StringImpl.cpp in Sources */, 2291 2294 7C83DF381D0A590C00FEBCF3 /* StringOperators.cpp in Sources */, 2295 5597F8361D9596C80066BC21 /* SynchronizedFixedQueue.cpp in Sources */, 2292 2296 7C83DF3A1D0A590C00FEBCF3 /* StringView.cpp in Sources */, 2293 2297 7C83DF3D1D0A590C00FEBCF3 /* TemporaryChange.cpp in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.