Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Unified Diff: Source/core/css/RuntimeCSSEnabled.cpp

Issue 290793004: Use a BitArray in RuntimeCSSEnabled instead of a Vector<bool> (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/wtf/BitVector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/RuntimeCSSEnabled.cpp
diff --git a/Source/core/css/RuntimeCSSEnabled.cpp b/Source/core/css/RuntimeCSSEnabled.cpp
index 4fc13b0f4b207a90177a6ee6771fdb4c31f8f832..2daccd217aeaedcd3753e514897da62a819d8e20 100644
--- a/Source/core/css/RuntimeCSSEnabled.cpp
+++ b/Source/core/css/RuntimeCSSEnabled.cpp
@@ -31,12 +31,10 @@
#include "core/css/RuntimeCSSEnabled.h"
#include "RuntimeEnabledFeatures.h"
+#include "wtf/BitVector.h"
namespace WebCore {
-// FIXME: We should use a real BitVector class instead!
-typedef Vector<bool> BoolVector;
-
static void setCSSPropertiesEnabled(CSSPropertyID* properties, size_t length, bool featureFlag)
{
for (size_t i = 0; i < length; i++)
@@ -130,12 +128,12 @@ static void setPropertySwitchesFromRuntimeFeatures()
RuntimeCSSEnabled::setCSSPropertyEnabled(CSSPropertyInternalCallback, false);
}
-static BoolVector& propertySwitches()
+static BitVector& propertySwitches()
{
- static BoolVector* switches = 0;
+ static BitVector* switches = 0;
dstockwell 2014/05/21 00:45:41 A BitArray might be more appropriate.
Inactive 2014/05/21 01:04:49 Ah, I didn't know we had one. This is more suitabl
if (!switches) {
- switches = new BoolVector;
- switches->fill(true, numCSSProperties);
+ switches = new BitVector(numCSSProperties);
+ switches->setAll();
setPropertySwitchesFromRuntimeFeatures();
}
return *switches;
@@ -155,12 +153,12 @@ bool RuntimeCSSEnabled::isCSSPropertyEnabled(CSSPropertyID propertyId)
if (isInternalProperty(propertyId))
return false;
- return propertySwitches()[indexForProperty(propertyId)];
+ return propertySwitches().quickGet(indexForProperty(propertyId));
}
void RuntimeCSSEnabled::setCSSPropertyEnabled(CSSPropertyID propertyId, bool enable)
{
- propertySwitches()[indexForProperty(propertyId)] = enable;
+ propertySwitches().quickSet(indexForProperty(propertyId), enable);
}
void RuntimeCSSEnabled::filterEnabledCSSPropertiesIntoVector(const CSSPropertyID* properties, size_t propertyCount, Vector<CSSPropertyID>& outVector)
« no previous file with comments | « no previous file | Source/wtf/BitVector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698