DFABytecodeInterpreter.h [plain text]
#ifndef DFABytecodeInterpreter_h
#define DFABytecodeInterpreter_h
#if ENABLE(CONTENT_EXTENSIONS)
#include "ContentExtensionRule.h"
#include "ContentExtensionsDebugging.h"
#include "DFABytecode.h"
#include <wtf/DataLog.h>
#include <wtf/HashSet.h>
#include <wtf/Vector.h>
namespace WebCore {
namespace ContentExtensions {
class WEBCORE_EXPORT DFABytecodeInterpreter {
public:
DFABytecodeInterpreter(const DFABytecode* bytecode, unsigned bytecodeLength)
: m_bytecode(bytecode)
, m_bytecodeLength(bytecodeLength)
{
}
typedef HashSet<uint64_t, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> Actions;
Actions interpret(const CString&, uint16_t flags);
Actions interpretWithDomains(const CString&, uint16_t flags, const DFABytecodeInterpreter::Actions& domainActions);
Actions actionsMatchingEverything();
private:
void interpretAppendAction(unsigned& programCounter, Actions&, bool ifDomain);
void interpretTestFlagsAndAppendAction(unsigned& programCounter, uint16_t flags, Actions&, bool ifDomain);
template<bool caseSensitive>
void interpetJumpTable(const char* url, uint32_t& urlIndex, uint32_t& programCounter, bool& urlIndexIsAfterEndOfString);
const DFABytecode* m_bytecode;
const unsigned m_bytecodeLength;
const DFABytecodeInterpreter::Actions* m_domainActions { nullptr };
};
}
}
#endif // ENABLE(CONTENT_EXTENSIONS)
#endif // DFABytecodeInterpreter_h