Add ICU message format support
[chromium-blink-merge.git] / content / browser / renderer_host / delegated_frame_evictor.cc
blob65ae48329323b638eac52fc7723e5beeced2c948
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"
9 namespace content {
11 DelegatedFrameEvictor::DelegatedFrameEvictor(
12 DelegatedFrameEvictorClient* client)
13 : client_(client), has_frame_(false), visible_(false) {
16 DelegatedFrameEvictor::~DelegatedFrameEvictor() { DiscardedFrame(); }
18 void DelegatedFrameEvictor::SwappedFrame(bool visible) {
19 visible_ = visible;
20 has_frame_ = true;
21 RendererFrameManager::GetInstance()->AddFrame(this, visible);
24 void DelegatedFrameEvictor::DiscardedFrame() {
25 RendererFrameManager::GetInstance()->RemoveFrame(this);
26 has_frame_ = false;
29 void DelegatedFrameEvictor::SetVisible(bool visible) {
30 if (visible_ == visible)
31 return;
32 visible_ = visible;
33 if (has_frame_) {
34 if (visible) {
35 LockFrame();
36 } else {
37 UnlockFrame();
42 void DelegatedFrameEvictor::LockFrame() {
43 DCHECK(has_frame_);
44 RendererFrameManager::GetInstance()->LockFrame(this);
47 void DelegatedFrameEvictor::UnlockFrame() {
48 DCHECK(has_frame_);
49 RendererFrameManager::GetInstance()->UnlockFrame(this);
52 void DelegatedFrameEvictor::EvictCurrentFrame() {
53 client_->EvictDelegatedFrame();
56 } // namespace content