Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: content/browser/renderer_host/delegated_frame_evictor.cc

Issue 1001573003: [Android] Stop hiding the RWHV layer subtree when hiding the widget (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/delegated_frame_evictor.h" 5 #include "content/browser/renderer_host/delegated_frame_evictor.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace content { 9 namespace content {
10 10
11 DelegatedFrameEvictor::DelegatedFrameEvictor( 11 DelegatedFrameEvictor::DelegatedFrameEvictor(
12 DelegatedFrameEvictorClient* client) 12 DelegatedFrameEvictorClient* client)
13 : client_(client), has_frame_(false) {} 13 : client_(client), has_frame_(false), visible_(false) {}
14 14
15 DelegatedFrameEvictor::~DelegatedFrameEvictor() { DiscardedFrame(); } 15 DelegatedFrameEvictor::~DelegatedFrameEvictor() { DiscardedFrame(); }
16 16
17 void DelegatedFrameEvictor::SwappedFrame(bool visible) { 17 void DelegatedFrameEvictor::SwappedFrame(bool visible) {
18 has_frame_ = true; 18 has_frame_ = true;
no sievers 2015/03/20 21:48:24 Should this DCHECK_EQ(visible, visible_)?
jdduke (slow) 2015/03/20 22:48:18 Good catch, I think so, yes. Done.
19 RendererFrameManager::GetInstance()->AddFrame(this, visible); 19 RendererFrameManager::GetInstance()->AddFrame(this, visible);
20 } 20 }
21 21
22 void DelegatedFrameEvictor::DiscardedFrame() { 22 void DelegatedFrameEvictor::DiscardedFrame() {
23 RendererFrameManager::GetInstance()->RemoveFrame(this); 23 RendererFrameManager::GetInstance()->RemoveFrame(this);
24 has_frame_ = false; 24 has_frame_ = false;
25 } 25 }
26 26
27 void DelegatedFrameEvictor::SetVisible(bool visible) { 27 void DelegatedFrameEvictor::SetVisible(bool visible) {
28 if (visible_ == visible)
29 return;
30 visible_ = visible;
28 if (has_frame_) { 31 if (has_frame_) {
29 if (visible) { 32 if (visible) {
30 RendererFrameManager::GetInstance()->LockFrame(this); 33 LockFrame();
31 } else { 34 } else {
32 RendererFrameManager::GetInstance()->UnlockFrame(this); 35 UnlockFrame();
33 } 36 }
34 } 37 }
35 } 38 }
36 39
37 void DelegatedFrameEvictor::LockFrame() { 40 void DelegatedFrameEvictor::LockFrame() {
38 DCHECK(has_frame_); 41 DCHECK(has_frame_);
39 RendererFrameManager::GetInstance()->LockFrame(this); 42 RendererFrameManager::GetInstance()->LockFrame(this);
40 } 43 }
41 44
42 void DelegatedFrameEvictor::UnlockFrame() { 45 void DelegatedFrameEvictor::UnlockFrame() {
43 DCHECK(has_frame_); 46 DCHECK(has_frame_);
44 RendererFrameManager::GetInstance()->UnlockFrame(this); 47 RendererFrameManager::GetInstance()->UnlockFrame(this);
45 } 48 }
46 49
47 void DelegatedFrameEvictor::EvictCurrentFrame() { 50 void DelegatedFrameEvictor::EvictCurrentFrame() {
48 client_->EvictDelegatedFrame(); 51 client_->EvictDelegatedFrame();
49 } 52 }
50 53
51 } // namespace content 54 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698