Home | History | Annotate | Download | only in renderer_host
      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.
      4 
      5 #include "content/browser/renderer_host/delegated_frame_evictor.h"
      6 
      7 namespace content {
      8 
      9 DelegatedFrameEvictor::DelegatedFrameEvictor(
     10     DelegatedFrameEvictorClient* client)
     11     : client_(client), has_frame_(false) {}
     12 
     13 DelegatedFrameEvictor::~DelegatedFrameEvictor() { DiscardedFrame(); }
     14 
     15 void DelegatedFrameEvictor::SwappedFrame(bool visible) {
     16   has_frame_ = true;
     17   RendererFrameManager::GetInstance()->AddFrame(this, visible);
     18 }
     19 
     20 void DelegatedFrameEvictor::DiscardedFrame() {
     21   RendererFrameManager::GetInstance()->RemoveFrame(this);
     22   has_frame_ = false;
     23 }
     24 
     25 void DelegatedFrameEvictor::SetVisible(bool visible) {
     26   if (has_frame_)
     27     RendererFrameManager::GetInstance()->SetFrameVisibility(this, visible);
     28 }
     29 
     30 void DelegatedFrameEvictor::EvictCurrentFrame() {
     31   client_->EvictDelegatedFrame();
     32 }
     33 
     34 }  // namespace content
     35