This source file includes following definitions.
- m_isLocked
- lock
- data
- unlock
- m_oldPlatform
- allocateAndLockDiscardableMemory
- cryptographicallyRandomValues
- getTraceCategoryEnabledFlag
#include "config.h"
#include "platform/TestingPlatformSupport.h"
namespace WebCore {
TestingDiscardableMemory::TestingDiscardableMemory(size_t size) : m_data(size), m_isLocked(true)
{
}
TestingDiscardableMemory::~TestingDiscardableMemory()
{
}
bool TestingDiscardableMemory::lock()
{
ASSERT(!m_isLocked);
m_isLocked = true;
return false;
}
void* TestingDiscardableMemory::data()
{
ASSERT(m_isLocked);
return m_data.data();
}
void TestingDiscardableMemory::unlock()
{
ASSERT(m_isLocked);
m_isLocked = false;
memset(m_data.data(), 0, m_data.size());
}
TestingPlatformSupport::TestingPlatformSupport(const Config& config)
: m_config(config)
, m_oldPlatform(blink::Platform::current())
{
blink::Platform::initialize(this);
}
TestingPlatformSupport::~TestingPlatformSupport()
{
blink::Platform::initialize(m_oldPlatform);
}
blink::WebDiscardableMemory* TestingPlatformSupport::allocateAndLockDiscardableMemory(size_t bytes)
{
return !m_config.hasDiscardableMemorySupport ? 0 : new TestingDiscardableMemory(bytes);
}
void TestingPlatformSupport::cryptographicallyRandomValues(unsigned char* buffer, size_t length)
{
}
const unsigned char* TestingPlatformSupport::getTraceCategoryEnabledFlag(const char* categoryName)
{
static const unsigned char tracingIsDisabled = 0;
return &tracingIsDisabled;
}
}