This source file includes following definitions.
- has_frame_
- SwappedFrame
- DiscardedFrame
- SetVisible
- LockFrame
- UnlockFrame
- EvictCurrentFrame
#include "content/browser/renderer_host/delegated_frame_evictor.h"
#include "base/logging.h"
namespace content {
DelegatedFrameEvictor::DelegatedFrameEvictor(
DelegatedFrameEvictorClient* client)
: client_(client), has_frame_(false) {}
DelegatedFrameEvictor::~DelegatedFrameEvictor() { DiscardedFrame(); }
void DelegatedFrameEvictor::SwappedFrame(bool visible) {
has_frame_ = true;
RendererFrameManager::GetInstance()->AddFrame(this, visible);
}
void DelegatedFrameEvictor::DiscardedFrame() {
RendererFrameManager::GetInstance()->RemoveFrame(this);
has_frame_ = false;
}
void DelegatedFrameEvictor::SetVisible(bool visible) {
if (has_frame_) {
if (visible) {
RendererFrameManager::GetInstance()->LockFrame(this);
} else {
RendererFrameManager::GetInstance()->UnlockFrame(this);
}
}
}
void DelegatedFrameEvictor::LockFrame() {
DCHECK(has_frame_);
RendererFrameManager::GetInstance()->LockFrame(this);
}
void DelegatedFrameEvictor::UnlockFrame() {
DCHECK(has_frame_);
RendererFrameManager::GetInstance()->UnlockFrame(this);
}
void DelegatedFrameEvictor::EvictCurrentFrame() {
client_->EvictDelegatedFrame();
}
}