Changeset 176683 in webkit
- Timestamp:
- Dec 2, 2014 12:30:17 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 2 deleted
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r176622 r176683 1 2014-12-02 Gavin Barraclough <barraclough@apple.com> 2 3 Generalize PageActivityAssertionToken 4 https://bugs.webkit.org/show_bug.cgi?id=139106 5 6 Reviewed by Sam Weinig. 7 8 PageActivityAssertionToken is a RAII mechanism implementing a counter, used by PageThrottler 9 to count user visible activity in progress on the page (currently page load and media playback). 10 Use of an RAII type is prevents a number of possible errors, including double counting a single 11 media element, or failing to decrement the count after a media element has been deallocated. 12 13 The current implementation has a number of drawbacks that have been addressed by this refactoring: 14 - specific to single use in PageThrottler class - not reusable. 15 - incomplete encapsulation - the counter and WeakPtrFactory that comprise the current implementation 16 are not encapsulated (are in the client type, PageThrottler). 17 - tokens are not shared - PageActivityAssertionToken instances are managed by std::unique, every 18 increment requires an object allocation. 19 - redundancy - the current implementation uses a WeakPtr to safely reference the PageThrottler, this 20 is internally implemented using a reference counted type, resulting in two counters being 21 incremented (one in the PageActivityAssertionToken, one in the PageThrottler). 22 23 In the reimplementation: 24 - a callback is provided via a lambda function, which allows for easy reuse without a lot of 25 boilerplate code. 26 - the counter, callback and ownership of the otherwise weakly-owned token is encapsulated within the 27 RefCounter type. 28 - a single count within RefCounter::Count stores the counter value, and also manage the lifetime 29 of this object. 30 - standard RefPtrs are used to manage references to the RefCounter::Count. 31 32 * WTF.xcodeproj/project.pbxproj: 33 - added RefCounter.cpp/.h 34 * wtf/RefCounter.cpp: Added. 35 (WTF::RefCounter::Count::ref): 36 - increment the counter. 37 (WTF::RefCounter::Count::deref): 38 - decrement the counter, and delete as necessary. 39 (WTF::RefCounter::RefCounter): 40 - create a RefCounter::Count. 41 (WTF::RefCounter::~RefCounter): 42 - eagerly delete the Counter if it has no references, otherwise let it be deleted on last deref. 43 * wtf/RefCounter.h: Added. 44 (WTF::RefCounter::Count::Count): 45 - initialize count to 0. 46 (WTF::RefCounter::RefCounter): 47 - takes a lambda to be called when the value changes. 48 (WTF::RefCounter::count): 49 - reference the counter (and in doing so increment the count). 50 (WTF::RefCounter::value): 51 - access the current value of the counter. 52 1 53 2014-12-01 Andreas Kling <akling@apple.com> 2 54 -
trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj
r176592 r176683 121 121 <ClCompile Include="..\wtf\RandomNumber.cpp" /> 122 122 <ClCompile Include="..\wtf\RefCountedLeakCounter.cpp" /> 123 <ClCompile Include="..\wtf\RefCounter.cpp" /> 123 124 <ClCompile Include="..\wtf\RunLoop.cpp" /> 124 125 <ClCompile Include="..\wtf\SHA1.cpp" /> … … 259 260 <ClInclude Include="..\wtf\RefCounted.h" /> 260 261 <ClInclude Include="..\wtf\RefCountedLeakCounter.h" /> 262 <ClInclude Include="..\wtf\RefCounter.h" /> 261 263 <ClInclude Include="..\wtf\RefPtr.h" /> 262 264 <ClInclude Include="..\wtf\RetainPtr.h" /> -
trunk/Source/WTF/WTF.xcodeproj/project.pbxproj
r176592 r176683 81 81 8134013915B092FD001FF0B8 /* Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8134013715B092FD001FF0B8 /* Base64.h */; }; 82 82 83FBA93219DF459700F30ADB /* TypeCasts.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FBA93119DF459700F30ADB /* TypeCasts.h */; }; 83 86F46F601A2840EE00CCBF22 /* RefCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86F46F5E1A2840EE00CCBF22 /* RefCounter.cpp */; }; 84 86F46F611A2840EE00CCBF22 /* RefCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 86F46F5F1A2840EE00CCBF22 /* RefCounter.h */; settings = {ATTRIBUTES = (Private, ); }; }; 83 85 93934BD318A1E8C300D0D6A1 /* StringViewObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93934BD218A1E8C300D0D6A1 /* StringViewObjC.mm */; }; 84 86 93934BD518A1F16900D0D6A1 /* StringViewCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */; }; … … 373 375 8134013715B092FD001FF0B8 /* Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64.h; sourceTree = "<group>"; }; 374 376 83FBA93119DF459700F30ADB /* TypeCasts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeCasts.h; sourceTree = "<group>"; }; 377 86F46F5E1A2840EE00CCBF22 /* RefCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefCounter.cpp; sourceTree = "<group>"; }; 378 86F46F5F1A2840EE00CCBF22 /* RefCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefCounter.h; sourceTree = "<group>"; }; 375 379 93934BD218A1E8C300D0D6A1 /* StringViewObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = StringViewObjC.mm; path = mac/StringViewObjC.mm; sourceTree = "<group>"; }; 376 380 93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringViewCF.cpp; path = cf/StringViewCF.cpp; sourceTree = "<group>"; }; … … 837 841 A8A47301151A825B004123FF /* RefCountedLeakCounter.cpp */, 838 842 A8A47302151A825B004123FF /* RefCountedLeakCounter.h */, 843 86F46F5E1A2840EE00CCBF22 /* RefCounter.cpp */, 844 86F46F5F1A2840EE00CCBF22 /* RefCounter.h */, 839 845 A8A47303151A825B004123FF /* RefPtr.h */, 840 846 A8A47305151A825B004123FF /* RetainPtr.h */, … … 1167 1173 A8A4741E151A825B004123FF /* RetainPtr.h in Headers */, 1168 1174 2CDED0F418115C85004DBA70 /* RunLoop.h in Headers */, 1175 86F46F611A2840EE00CCBF22 /* RefCounter.h in Headers */, 1169 1176 1469419216EAAF6D0024E146 /* RunLoopTimer.h in Headers */, 1170 1177 14F3B0F715E45E4600210069 /* SaturatedArithmetic.h in Headers */, … … 1340 1347 A8A47439151A825B004123FF /* CString.cpp in Sources */, 1341 1348 A8A4739C151A825B004123FF /* CurrentTime.cpp in Sources */, 1349 86F46F601A2840EE00CCBF22 /* RefCounter.cpp in Sources */, 1342 1350 A8A4739E151A825B004123FF /* DataLog.cpp in Sources */, 1343 1351 A8A473A0151A825B004123FF /* DateMath.cpp in Sources */, -
trunk/Source/WTF/wtf/CMakeLists.txt
r175203 r176683 83 83 RefCounted.h 84 84 RefCountedLeakCounter.h 85 RefCounter.h 85 86 RefPtr.h 86 87 RetainPtr.h … … 176 177 RandomNumber.cpp 177 178 RefCountedLeakCounter.cpp 179 RefCounter.cpp 178 180 RunLoop.cpp 179 181 SHA1.cpp -
trunk/Source/WebCore/CMakeLists.txt
r176670 r176683 1910 1910 page/OriginAccessEntry.cpp 1911 1911 page/Page.cpp 1912 page/PageActivityAssertionToken.cpp1913 1912 page/PageConfiguration.cpp 1914 1913 page/PageConsoleClient.cpp -
trunk/Source/WebCore/ChangeLog
r176682 r176683 1 2014-12-02 Gavin Barraclough <barraclough@apple.com> 2 3 Generalize PageActivityAssertionToken 4 https://bugs.webkit.org/show_bug.cgi?id=139106 5 6 Reviewed by Sam Weinig. 7 8 PageActivityAssertionToken is a RAII mechanism implementing a counter, used by PageThrottler 9 to count user visible activity in progress on the page (currently page load and media playback). 10 Use of an RAII type is prevents a number of possible errors, including double counting a single 11 media element, or failing to decrement the count after a media element has been deallocated. 12 13 The current implementation has a number of drawbacks that have been addressed by this refactoring: 14 - specific to single use in PageThrottler class - not reusable. 15 - incomplete encapsulation - the counter and WeakPtrFactory that comprise the current implementation 16 are not encapsulated (are in the client type, PageThrottler). 17 - tokens are not shared - PageActivityAssertionToken instances are managed by std::unique, every 18 increment requires an object allocation. 19 - redundancy - the current implementation uses a WeakPtr to safely reference the PageThrottler, this 20 is internally implemented using a reference counted type, resulting in two counters being 21 incremented (one in the PageActivityAssertionToken, one in the PageThrottler). 22 23 In the reimplementation: 24 - a callback is provided via a lambda function, which allows for easy reuse without a lot of 25 boilerplate code. 26 - the counter, callback and ownership of the otherwise weakly-owned token is encapsulated within the 27 RefCounter type. 28 - a single count within RefCounter::Count stores the counter value, and also manage the lifetime 29 of this object. 30 - standard RefPtrs are used to manage references to the RefCounter::Count. 31 32 * WebCore.xcodeproj/project.pbxproj: 33 - removed PageActivityAssertionToken.cpp/.h 34 * html/HTMLMediaElement.cpp: 35 - removed PageActivityAssertionToken.h 36 * html/HTMLMediaElement.h: 37 - std::unique_ptr<PageActivityAssertionToken> -> RefPtr<RefCounter::Count> 38 * loader/FrameLoader.cpp: 39 - removed PageActivityAssertionToken.h 40 * loader/FrameLoader.h: 41 - std::unique_ptr<PageActivityAssertionToken> -> RefPtr<RefCounter::Count> 42 * loader/SubresourceLoader.cpp: 43 - removed PageActivityAssertionToken.h 44 * loader/SubresourceLoader.h: 45 - removed class PageActivityAssertionToken 46 * page/Page.cpp: 47 - removed PageActivityAssertionToken.h 48 (WebCore::Page::Page): 49 - removed Page* parameter to PageThrottler 50 * page/Page.h: 51 - removed class PageActivityAssertionToken 52 * page/PageActivityAssertionToken.cpp: Removed. 53 * page/PageActivityAssertionToken.h: Removed. 54 - removed PageActivityAssertionToken.cpp/.h 55 * page/PageThrottler.cpp: 56 (WebCore::PageThrottler::PageThrottler): 57 - removed m_page, m_weakPtrFactory, m_activityCount; added m_pageActivityCounter. 58 (WebCore::PageThrottler::mediaActivityToken): 59 - std::unique_ptr<PageActivityAssertionToken> -> PassRefPtr<RefCounter::Count> 60 (WebCore::PageThrottler::pageLoadActivityToken): 61 - std::unique_ptr<PageActivityAssertionToken> -> PassRefPtr<RefCounter::Count> 62 (WebCore::PageThrottler::pageActivityCounterValueDidChange): 63 - merged functionality of incrementActivityCount/decrementActivityCount 64 (WebCore::PageThrottler::incrementActivityCount): Deleted. 65 - see pageActivityCounterValueDidChange 66 (WebCore::PageThrottler::decrementActivityCount): Deleted. 67 - see pageActivityCounterValueDidChange 68 * page/PageThrottler.h: 69 (WebCore::PageThrottler::weakPtr): Deleted. 70 - no longer required; this functionality is now encapsulated within RefCounter. 71 1 72 2014-12-02 Tim Horton <timothy_horton@apple.com> 2 73 -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r176670 r176683 7189 7189 <ClCompile Include="..\page\OriginAccessEntry.cpp" /> 7190 7190 <ClCompile Include="..\page\Page.cpp" /> 7191 <ClCompile Include="..\page\PageActivityAssertionToken.cpp" />7192 7191 <ClCompile Include="..\page\PageConfiguration.cpp" /> 7193 7192 <ClCompile Include="..\page\PageConsoleClient.cpp" /> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r176670 r176683 5594 5594 CCC2B51515F613060048CDD6 /* DeviceController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CCC2B51115F613060048CDD6 /* DeviceController.cpp */; }; 5595 5595 CCC2B51615F613060048CDD6 /* DeviceController.h in Headers */ = {isa = PBXBuildFile; fileRef = CCC2B51215F613060048CDD6 /* DeviceController.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5596 CD08285C1757250F00EC5FB7 /* PageActivityAssertionToken.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD08285A1757250800EC5FB7 /* PageActivityAssertionToken.cpp */; };5597 5596 CD0EEE0E14743F39003EAFA2 /* AudioDestinationIOS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD0EEE0B14743E35003EAFA2 /* AudioDestinationIOS.cpp */; }; 5598 5597 CD127DED14F3097D00E84779 /* WebCoreFullScreenWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD127DEB14F3097900E84779 /* WebCoreFullScreenWindow.mm */; }; … … 13052 13051 CCC2B51115F613060048CDD6 /* DeviceController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceController.cpp; sourceTree = "<group>"; }; 13053 13052 CCC2B51215F613060048CDD6 /* DeviceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceController.h; sourceTree = "<group>"; }; 13054 CD08285A1757250800EC5FB7 /* PageActivityAssertionToken.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PageActivityAssertionToken.cpp; sourceTree = "<group>"; };13055 CD08285B1757250800EC5FB7 /* PageActivityAssertionToken.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PageActivityAssertionToken.h; sourceTree = "<group>"; };13056 13053 CD0EEE0A14743E34003EAFA2 /* AudioDestinationIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AudioDestinationIOS.h; path = ios/AudioDestinationIOS.h; sourceTree = "<group>"; }; 13057 13054 CD0EEE0B14743E35003EAFA2 /* AudioDestinationIOS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AudioDestinationIOS.cpp; path = ios/AudioDestinationIOS.cpp; sourceTree = "<group>"; }; … … 16672 16669 65FEA86809833ADE00BED4AB /* Page.cpp */, 16673 16670 65A21467097A329100B9050A /* Page.h */, 16674 CD08285A1757250800EC5FB7 /* PageActivityAssertionToken.cpp */,16675 CD08285B1757250800EC5FB7 /* PageActivityAssertionToken.h */,16676 16671 CD5E5B601A15F156000C609E /* PageConfiguration.cpp */, 16677 16672 CD5E5B5E1A15CE54000C609E /* PageConfiguration.h */, … … 29111 29106 1A0D57360A5C77FE007EDD4C /* OverflowEvent.cpp in Sources */, 29112 29107 65FEA86909833ADE00BED4AB /* Page.cpp in Sources */, 29113 CD08285C1757250F00EC5FB7 /* PageActivityAssertionToken.cpp in Sources */,29114 29108 1477E7760BF4134A00152872 /* PageCache.cpp in Sources */, 29115 29109 F3820892147D35F90010BC06 /* PageConsoleAgent.cpp in Sources */, -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r176604 r176683 67 67 #include "MediaSessionManager.h" 68 68 #include "NetworkingContext.h" 69 #include "PageActivityAssertionToken.h"70 69 #include "PageGroup.h" 71 70 #include "PageThrottler.h" -
trunk/Source/WebCore/html/HTMLMediaElement.h
r176459 r176683 36 36 #include "MediaControllerInterface.h" 37 37 #include "MediaPlayer.h" 38 #include "PageThrottler.h" 38 39 39 40 #if ENABLE(VIDEO_TRACK) … … 66 67 class MediaControlsHost; 67 68 class MediaError; 68 class PageActivityAssertionToken;69 69 class TimeRanges; 70 70 #if ENABLE(ENCRYPTED_MEDIA_V2) … … 900 900 901 901 std::unique_ptr<HTMLMediaSession> m_mediaSession; 902 std::unique_ptr<PageActivityAssertionToken>m_activityToken;902 PageActivityAssertionToken m_activityToken; 903 903 size_t m_reportedExtraMemoryCost; 904 904 -
trunk/Source/WebCore/loader/FrameLoader.cpp
r176499 r176683 86 86 #include "MemoryCache.h" 87 87 #include "Page.h" 88 #include "PageActivityAssertionToken.h"89 88 #include "PageCache.h" 90 89 #include "PageThrottler.h" -
trunk/Source/WebCore/loader/FrameLoader.h
r176459 r176683 39 39 #include "LayoutMilestones.h" 40 40 #include "MixedContentChecker.h" 41 #include "PageThrottler.h" 41 42 #include "ResourceHandleTypes.h" 42 43 #include "ResourceLoadNotifier.h" … … 67 68 class NetworkingContext; 68 69 class Page; 69 class PageActivityAssertionToken;70 70 class PolicyChecker; 71 71 class ResourceError; … … 444 444 URL m_previousURL; 445 445 RefPtr<HistoryItem> m_requestedHistoryItem; 446 std::unique_ptr<PageActivityAssertionToken>m_activityAssertion;446 PageActivityAssertionToken m_activityAssertion; 447 447 }; 448 448 -
trunk/Source/WebCore/loader/SubresourceLoader.cpp
r176450 r176683 38 38 #include "MemoryCache.h" 39 39 #include "Page.h" 40 #include "PageActivityAssertionToken.h"41 40 #include <wtf/Ref.h> 42 41 #include <wtf/RefCountedLeakCounter.h> -
trunk/Source/WebCore/loader/SubresourceLoader.h
r176172 r176683 40 40 class CachedResourceLoader; 41 41 class Document; 42 class PageActivityAssertionToken;43 42 class ResourceRequest; 44 43 -
trunk/Source/WebCore/page/Page.cpp
r176670 r176683 56 56 #include "Navigator.h" 57 57 #include "NetworkStateNotifier.h" 58 #include "PageActivityAssertionToken.h"59 58 #include "PageCache.h" 60 59 #include "PageConfiguration.h" … … 196 195 , m_alternativeTextClient(pageConfiguration.alternativeTextClient) 197 196 , m_scriptedAnimationsSuspended(false) 198 , m_pageThrottler( *this,m_viewState)197 , m_pageThrottler(m_viewState) 199 198 , m_consoleClient(std::make_unique<PageConsoleClient>(*this)) 200 199 #if ENABLE(REMOTE_INSPECTOR) -
trunk/Source/WebCore/page/Page.h
r176670 r176683 81 81 class MainFrame; 82 82 class MediaCanStartListener; 83 class PageActivityAssertionToken;84 83 class PageConfiguration; 85 84 class PageConsoleClient; -
trunk/Source/WebCore/page/PageThrottler.cpp
r173696 r176683 27 27 #include "PageThrottler.h" 28 28 29 #include "PageActivityAssertionToken.h"30 31 29 namespace WebCore { 32 30 33 PageThrottler::PageThrottler(Page& page, ViewState::Flags viewState) 34 : m_page(page) 35 , m_viewState(viewState) 36 , m_weakPtrFactory(this) 31 PageThrottler::PageThrottler(ViewState::Flags viewState) 32 : m_viewState(viewState) 37 33 , m_hysteresis(*this) 38 , m_ activityCount(0)34 , m_pageActivityCounter([this]() { pageActivityCounterValueDidChange(); }) 39 35 { 40 36 updateUserActivity(); … … 48 44 } 49 45 50 std::unique_ptr<PageActivityAssertionToken>PageThrottler::mediaActivityToken()46 PageActivityAssertionToken PageThrottler::mediaActivityToken() 51 47 { 52 return std::make_unique<PageActivityAssertionToken>(*this);48 return m_pageActivityCounter.count(); 53 49 } 54 50 55 std::unique_ptr<PageActivityAssertionToken>PageThrottler::pageLoadActivityToken()51 PageActivityAssertionToken PageThrottler::pageLoadActivityToken() 56 52 { 57 return std::make_unique<PageActivityAssertionToken>(*this);53 return m_pageActivityCounter.count(); 58 54 } 59 55 60 void PageThrottler:: incrementActivityCount()56 void PageThrottler::pageActivityCounterValueDidChange() 61 57 { 62 // If m_activityCount is nonzero, state must be Started; if m_activityCount is zero, state may be Waiting or Stopped. 63 ASSERT(!!m_activityCount == (m_hysteresis.state() == HysteresisState::Started)); 64 65 if (!m_activityCount++) 58 if (m_pageActivityCounter.value()) 66 59 m_hysteresis.start(); 67 68 ASSERT(m_activityCount && m_hysteresis.state() == HysteresisState::Started); 69 } 70 71 void PageThrottler::decrementActivityCount() 72 { 73 ASSERT(m_activityCount && m_hysteresis.state() == HysteresisState::Started); 74 75 if (!--m_activityCount) 60 else 76 61 m_hysteresis.stop(); 77 62 78 // If m_activityCount is nonzero, state must be Started; if m_activityCountis zero, state may be Waiting or Stopped.79 ASSERT(!!m_ activityCount== (m_hysteresis.state() == HysteresisState::Started));63 // If the counter is nonzero, state must be Started; if the counter is zero, state may be Waiting or Stopped. 64 ASSERT(!!m_pageActivityCounter.value() == (m_hysteresis.state() == HysteresisState::Started)); 80 65 } 81 66 -
trunk/Source/WebCore/page/PageThrottler.h
r173696 r176683 31 31 #include "UserActivity.h" 32 32 #include "ViewState.h" 33 #include <wtf/ WeakPtr.h>33 #include <wtf/RefCounter.h> 34 34 35 35 namespace WebCore { 36 36 37 class Page; 38 class PageActivityAssertionToken; 37 typedef RefPtr<RefCounter::Count> PageActivityAssertionToken; 39 38 40 39 class PageThrottler { 41 40 WTF_MAKE_FAST_ALLOCATED; 42 41 public: 43 PageThrottler( Page&,ViewState::Flags);42 PageThrottler(ViewState::Flags); 44 43 45 44 void createUserActivity(); … … 48 47 void didReceiveUserInput() { m_hysteresis.impulse(); } 49 48 void pluginDidEvaluateWhileAudioIsPlaying() { m_hysteresis.impulse(); } 50 std::unique_ptr<PageActivityAssertionToken>mediaActivityToken();51 std::unique_ptr<PageActivityAssertionToken>pageLoadActivityToken();49 PageActivityAssertionToken mediaActivityToken(); 50 PageActivityAssertionToken pageLoadActivityToken(); 52 51 53 52 private: 54 friend class PageActivityAssertionToken; 55 WeakPtr<PageThrottler> weakPtr() { return m_weakPtrFactory.createWeakPtr(); } 56 void incrementActivityCount(); 57 void decrementActivityCount(); 53 void pageActivityCounterValueDidChange(); 58 54 59 55 void updateUserActivity(); … … 63 59 void stopped(); 64 60 65 Page& m_page;66 61 ViewState::Flags m_viewState; 67 WeakPtrFactory<PageThrottler> m_weakPtrFactory;68 62 HysteresisActivity<PageThrottler> m_hysteresis; 69 63 std::unique_ptr<UserActivity::Impl> m_activity; 70 size_t m_activityCount;64 RefCounter m_pageActivityCounter; 71 65 }; 72 66 -
trunk/Tools/ChangeLog
r176677 r176683 1 2014-12-02 Gavin Barraclough <barraclough@apple.com> 2 3 Generalize PageActivityAssertionToken 4 https://bugs.webkit.org/show_bug.cgi?id=139106 5 6 Reviewed by Sam Weinig. 7 8 Add an API test for WTF::RefCounter. 9 10 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 11 * TestWebKitAPI/Tests/WTF/RefCounter.cpp: Added. 12 (TestWebKitAPI::TEST): 13 - added RefCounter test. 14 1 15 2014-12-02 Alexey Proskuryakov <ap@apple.com> 2 16 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r176574 r176683 135 135 7CFBCAE51743238F00B2BFCF /* WillLoad_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CFBCAE31743238E00B2BFCF /* WillLoad_Bundle.cpp */; }; 136 136 81B50193140F232300D9EB58 /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 81B50192140F232300D9EB58 /* StringBuilder.cpp */; }; 137 86BD19981A2DB05B006DCF0A /* RefCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86BD19971A2DB05B006DCF0A /* RefCounter.cpp */; }; 137 138 8A2C750E16CED9550024F352 /* ResizeWindowAfterCrash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A2C750D16CED9550024F352 /* ResizeWindowAfterCrash.cpp */; }; 138 139 8A3AF93B16C9ED2700D248C1 /* ReloadPageAfterCrash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A3AF93A16C9ED2700D248C1 /* ReloadPageAfterCrash.cpp */; }; … … 497 498 7CFBCAE31743238E00B2BFCF /* WillLoad_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WillLoad_Bundle.cpp; sourceTree = "<group>"; }; 498 499 81B50192140F232300D9EB58 /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringBuilder.cpp; sourceTree = "<group>"; }; 500 86BD19971A2DB05B006DCF0A /* RefCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefCounter.cpp; sourceTree = "<group>"; }; 499 501 8A2C750D16CED9550024F352 /* ResizeWindowAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResizeWindowAfterCrash.cpp; sourceTree = "<group>"; }; 500 502 8A3AF93A16C9ED2700D248C1 /* ReloadPageAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReloadPageAfterCrash.cpp; sourceTree = "<group>"; }; … … 962 964 0FC6C4CB141027E0005B7F0C /* RedBlackTree.cpp */, 963 965 93A427AA180DA26400CD24D7 /* Ref.cpp */, 966 86BD19971A2DB05B006DCF0A /* RefCounter.cpp */, 964 967 93A427AD180DA60F00CD24D7 /* RefLogger.h */, 965 968 93A427A8180D9B0700CD24D7 /* RefPtr.cpp */, … … 1388 1391 51FCF79A1534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp in Sources */, 1389 1392 1AFDE6561953B2C000C48FFA /* Optional.cpp in Sources */, 1393 86BD19981A2DB05B006DCF0A /* RefCounter.cpp in Sources */, 1390 1394 C540F776152E4DA000A40C8C /* SimplifyMarkup.mm in Sources */, 1391 1395 4A410F4C19AF7BD6002EBAB5 /* UserMedia.cpp in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.