#ifndef FeatureObserver_h
#define FeatureObserver_h
#include <wtf/BitVector.h>
#include <wtf/Noncopyable.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
namespace WebCore {
class DOMWindow;
class Document;
class FeatureObserver {
WTF_MAKE_NONCOPYABLE(FeatureObserver);
public:
FeatureObserver();
~FeatureObserver();
enum Feature {
PageDestruction,
LegacyNotifications,
MultipartMainResource,
PrefixedIndexedDB,
WorkerStart,
SharedWorkerStart,
LegacyWebAudio,
WebAudioStart,
PrefixedContentSecurityPolicy,
UnprefixedIndexedDB,
OpenWebDatabase,
UnusedSlot01, LegacyTextNotifications,
UnprefixedRequestAnimationFrame,
PrefixedRequestAnimationFrame,
ContentSecurityPolicy,
ContentSecurityPolicyReportOnly,
PrefixedContentSecurityPolicyReportOnly,
PrefixedTransitionEndEvent,
UnprefixedTransitionEndEvent,
PrefixedAndUnprefixedTransitionEndEvent,
AutoFocusAttribute,
AutoSaveAttribute,
DataListElement,
FormAttribute,
IncrementalAttribute,
InputTypeColor,
InputTypeDate,
InputTypeDateTime,
InputTypeDateTimeFallback,
InputTypeDateTimeLocal,
InputTypeEmail,
InputTypeMonth,
InputTypeNumber,
InputTypeRange,
InputTypeSearch,
InputTypeTel,
InputTypeTime,
InputTypeURL,
InputTypeWeek,
InputTypeWeekFallback,
ListAttribute,
MaxAttribute,
MinAttribute,
PatternAttribute,
PlaceholderAttribute,
PrecisionAttribute,
PrefixedDirectoryAttribute,
PrefixedSpeechAttribute,
RequiredAttribute,
ResultsAttribute,
StepAttribute,
PageVisits,
HTMLMarqueeElement,
CSSOverflowMarquee,
Reflection,
CursorVisibility,
StorageInfo,
XFrameOptions,
XFrameOptionsSameOrigin,
XFrameOptionsSameOriginWithBadAncestorChain,
DeprecatedFlexboxWebContent,
DeprecatedFlexboxChrome,
DeprecatedFlexboxChromeExtension,
NumberOfFeatures, };
static void observe(Document*, Feature);
static void observe(DOMWindow*, Feature);
void didCommitLoad();
const BitVector* accumulatedFeatureBits() const { return m_featureBits.get(); }
private:
void didObserve(Feature feature)
{
ASSERT(feature != PageDestruction); ASSERT(feature < NumberOfFeatures);
if (!m_featureBits) {
m_featureBits = adoptPtr(new BitVector(NumberOfFeatures));
m_featureBits->clearAll();
}
m_featureBits->quickSet(feature);
}
void updateMeasurements();
OwnPtr<BitVector> m_featureBits;
};
}
#endif // FeatureObserver_h