ResourceUsageOverlay.h [plain text]
#pragma once
#if ENABLE(RESOURCE_USAGE)
#include "FloatRect.h"
#include "IntRect.h"
#include "MainFrame.h"
#include "PageOverlay.h"
#include <wtf/Noncopyable.h>
#include <wtf/RetainPtr.h>
#if PLATFORM(COCOA)
#include "PlatformCALayer.h"
#endif
namespace WebCore {
class FloatRect;
class IntPoint;
class IntRect;
class ResourceUsageOverlay final : public PageOverlay::Client {
WTF_MAKE_FAST_ALLOCATED;
WTF_MAKE_NONCOPYABLE(ResourceUsageOverlay);
public:
explicit ResourceUsageOverlay(Page&);
~ResourceUsageOverlay();
PageOverlay& overlay() { return *m_overlay; }
#if PLATFORM(COCOA)
void platformDraw(CGContextRef);
#endif
static const int normalWidth = 570;
static const int normalHeight = 160;
private:
void willMoveToPage(PageOverlay&, Page*) override { }
void didMoveToPage(PageOverlay&, Page*) override { }
void drawRect(PageOverlay&, GraphicsContext&, const IntRect&) override { }
bool mouseEvent(PageOverlay&, const PlatformMouseEvent&) override;
void didScrollFrame(PageOverlay&, Frame&) override { }
void initialize();
void platformInitialize();
void platformDestroy();
Page& m_page;
RefPtr<PageOverlay> m_overlay;
bool m_dragging { false };
IntPoint m_dragPoint;
#if PLATFORM(COCOA)
ThreadIdentifier m_threadID { 0 };
RetainPtr<CALayer> m_layer;
RetainPtr<CALayer> m_containerLayer;
#endif
};
}
#endif // ENABLE(RESOURCE_USAGE)