Diff
Modified: trunk/Source/WTF/ChangeLog (197131 => 197132)
--- trunk/Source/WTF/ChangeLog 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Source/WTF/ChangeLog 2016-02-25 22:24:32 UTC (rev 197132)
@@ -1,3 +1,39 @@
+2016-02-25 Gavin Barraclough <barraclo...@apple.com>
+
+ Should template RefCounter instead of RefCounter::Token
+ https://bugs.webkit.org/show_bug.cgi?id=154691
+
+ Reviewed by Anders Carlsson.
+
+ My real goal here is to make the counter accurate. Currently returning a Token from token<>()
+ results in ref-count churn. Fixing this either means changing the return value, or improving
+ Token (which will probably mean replacing it with RefPtr). Either way would break the current
+ type checking. Move type tag to RefCount so this can still be enforced.
+
+ * WTF.vcxproj/WTF.vcxproj:
+ * WTF.vcxproj/WTF.vcxproj.filters:
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/RefCounter.cpp: Removed.
+ - Removed RefCounter.cpp.
+ * wtf/RefCounter.h:
+ (WTF::RefCounter::Token::Token):
+ (WTF::RefCounter::Token::operator bool):
+ (WTF::RefCounter::RefCounter):
+ (WTF::RefCounter::count):
+ (WTF::RefCounter::value):
+ (WTF::RefCounter<T>::Count::ref):
+ (WTF::RefCounter<T>::Count::deref):
+ (WTF::RefCounter<T>::RefCounter):
+ (WTF::RefCounter<T>::~RefCounter):
+ (WTF::RefCounter<T>::Token::Token):
+ (WTF::=):
+ (WTF::RefCounter::token): Deleted.
+ (WTF::RefCounter::Token<T>::Token): Deleted.
+ - RefCounter -> RefCounter<T>,
+ - Token<T> -> Token,
+ - renamed token<>() -> count().
+
2016-02-25 Sam Weinig <s...@webkit.org>
HashMap::ensure() should return an AddResult like all the other add-like functions.
Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj (197131 => 197132)
--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj 2016-02-25 22:24:32 UTC (rev 197132)
@@ -111,7 +111,6 @@
<ClCompile Include="..\wtf\RAMSize.cpp" />
<ClCompile Include="..\wtf\RandomNumber.cpp" />
<ClCompile Include="..\wtf\RefCountedLeakCounter.cpp" />
- <ClCompile Include="..\wtf\RefCounter.cpp" />
<ClCompile Include="..\wtf\RunLoop.cpp" />
<ClCompile Include="..\wtf\SHA1.cpp" />
<ClCompile Include="..\wtf\SixCharacterHash.cpp" />
Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters (197131 => 197132)
--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters 2016-02-25 22:24:32 UTC (rev 197132)
@@ -243,7 +243,6 @@
<ClCompile Include="..\wtf\FastBitVector.cpp">
<Filter>wtf</Filter>
</ClCompile>
- <ClCompile Include="..\wtf\RefCounter.cpp" />
<ClCompile Include="..\wtf\win\WTFDLL.cpp">
<Filter>wtf\win</Filter>
</ClCompile>
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (197131 => 197132)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2016-02-25 22:24:32 UTC (rev 197132)
@@ -111,7 +111,6 @@
8134013815B092FD001FF0B8 /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8134013615B092FD001FF0B8 /* Base64.cpp */; };
8134013915B092FD001FF0B8 /* Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8134013715B092FD001FF0B8 /* Base64.h */; };
83FBA93219DF459700F30ADB /* TypeCasts.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FBA93119DF459700F30ADB /* TypeCasts.h */; };
- 86F46F601A2840EE00CCBF22 /* RefCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86F46F5E1A2840EE00CCBF22 /* RefCounter.cpp */; };
86F46F611A2840EE00CCBF22 /* RefCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 86F46F5F1A2840EE00CCBF22 /* RefCounter.h */; };
93934BD318A1E8C300D0D6A1 /* StringViewObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93934BD218A1E8C300D0D6A1 /* StringViewObjC.mm */; };
93934BD518A1F16900D0D6A1 /* StringViewCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */; };
@@ -425,7 +424,6 @@
8134013615B092FD001FF0B8 /* Base64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Base64.cpp; sourceTree = "<group>"; };
8134013715B092FD001FF0B8 /* Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64.h; sourceTree = "<group>"; };
83FBA93119DF459700F30ADB /* TypeCasts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeCasts.h; sourceTree = "<group>"; };
- 86F46F5E1A2840EE00CCBF22 /* RefCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefCounter.cpp; sourceTree = "<group>"; };
86F46F5F1A2840EE00CCBF22 /* RefCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefCounter.h; sourceTree = "<group>"; };
93934BD218A1E8C300D0D6A1 /* StringViewObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = StringViewObjC.mm; path = mac/StringViewObjC.mm; sourceTree = "<group>"; };
93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringViewCF.cpp; path = cf/StringViewCF.cpp; sourceTree = "<group>"; };
@@ -889,7 +887,6 @@
A8A47300151A825B004123FF /* RefCountedArray.h */,
A8A47301151A825B004123FF /* RefCountedLeakCounter.cpp */,
A8A47302151A825B004123FF /* RefCountedLeakCounter.h */,
- 86F46F5E1A2840EE00CCBF22 /* RefCounter.cpp */,
86F46F5F1A2840EE00CCBF22 /* RefCounter.h */,
A8A47303151A825B004123FF /* RefPtr.h */,
A8A47305151A825B004123FF /* RetainPtr.h */,
@@ -1463,7 +1460,6 @@
143F611F1565F0F900DB514A /* RAMSize.cpp in Sources */,
A8A47414151A825B004123FF /* RandomNumber.cpp in Sources */,
A8A4741A151A825B004123FF /* RefCountedLeakCounter.cpp in Sources */,
- 86F46F601A2840EE00CCBF22 /* RefCounter.cpp in Sources */,
2CDED0F318115C85004DBA70 /* RunLoop.cpp in Sources */,
2CDED0EF18115C38004DBA70 /* RunLoopCF.cpp in Sources */,
1469419316EAAF6D0024E146 /* RunLoopTimerCF.cpp in Sources */,
Modified: trunk/Source/WTF/wtf/CMakeLists.txt (197131 => 197132)
--- trunk/Source/WTF/wtf/CMakeLists.txt 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Source/WTF/wtf/CMakeLists.txt 2016-02-25 22:24:32 UTC (rev 197132)
@@ -184,7 +184,6 @@
RAMSize.cpp
RandomNumber.cpp
RefCountedLeakCounter.cpp
- RefCounter.cpp
RunLoop.cpp
SHA1.cpp
SixCharacterHash.cpp
Deleted: trunk/Source/WTF/wtf/RefCounter.cpp (197131 => 197132)
--- trunk/Source/WTF/wtf/RefCounter.cpp 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Source/WTF/wtf/RefCounter.cpp 2016-02-25 22:24:32 UTC (rev 197132)
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2014 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. AND ITS CONTRIBUTORS ``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 ITS 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 "RefCounter.h"
-
-namespace WTF {
-
-void RefCounter::Count::ref()
-{
- bool valueWasZero = !m_value;
- ++m_value;
-
- if (valueWasZero && m_refCounter)
- m_refCounter->m_valueDidChange(true);
-}
-
-void RefCounter::Count::deref()
-{
- ASSERT(m_value);
- --m_value;
-
- if (m_value)
- return;
-
- // The Count object is kept alive so long as either the RefCounter that created it remains
- // allocated, or so long as its reference count is non-zero.
- // If the RefCounter has already been deallocted then delete the Count when its reference
- // count reaches zero.
- if (m_refCounter)
- m_refCounter->m_valueDidChange(false);
- else
- delete this;
-}
-
-RefCounter::RefCounter(std::function<void(bool)> valueDidChange)
- : m_valueDidChange(valueDidChange)
- , m_count(new Count(*this))
-{
-}
-
-RefCounter::~RefCounter()
-{
- // The Count object is kept alive so long as either the RefCounter that created it remains
- // allocated, or so long as its reference count is non-zero.
- // If the reference count of the Count is already zero then delete it now, otherwise
- // clear its m_refCounter pointer.
- if (m_count->m_value)
- m_count->m_refCounter = nullptr;
- else
- delete m_count;
-}
-
-} // namespace WebCore
Modified: trunk/Source/WTF/wtf/RefCounter.h (197131 => 197132)
--- trunk/Source/WTF/wtf/RefCounter.h 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Source/WTF/wtf/RefCounter.h 2016-02-25 22:24:32 UTC (rev 197132)
@@ -32,6 +32,7 @@
namespace WTF {
+template<typename T>
class RefCounter {
WTF_MAKE_NONCOPYABLE(RefCounter);
@@ -55,17 +56,16 @@
};
public:
- template<typename T>
class Token {
public:
Token() { }
Token(std::nullptr_t) { }
- inline Token(const Token<T>&);
- inline Token(Token<T>&&);
+ inline Token(const Token&);
+ inline Token(Token&&);
- inline Token<T>& operator=(std::nullptr_t);
- inline Token<T>& operator=(const Token<T>&);
- inline Token<T>& operator=(Token<T>&&);
+ inline Token& operator=(std::nullptr_t);
+ inline Token& operator=(const Token&);
+ inline Token& operator=(Token&&);
explicit operator bool() const { return m_ptr; }
@@ -79,10 +79,9 @@
WTF_EXPORT_PRIVATE RefCounter(std::function<void(bool)> = [](bool) { });
WTF_EXPORT_PRIVATE ~RefCounter();
- template<typename T>
- Token<T> token() const
+ Token count() const
{
- return Token<T>(m_count);
+ return Token(m_count);
}
unsigned value() const
@@ -95,40 +94,89 @@
Count* m_count;
};
+template<typename T>
+inline void RefCounter<T>::Count::ref()
+{
+ bool valueWasZero = !m_value;
+ ++m_value;
+
+ if (valueWasZero && m_refCounter)
+ m_refCounter->m_valueDidChange(true);
+}
+
+template<typename T>
+inline void RefCounter<T>::Count::deref()
+{
+ ASSERT(m_value);
+ --m_value;
+
+ if (m_value)
+ return;
+
+ // The Count object is kept alive so long as either the RefCounter that created it remains
+ // allocated, or so long as its reference count is non-zero.
+ // If the RefCounter has already been deallocted then delete the Count when its reference
+ // count reaches zero.
+ if (m_refCounter)
+ m_refCounter->m_valueDidChange(false);
+ else
+ delete this;
+}
+
+template<typename T>
+inline RefCounter<T>::RefCounter(std::function<void(bool)> valueDidChange)
+ : m_valueDidChange(valueDidChange)
+ , m_count(new Count(*this))
+{
+}
+
+template<typename T>
+inline RefCounter<T>::~RefCounter()
+{
+ // The Count object is kept alive so long as either the RefCounter that created it remains
+ // allocated, or so long as its reference count is non-zero.
+ // If the reference count of the Count is already zero then delete it now, otherwise
+ // clear its m_refCounter pointer.
+ if (m_count->m_value)
+ m_count->m_refCounter = nullptr;
+ else
+ delete m_count;
+}
+
template<class T>
-inline RefCounter::Token<T>::Token(Count* count)
+inline RefCounter<T>::Token::Token(Count* count)
: m_ptr(count)
{
}
template<class T>
-inline RefCounter::Token<T>::Token(const RefCounter::Token<T>& token)
+inline RefCounter<T>::Token::Token(const RefCounter::Token& token)
: m_ptr(token.m_ptr)
{
}
template<class T>
-inline RefCounter::Token<T>::Token(RefCounter::Token<T>&& token)
+inline RefCounter<T>::Token::Token(RefCounter::Token&& token)
: m_ptr(token.m_ptr)
{
}
template<class T>
-inline RefCounter::Token<T>& RefCounter::Token<T>::operator=(std::nullptr_t)
+inline typename RefCounter<T>::Token& RefCounter<T>::Token::operator=(std::nullptr_t)
{
m_ptr = nullptr;
return *this;
}
template<class T>
-inline RefCounter::Token<T>& RefCounter::Token<T>::operator=(const RefCounter::Token<T>& token)
+inline typename RefCounter<T>::Token& RefCounter<T>::Token::operator=(const RefCounter<T>::Token& token)
{
m_ptr = token.m_ptr;
return *this;
}
template<class T>
-inline RefCounter::Token<T>& RefCounter::Token<T>::operator=(RefCounter::Token<T>&& token)
+inline typename RefCounter<T>::Token& RefCounter<T>::Token::operator=(RefCounter<T>::Token&& token)
{
m_ptr = token.m_ptr;
return *this;
Modified: trunk/Source/WebCore/ChangeLog (197131 => 197132)
--- trunk/Source/WebCore/ChangeLog 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Source/WebCore/ChangeLog 2016-02-25 22:24:32 UTC (rev 197132)
@@ -1,3 +1,19 @@
+2016-02-25 Gavin Barraclough <barraclo...@apple.com>
+
+ Should template RefCounter instead of RefCounter::Token
+ https://bugs.webkit.org/show_bug.cgi?id=154691
+
+ Reviewed by Anders Carlsson.
+
+ Mechanical update per RefCounter interface change.
+
+ * page/PageThrottler.cpp:
+ (WebCore::PageThrottler::mediaActivityToken):
+ (WebCore::PageThrottler::pageLoadActivityToken):
+ (WebCore::PageThrottler::setActivityFlag):
+ * page/PageThrottler.h:
+ * platform/VNodeTracker.h:
+
2016-02-25 Brady Eidson <beid...@apple.com>
Remove LegacyIDB.
Modified: trunk/Source/WebCore/page/PageThrottler.cpp (197131 => 197132)
--- trunk/Source/WebCore/page/PageThrottler.cpp 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Source/WebCore/page/PageThrottler.cpp 2016-02-25 22:24:32 UTC (rev 197132)
@@ -41,12 +41,12 @@
PageActivityAssertionToken PageThrottler::mediaActivityToken()
{
- return m_mediaActivityCounter.token<PageActivityAssertionTokenType>();
+ return m_mediaActivityCounter.count();
}
PageActivityAssertionToken PageThrottler::pageLoadActivityToken()
{
- return m_pageLoadActivityCounter.token<PageActivityAssertionTokenType>();
+ return m_pageLoadActivityCounter.count();
}
void PageThrottler::setActivityFlag(PageActivityState::Flags flag, bool value)
Modified: trunk/Source/WebCore/page/PageThrottler.h (197131 => 197132)
--- trunk/Source/WebCore/page/PageThrottler.h 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Source/WebCore/page/PageThrottler.h 2016-02-25 22:24:32 UTC (rev 197132)
@@ -36,8 +36,9 @@
class Page;
-enum PageActivityAssertionTokenType { };
-typedef RefCounter::Token<PageActivityAssertionTokenType> PageActivityAssertionToken;
+enum PageActivityCounterType { };
+typedef RefCounter<PageActivityCounterType> PageActivityCounter;
+typedef PageActivityCounter::Token PageActivityAssertionToken;
struct PageActivityState {
enum {
@@ -71,8 +72,8 @@
PageActivityState::Flags m_activityState { PageActivityState::NoFlags };
HysteresisActivity m_userInputHysteresis;
HysteresisActivity m_audiblePluginHysteresis;
- RefCounter m_mediaActivityCounter;
- RefCounter m_pageLoadActivityCounter;
+ PageActivityCounter m_mediaActivityCounter;
+ PageActivityCounter m_pageLoadActivityCounter;
};
}
Modified: trunk/Source/WebCore/platform/VNodeTracker.h (197131 => 197132)
--- trunk/Source/WebCore/platform/VNodeTracker.h 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Source/WebCore/platform/VNodeTracker.h 2016-02-25 22:24:32 UTC (rev 197132)
@@ -39,8 +39,9 @@
public:
using PressureHandler = std::function<void(Critical)>;
- enum TokenType { };
- using Token = RefCounter::Token<TokenType>;
+ enum VNodeCounterType { };
+ using VNodeCounter = RefCounter<VNodeCounterType>;
+ using Token = VNodeCounter::Token;
WEBCORE_EXPORT static VNodeTracker& singleton();
@@ -59,7 +60,7 @@
unsigned m_hardVNodeLimit { 400 };
unsigned m_softVNodeLimit { 300 };
PressureHandler m_pressureHandler;
- RefCounter m_vnodeCounter;
+ VNodeCounter m_vnodeCounter;
Timer m_pressureWarningTimer;
std::chrono::steady_clock::time_point m_lastWarningTime;
};
@@ -74,7 +75,7 @@
if (!m_pressureHandler)
return Token();
- Token token(m_vnodeCounter.token<TokenType>());
+ Token token(m_vnodeCounter.count());
checkPressureState();
return token;
}
Modified: trunk/Source/WebKit2/ChangeLog (197131 => 197132)
--- trunk/Source/WebKit2/ChangeLog 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Source/WebKit2/ChangeLog 2016-02-25 22:24:32 UTC (rev 197132)
@@ -1,3 +1,20 @@
+2016-02-25 Gavin Barraclough <barraclo...@apple.com>
+
+ Should template RefCounter instead of RefCounter::Token
+ https://bugs.webkit.org/show_bug.cgi?id=154691
+
+ Reviewed by Anders Carlsson.
+
+ Mechanical update per RefCounter interface change.
+
+ * UIProcess/Plugins/PluginProcessManager.h:
+ (WebKit::PluginProcessManager::processSuppressionDisabledToken):
+ (WebKit::PluginProcessManager::processSuppressionDisabled):
+ * UIProcess/ProcessThrottler.h:
+ (WebKit::ProcessThrottler::foregroundActivityToken):
+ (WebKit::ProcessThrottler::backgroundActivityToken):
+ * UIProcess/WebProcessPool.h:
+
2016-02-25 Brady Eidson <beid...@apple.com>
Remove LegacyIDB.
Modified: trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h (197131 => 197132)
--- trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Source/WebKit2/UIProcess/Plugins/PluginProcessManager.h 2016-02-25 22:24:32 UTC (rev 197132)
@@ -82,14 +82,14 @@
Vector<RefPtr<PluginProcessProxy>> m_pluginProcesses;
#if PLATFORM(COCOA)
- RefCounter m_processSuppressionDisabledForPageCounter;
+ ProcessSuppressionDisabledCounter m_processSuppressionDisabledForPageCounter;
#endif
};
#if PLATFORM(COCOA)
inline ProcessSuppressionDisabledToken PluginProcessManager::processSuppressionDisabledToken()
{
- return m_processSuppressionDisabledForPageCounter.token<ProcessSuppressionDisabledTokenType>();
+ return m_processSuppressionDisabledForPageCounter.count();
}
inline bool PluginProcessManager::processSuppressionDisabled() const
Modified: trunk/Source/WebKit2/UIProcess/ProcessThrottler.h (197131 => 197132)
--- trunk/Source/WebKit2/UIProcess/ProcessThrottler.h 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Source/WebKit2/UIProcess/ProcessThrottler.h 2016-02-25 22:24:32 UTC (rev 197132)
@@ -34,19 +34,23 @@
namespace WebKit {
-enum UserObservablePageTokenType { };
-typedef RefCounter::Token<UserObservablePageTokenType> UserObservablePageToken;
-enum ProcessSuppressionDisabledTokenType { };
-typedef RefCounter::Token<ProcessSuppressionDisabledTokenType> ProcessSuppressionDisabledToken;
+enum UserObservablePageCounterType { };
+typedef RefCounter<UserObservablePageCounterType> UserObservablePageCounter;
+typedef UserObservablePageCounter::Token UserObservablePageToken;
+enum ProcessSuppressionDisabledCounterType { };
+typedef RefCounter<ProcessSuppressionDisabledCounterType> ProcessSuppressionDisabledCounter;
+typedef ProcessSuppressionDisabledCounter::Token ProcessSuppressionDisabledToken;
class ProcessThrottlerClient;
class ProcessThrottler : private ProcessAssertionClient {
public:
- enum ForegroundActivityTokenType { };
- typedef RefCounter::Token<ForegroundActivityTokenType> ForegroundActivityToken;
- enum BackgroundActivityTokenType { };
- typedef RefCounter::Token<BackgroundActivityTokenType> BackgroundActivityToken;
+ enum ForegroundActivityCounterType { };
+ typedef RefCounter<ForegroundActivityCounterType> ForegroundActivityCounter;
+ typedef ForegroundActivityCounter::Token ForegroundActivityToken;
+ enum BackgroundActivityCounterType { };
+ typedef RefCounter<BackgroundActivityCounterType> BackgroundActivityCounter;
+ typedef BackgroundActivityCounter::Token BackgroundActivityToken;
ProcessThrottler(ProcessThrottlerClient&);
@@ -69,19 +73,19 @@
ProcessThrottlerClient& m_process;
std::unique_ptr<ProcessAndUIAssertion> m_assertion;
RunLoop::Timer<ProcessThrottler> m_suspendTimer;
- RefCounter m_foregroundCounter;
- RefCounter m_backgroundCounter;
+ ForegroundActivityCounter m_foregroundCounter;
+ BackgroundActivityCounter m_backgroundCounter;
int m_suspendMessageCount;
};
inline ProcessThrottler::ForegroundActivityToken ProcessThrottler::foregroundActivityToken() const
{
- return ForegroundActivityToken(m_foregroundCounter.token<ForegroundActivityTokenType>());
+ return ForegroundActivityToken(m_foregroundCounter.count());
}
inline ProcessThrottler::BackgroundActivityToken ProcessThrottler::backgroundActivityToken() const
{
- return BackgroundActivityToken(m_backgroundCounter.token<BackgroundActivityTokenType>());
+ return BackgroundActivityToken(m_backgroundCounter.count());
}
}
Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (197131 => 197132)
--- trunk/Source/WebKit2/UIProcess/WebProcessPool.h 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.h 2016-02-25 22:24:32 UTC (rev 197132)
@@ -338,12 +338,12 @@
UserObservablePageToken userObservablePageCount()
{
- return m_userObservablePageCounter.token<UserObservablePageTokenType>();
+ return m_userObservablePageCounter.count();
}
ProcessSuppressionDisabledToken processSuppressionDisabledForPageCount()
{
- return m_processSuppressionDisabledForPageCounter.token<ProcessSuppressionDisabledTokenType>();
+ return m_processSuppressionDisabledForPageCounter.count();
}
// FIXME: Move these to API::WebsiteDataStore.
@@ -507,8 +507,8 @@
bool m_memoryCacheDisabled;
- RefCounter m_userObservablePageCounter;
- RefCounter m_processSuppressionDisabledForPageCounter;
+ UserObservablePageCounter m_userObservablePageCounter;
+ ProcessSuppressionDisabledCounter m_processSuppressionDisabledForPageCounter;
#if PLATFORM(COCOA)
RetainPtr<NSMutableDictionary> m_bundleParameters;
Modified: trunk/Tools/ChangeLog (197131 => 197132)
--- trunk/Tools/ChangeLog 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Tools/ChangeLog 2016-02-25 22:24:32 UTC (rev 197132)
@@ -1,3 +1,15 @@
+2016-02-25 Gavin Barraclough <barraclo...@apple.com>
+
+ Should template RefCounter instead of RefCounter::Token
+ https://bugs.webkit.org/show_bug.cgi?id=154691
+
+ Reviewed by Anders Carlsson.
+
+ Mechanical update per RefCounter interface change.
+
+ * TestWebKitAPI/Tests/WTF/RefCounter.cpp:
+ (TestWebKitAPI::TEST):
+
2016-02-25 Skachkov Aleksandr <gskach...@gmail.com>
Unreviewed: Add Aleksandr Skachkov as a commiter
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/RefCounter.cpp (197131 => 197132)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/RefCounter.cpp 2016-02-25 22:19:06 UTC (rev 197131)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/RefCounter.cpp 2016-02-25 22:24:32 UTC (rev 197132)
@@ -34,8 +34,9 @@
static const int CallbackExpected = 0xC0FFEE;
static const int CallbackNotExpected = 0xDECAF;
-enum CounterType { };
-typedef RefCounter::Token<CounterType> TokenType;
+enum TestCounterType { };
+typedef RefCounter<TestCounterType> TestCounter;
+typedef TestCounter::Token TokenType;
TEST(WTF, RefCounter)
{
@@ -77,8 +78,8 @@
{
// Testing (1a) - Construction with a callback.
- RefCounter* counterPtr = nullptr;
- RefCounter counter([&](bool value) {
+ TestCounter* counterPtr = nullptr;
+ TestCounter counter([&](bool value) {
// Check that the callback is called at the expected times, and the correct number of times.
EXPECT_EQ(callbackValue, CallbackExpected);
// Value provided should be equal to the counter value.
@@ -92,7 +93,7 @@
// Testing (3a) - ref with callback from 0 -> 1.
callbackValue = CallbackExpected;
- TokenType incTo1(counter.token<CounterType>());
+ TokenType incTo1(counter.count());
// Testing (4b) & (4c) - values within & after callback.
EXPECT_EQ(true, callbackValue);
EXPECT_EQ(1, static_cast<int>(counter.value()));
@@ -109,7 +110,7 @@
{
// Testing (3j) - ref using a Ref rather than a RefPtr.
- TokenType incTo2Again(counter.token<CounterType>());
+ TokenType incTo2Again(counter.count());
// Testing (4b) & (4c) - values within & after callback.
EXPECT_EQ(2, static_cast<int>(counter.value()));
// Testing (3k) - deref using a Ref rather than a RefPtr.
@@ -124,9 +125,9 @@
EXPECT_EQ(0, callbackValue);
EXPECT_EQ(0, static_cast<int>(counter.value()));
- // Testing (2a) - Destruction where the RefCounter::Count has a non-zero reference count.
+ // Testing (2a) - Destruction where the TestCounter::Count has a non-zero reference count.
callbackValue = CallbackExpected;
- incTo1Again = counter.token<CounterType>();
+ incTo1Again = counter.count();
EXPECT_EQ(1, callbackValue);
EXPECT_EQ(1, static_cast<int>(counter.value()));
callbackValue = CallbackNotExpected;
@@ -140,11 +141,11 @@
incTo2Again = nullptr;
// Testing (1b) - Construction without a callback.
- RefCounter counter;
+ TestCounter counter;
// Testing (4a) - after construction value() is 0.
EXPECT_EQ(0, static_cast<int>(counter.value()));
// Testing (3h) - ref without callback
- TokenType incTo1(counter.token<CounterType>());
+ TokenType incTo1(counter.count());
// Testing (4c) - value as read after the ref.
EXPECT_EQ(1, static_cast<int>(counter.value()));
// Testing (3i) - deref without callback