| Index: Source/core/platform/PurgeableBuffer.h
|
| diff --git a/Source/core/platform/PurgeableBuffer.h b/Source/core/platform/PurgeableBuffer.h
|
| index 517c1b213bd3ef04655689de2a11b3dd8bcbba59..3ad0992e229b2623f6abee13794187735b90425e 100644
|
| --- a/Source/core/platform/PurgeableBuffer.h
|
| +++ b/Source/core/platform/PurgeableBuffer.h
|
| @@ -1,5 +1,6 @@
|
| /*
|
| * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved.
|
| + * Copyright (C) 2013 Google Inc. All Rights Reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions
|
| @@ -26,50 +27,45 @@
|
| #ifndef PurgeableBuffer_h
|
| #define PurgeableBuffer_h
|
|
|
| -#include "core/platform/PurgePriority.h"
|
| -#include <wtf/PassOwnPtr.h>
|
| -#include <wtf/Vector.h>
|
| +#include "wtf/OwnPtr.h"
|
| +#include "wtf/PassOwnPtr.h"
|
| +
|
| +namespace WebKit {
|
| +class WebDiscardableMemory;
|
| +}
|
|
|
| namespace WebCore {
|
|
|
| - class PurgeableBuffer {
|
| - WTF_MAKE_NONCOPYABLE(PurgeableBuffer);
|
| - public:
|
| - static PassOwnPtr<PurgeableBuffer> create(const char* data, size_t);
|
| -
|
| - ~PurgeableBuffer();
|
| +class PurgeableBuffer {
|
| + WTF_MAKE_NONCOPYABLE(PurgeableBuffer);
|
| +public:
|
| + static PassOwnPtr<PurgeableBuffer> create(const char* data, size_t);
|
| + ~PurgeableBuffer();
|
|
|
| - // Call makePurgeable(false) and check the return value before accessing the data.
|
| - const char* data() const;
|
| - size_t size() const { return m_size; }
|
| -
|
| - PurgePriority purgePriority() const { return m_purgePriority; }
|
| - void setPurgePriority(PurgePriority priority) { m_purgePriority = priority; }
|
| -
|
| - bool isPurgeable() const { return m_state != NonVolatile; }
|
| - bool wasPurged() const;
|
| + // Call lock and check the return value before accessing the data.
|
| + const char* data() const;
|
| + size_t size() const { return m_size; }
|
|
|
| - bool makePurgeable(bool purgeable);
|
| + bool isPurgeable() const { return m_state != Locked; }
|
| + bool wasPurged() const;
|
|
|
| - private:
|
| - PurgeableBuffer(char* data, size_t);
|
| -
|
| - char* m_data;
|
| - size_t m_size;
|
| - PurgePriority m_purgePriority;
|
| + bool lock();
|
| + void unlock();
|
|
|
| - enum State { NonVolatile, Volatile, Purged };
|
| - mutable State m_state;
|
| +private:
|
| + enum State {
|
| + Locked,
|
| + Unlocked,
|
| + Purged
|
| };
|
|
|
| -#if !ENABLE(PURGEABLE_MEMORY)
|
| - inline PassOwnPtr<PurgeableBuffer> PurgeableBuffer::create(const char*, size_t) { return nullptr; }
|
| - inline PurgeableBuffer::~PurgeableBuffer() { }
|
| - inline const char* PurgeableBuffer::data() const { return 0; }
|
| - inline bool PurgeableBuffer::wasPurged() const { return false; }
|
| - inline bool PurgeableBuffer::makePurgeable(bool) { return false; }
|
| -#endif
|
| -
|
| + PurgeableBuffer(PassOwnPtr<WebKit::WebDiscardableMemory>, const char* data, size_t);
|
| +
|
| + OwnPtr<WebKit::WebDiscardableMemory> m_memory;
|
| + size_t m_size;
|
| + State m_state;
|
| +};
|
| +
|
| }
|
|
|
| #endif
|
|
|