1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/browser/renderer_host/delegated_frame_evictor.h"
7 #include "base/logging.h"
11 DelegatedFrameEvictor::DelegatedFrameEvictor(
12 DelegatedFrameEvictorClient
* client
)
13 : client_(client
), has_frame_(false) {}
15 DelegatedFrameEvictor::~DelegatedFrameEvictor() { DiscardedFrame(); }
17 void DelegatedFrameEvictor::SwappedFrame(bool visible
) {
19 RendererFrameManager::GetInstance()->AddFrame(this, visible
);
22 void DelegatedFrameEvictor::DiscardedFrame() {
23 RendererFrameManager::GetInstance()->RemoveFrame(this);
27 void DelegatedFrameEvictor::SetVisible(bool visible
) {
30 RendererFrameManager::GetInstance()->LockFrame(this);
32 RendererFrameManager::GetInstance()->UnlockFrame(this);
37 void DelegatedFrameEvictor::LockFrame() {
39 RendererFrameManager::GetInstance()->LockFrame(this);
42 void DelegatedFrameEvictor::UnlockFrame() {
44 RendererFrameManager::GetInstance()->UnlockFrame(this);
47 void DelegatedFrameEvictor::EvictCurrentFrame() {
48 client_
->EvictDelegatedFrame();
51 } // namespace content