diff options
author | mmocny@chromium.org <mmocny@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-11 01:13:55 +0000 |
---|---|---|
committer | mmocny@chromium.org <mmocny@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-11 01:13:55 +0000 |
commit | 74b407d576a540dacfc1bc5564713ac8105eb2cf (patch) | |
tree | 6fbfc9417d99316e8d802b1c52896e65db2749b8 /content | |
parent | 9f14afa5c6cf0a1ecb390e82cf7154a036995146 (diff) | |
download | chromium_src-74b407d576a540dacfc1bc5564713ac8105eb2cf.zip chromium_src-74b407d576a540dacfc1bc5564713ac8105eb2cf.tar.gz chromium_src-74b407d576a540dacfc1bc5564713ac8105eb2cf.tar.bz2 |
Drop frontbuffers for hibernated tabs using image_transport_surface_win.
BUG=112842
TEST=Manual
Review URL: http://codereview.chromium.org/9317056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121598 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.cc | 22 | ||||
-rw-r--r-- | content/common/gpu/gpu_command_buffer_stub.h | 9 | ||||
-rw-r--r-- | content/common/gpu/gpu_memory_allocation.h | 20 | ||||
-rw-r--r-- | content/common/gpu/gpu_memory_manager.cc | 8 | ||||
-rw-r--r-- | content/common/gpu/gpu_memory_manager_unittest.cc | 78 | ||||
-rw-r--r-- | content/common/gpu/image_transport_surface_linux.cc | 76 | ||||
-rw-r--r-- | content/common/gpu/image_transport_surface_win.cc | 37 |
7 files changed, 169 insertions, 81 deletions
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index f8692f2..554f690 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -14,7 +14,6 @@ #include "content/common/gpu/gpu_channel.h" #include "content/common/gpu/gpu_channel_manager.h" #include "content/common/gpu/gpu_command_buffer_stub.h" -#include "content/common/gpu/gpu_memory_allocation.h" #include "content/common/gpu/gpu_memory_manager.h" #include "content/common/gpu/gpu_messages.h" #include "content/common/gpu/gpu_watchdog.h" @@ -512,7 +511,8 @@ void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) { } void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { - surface_->SetVisible(visible); + if (visible) + surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_FOREGROUND); DCHECK(surface_state_.get()); surface_state_->visible = visible; surface_state_->last_used_time = base::TimeTicks::Now(); @@ -546,4 +546,22 @@ void GpuCommandBufferStub::SendMemoryAllocationToProxy( // TODO(mmocny): Send callback once gl extensions are added. } +void GpuCommandBufferStub::SetMemoryAllocation( + const GpuMemoryAllocation& allocation) { + if (allocation == allocation_) + return; + allocation_ = allocation; + + SendMemoryAllocationToProxy(allocation); + + if (!surface_) + return; + if (allocation.has_frontbuffer && allocation.has_backbuffer) + surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_FOREGROUND); + else if (allocation.has_frontbuffer) + surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_BACKGROUND); + else + surface_->SetVisibility(gfx::GLSurface::VISIBILITY_STATE_HIBERNATED); +} + #endif // defined(ENABLE_GPU) diff --git a/content/common/gpu/gpu_command_buffer_stub.h b/content/common/gpu/gpu_command_buffer_stub.h index 61cd479..66c3431 100644 --- a/content/common/gpu/gpu_command_buffer_stub.h +++ b/content/common/gpu/gpu_command_buffer_stub.h @@ -15,6 +15,7 @@ #include "base/memory/weak_ptr.h" #include "content/common/content_export.h" #include "content/common/gpu/media/gpu_video_decode_accelerator.h" +#include "content/common/gpu/gpu_memory_allocation.h" #include "gpu/command_buffer/common/constants.h" #include "gpu/command_buffer/service/command_buffer_service.h" #include "gpu/command_buffer/service/context_group.h" @@ -59,6 +60,9 @@ class CONTENT_EXPORT GpuCommandBufferStubBase { virtual void SendMemoryAllocationToProxy( const GpuMemoryAllocation& allocation) = 0; + + virtual void SetMemoryAllocation( + const GpuMemoryAllocation& allocation) = 0; }; class GpuCommandBufferStub @@ -98,6 +102,10 @@ class GpuCommandBufferStub virtual void SendMemoryAllocationToProxy( const GpuMemoryAllocation& allocation) OVERRIDE; + // Sets buffer usage depending on Memory Allocation + virtual void SetMemoryAllocation( + const GpuMemoryAllocation& allocation) OVERRIDE; + // Whether this command buffer can currently handle IPC messages. bool IsScheduled(); @@ -181,6 +189,7 @@ class GpuCommandBufferStub bool software_; uint32 last_flush_count_; scoped_ptr<GpuCommandBufferStubBase::SurfaceState> surface_state_; + GpuMemoryAllocation allocation_; scoped_ptr<gpu::CommandBufferService> command_buffer_; scoped_ptr<gpu::gles2::GLES2Decoder> decoder_; diff --git a/content/common/gpu/gpu_memory_allocation.h b/content/common/gpu/gpu_memory_allocation.h index 5a77015..a4b1c95 100644 --- a/content/common/gpu/gpu_memory_allocation.h +++ b/content/common/gpu/gpu_memory_allocation.h @@ -15,29 +15,29 @@ class GpuMemoryAllocation { public: uint64 gpuResourceSizeInBytes; - bool hasFrontbuffer; - bool hasBackbuffer; + bool has_frontbuffer; + bool has_backbuffer; GpuMemoryAllocation() : gpuResourceSizeInBytes(0), - hasFrontbuffer(false), - hasBackbuffer(false) { + has_frontbuffer(false), + has_backbuffer(false) { } GpuMemoryAllocation(uint64 gpuResourceSizeInBytes, - bool hasFrontbuffer, - bool hasBackbuffer) + bool has_frontbuffer, + bool has_backbuffer) : gpuResourceSizeInBytes(gpuResourceSizeInBytes), - hasFrontbuffer(hasFrontbuffer), - hasBackbuffer(hasBackbuffer) { + has_frontbuffer(has_frontbuffer), + has_backbuffer(has_backbuffer) { } }; inline bool operator==(const GpuMemoryAllocation& lhs, const GpuMemoryAllocation& rhs) { return lhs.gpuResourceSizeInBytes == rhs.gpuResourceSizeInBytes && - lhs.hasFrontbuffer == rhs.hasFrontbuffer && - lhs.hasBackbuffer == rhs.hasBackbuffer; + lhs.has_frontbuffer == rhs.has_frontbuffer && + lhs.has_backbuffer == rhs.has_backbuffer; } inline bool operator!=(const GpuMemoryAllocation& lhs, diff --git a/content/common/gpu/gpu_memory_manager.cc b/content/common/gpu/gpu_memory_manager.cc index e1000ab..3bb7c9f 100644 --- a/content/common/gpu/gpu_memory_manager.cc +++ b/content/common/gpu/gpu_memory_manager.cc @@ -114,16 +114,18 @@ void GpuMemoryManager::Manage() { for (size_t i = 0; i < stubs_with_surface.size(); ++i) { GpuCommandBufferStubBase* stub = stubs_with_surface[i]; DCHECK(stub->has_surface_state()); + const GpuMemoryAllocation* allocation = NULL; if (stub->surface_state().visible) { all_buffers.insert(stub->surface_state().surface_id); - stub->SendMemoryAllocationToProxy(all_buffers_allocation); + allocation = &all_buffers_allocation; } else if (i < max_surfaces_with_frontbuffer_soft_limit_) { front_buffers.insert(stub->surface_state().surface_id); - stub->SendMemoryAllocationToProxy(front_buffers_allocation); + allocation = &front_buffers_allocation; } else { no_buffers.insert(stub->surface_state().surface_id); - stub->SendMemoryAllocationToProxy(no_buffers_allocation); + allocation = &no_buffers_allocation; } + stub->SetMemoryAllocation(*allocation); } } diff --git a/content/common/gpu/gpu_memory_manager_unittest.cc b/content/common/gpu/gpu_memory_manager_unittest.cc index 6bdd1f9..53beb89 100644 --- a/content/common/gpu/gpu_memory_manager_unittest.cc +++ b/content/common/gpu/gpu_memory_manager_unittest.cc @@ -26,6 +26,8 @@ class FakeCommandBufferStub : public GpuCommandBufferStubBase { virtual bool has_surface_state() { return surface_state_.surface_id != 0; } virtual const SurfaceState& surface_state() { return surface_state_; } virtual void SendMemoryAllocationToProxy(const GpuMemoryAllocation& alloc) { + } + virtual void SetMemoryAllocation(const GpuMemoryAllocation& alloc) { allocation_ = alloc; } }; @@ -133,7 +135,7 @@ TEST_F(GpuMemoryManagerTest, ComparatorTests) { } // Test GpuMemoryManager::Manage basic functionality. -// Expect memory allocation to set hasFrontbuffer, hasBackbuffer according +// Expect memory allocation to set has_frontbuffer, has_backbuffer according // to visibility and last used time. TEST_F(GpuMemoryManagerTest, TestManageBasicFunctionality) { FakeCommandBufferStub stub1(GenerateUniqueSurfaceId(), true, older_), @@ -142,14 +144,14 @@ TEST_F(GpuMemoryManagerTest, TestManageBasicFunctionality) { client_.stubs_.push_back(&stub2); Manage(); - EXPECT_EQ(stub1.allocation_.hasFrontbuffer, true); - EXPECT_EQ(stub1.allocation_.hasBackbuffer, true); - EXPECT_EQ(stub2.allocation_.hasFrontbuffer, true); - EXPECT_EQ(stub2.allocation_.hasBackbuffer, false); + EXPECT_EQ(stub1.allocation_.has_frontbuffer, true); + EXPECT_EQ(stub1.allocation_.has_backbuffer, true); + EXPECT_EQ(stub2.allocation_.has_frontbuffer, true); + EXPECT_EQ(stub2.allocation_.has_backbuffer, false); } // Test GpuMemoryManager::Manage functionality: Test changing visibility -// Expect memory allocation to set hasFrontbuffer, hasBackbuffer according +// Expect memory allocation to set has_frontbuffer, has_backbuffer according // to visibility and last used time. TEST_F(GpuMemoryManagerTest, TestManageChangingVisibility) { FakeCommandBufferStub stub1(GenerateUniqueSurfaceId(), true, older_), @@ -158,19 +160,19 @@ TEST_F(GpuMemoryManagerTest, TestManageChangingVisibility) { client_.stubs_.push_back(&stub2); Manage(); - EXPECT_EQ(stub1.allocation_.hasFrontbuffer, true); - EXPECT_EQ(stub1.allocation_.hasBackbuffer, true); - EXPECT_EQ(stub2.allocation_.hasFrontbuffer, true); - EXPECT_EQ(stub2.allocation_.hasBackbuffer, false); + EXPECT_EQ(stub1.allocation_.has_frontbuffer, true); + EXPECT_EQ(stub1.allocation_.has_backbuffer, true); + EXPECT_EQ(stub2.allocation_.has_frontbuffer, true); + EXPECT_EQ(stub2.allocation_.has_backbuffer, false); stub1.surface_state_.visible = false; stub2.surface_state_.visible = true; Manage(); - EXPECT_EQ(stub1.allocation_.hasFrontbuffer, true); - EXPECT_EQ(stub1.allocation_.hasBackbuffer, false); - EXPECT_EQ(stub2.allocation_.hasFrontbuffer, true); - EXPECT_EQ(stub2.allocation_.hasBackbuffer, true); + EXPECT_EQ(stub1.allocation_.has_frontbuffer, true); + EXPECT_EQ(stub1.allocation_.has_backbuffer, false); + EXPECT_EQ(stub2.allocation_.has_frontbuffer, true); + EXPECT_EQ(stub2.allocation_.has_backbuffer, true); } // Test GpuMemoryManager::Manage functionality: Test more than threshold number @@ -187,14 +189,14 @@ TEST_F(GpuMemoryManagerTest, TestManageManyVisibleStubs) { client_.stubs_.push_back(&stub4); Manage(); - EXPECT_EQ(stub1.allocation_.hasFrontbuffer, true); - EXPECT_EQ(stub1.allocation_.hasBackbuffer, true); - EXPECT_EQ(stub2.allocation_.hasFrontbuffer, true); - EXPECT_EQ(stub2.allocation_.hasBackbuffer, true); - EXPECT_EQ(stub3.allocation_.hasFrontbuffer, true); - EXPECT_EQ(stub3.allocation_.hasBackbuffer, true); - EXPECT_EQ(stub4.allocation_.hasFrontbuffer, true); - EXPECT_EQ(stub4.allocation_.hasBackbuffer, true); + EXPECT_EQ(stub1.allocation_.has_frontbuffer, true); + EXPECT_EQ(stub1.allocation_.has_backbuffer, true); + EXPECT_EQ(stub2.allocation_.has_frontbuffer, true); + EXPECT_EQ(stub2.allocation_.has_backbuffer, true); + EXPECT_EQ(stub3.allocation_.has_frontbuffer, true); + EXPECT_EQ(stub3.allocation_.has_backbuffer, true); + EXPECT_EQ(stub4.allocation_.has_frontbuffer, true); + EXPECT_EQ(stub4.allocation_.has_backbuffer, true); } // Test GpuMemoryManager::Manage functionality: Test more than threshold number @@ -211,14 +213,14 @@ TEST_F(GpuMemoryManagerTest, TestManageManyNotVisibleStubs) { client_.stubs_.push_back(&stub4); Manage(); - EXPECT_EQ(stub1.allocation_.hasFrontbuffer, true); - EXPECT_EQ(stub1.allocation_.hasBackbuffer, false); - EXPECT_EQ(stub2.allocation_.hasFrontbuffer, true); - EXPECT_EQ(stub2.allocation_.hasBackbuffer, false); - EXPECT_EQ(stub3.allocation_.hasFrontbuffer, true); - EXPECT_EQ(stub3.allocation_.hasBackbuffer, false); - EXPECT_EQ(stub4.allocation_.hasFrontbuffer, false); - EXPECT_EQ(stub4.allocation_.hasBackbuffer, false); + EXPECT_EQ(stub1.allocation_.has_frontbuffer, true); + EXPECT_EQ(stub1.allocation_.has_backbuffer, false); + EXPECT_EQ(stub2.allocation_.has_frontbuffer, true); + EXPECT_EQ(stub2.allocation_.has_backbuffer, false); + EXPECT_EQ(stub3.allocation_.has_frontbuffer, true); + EXPECT_EQ(stub3.allocation_.has_backbuffer, false); + EXPECT_EQ(stub4.allocation_.has_frontbuffer, false); + EXPECT_EQ(stub4.allocation_.has_backbuffer, false); } // Test GpuMemoryManager::Manage functionality: Test changing the last used @@ -235,17 +237,17 @@ TEST_F(GpuMemoryManagerTest, TestManageChangingLastUsedTime) { client_.stubs_.push_back(&stub4); Manage(); - EXPECT_EQ(stub3.allocation_.hasFrontbuffer, true); - EXPECT_EQ(stub3.allocation_.hasBackbuffer, false); - EXPECT_EQ(stub4.allocation_.hasFrontbuffer, false); - EXPECT_EQ(stub4.allocation_.hasBackbuffer, false); + EXPECT_EQ(stub3.allocation_.has_frontbuffer, true); + EXPECT_EQ(stub3.allocation_.has_backbuffer, false); + EXPECT_EQ(stub4.allocation_.has_frontbuffer, false); + EXPECT_EQ(stub4.allocation_.has_backbuffer, false); stub3.surface_state_.last_used_time = older_; stub4.surface_state_.last_used_time = newer_; Manage(); - EXPECT_EQ(stub3.allocation_.hasFrontbuffer, false); - EXPECT_EQ(stub3.allocation_.hasBackbuffer, false); - EXPECT_EQ(stub4.allocation_.hasFrontbuffer, true); - EXPECT_EQ(stub4.allocation_.hasBackbuffer, false); + EXPECT_EQ(stub3.allocation_.has_frontbuffer, false); + EXPECT_EQ(stub3.allocation_.has_backbuffer, false); + EXPECT_EQ(stub4.allocation_.has_frontbuffer, true); + EXPECT_EQ(stub4.allocation_.has_backbuffer, false); } diff --git a/content/common/gpu/image_transport_surface_linux.cc b/content/common/gpu/image_transport_surface_linux.cc index 8bbdb22..468378d 100644 --- a/content/common/gpu/image_transport_surface_linux.cc +++ b/content/common/gpu/image_transport_surface_linux.cc @@ -91,7 +91,7 @@ class EGLImageTransportSurface virtual gfx::Size GetSize() OVERRIDE; virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; - virtual void SetVisible(bool visible) OVERRIDE; + virtual void SetVisibility(VisibilityState visibility_state) OVERRIDE; protected: // ImageTransportSurface implementation @@ -110,6 +110,9 @@ class EGLImageTransportSurface void GetRegionsToCopy(const gfx::Rect& new_damage_rect, std::vector<gfx::Rect>* regions); + // Tracks the current surface visibility state. + VisibilityState visibility_state_; + uint32 fbo_id_; scoped_refptr<EGLAcceleratedSurface> back_surface_; @@ -142,7 +145,7 @@ class GLXImageTransportSurface virtual std::string GetExtensions(); virtual gfx::Size GetSize() OVERRIDE; virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; - virtual void SetVisible(bool visible) OVERRIDE; + virtual void SetVisibility(VisibilityState visibility_state) OVERRIDE; protected: // ImageTransportSurface implementation: @@ -162,6 +165,9 @@ class GLXImageTransportSurface void SendBuffersSwapped(); void SendPostSubBuffer(int x, int y, int width, int height); + // Tracks the current surface visibility state. + VisibilityState visibility_state_; + XID dummy_parent_; gfx::Size size_; @@ -262,6 +268,7 @@ EGLImageTransportSurface::EGLImageTransportSurface( GpuChannelManager* manager, GpuCommandBufferStub* stub) : gfx::PbufferGLSurfaceEGL(false, gfx::Size(1, 1)), + visibility_state_(VISIBILITY_STATE_FOREGROUND), fbo_id_(0), made_current_(false) { helper_.reset(new ImageTransportHelper(this, @@ -324,12 +331,29 @@ unsigned int EGLImageTransportSurface::GetBackingFrameBufferObject() { return fbo_id_; } -void EGLImageTransportSurface::SetVisible(bool visible) { - if (!visible && back_surface_.get() && front_surface_.get()) { - ReleaseSurface(&back_surface_); - } else if (visible && !back_surface_.get() && front_surface_.get()) { - // Leverage the OnResize hook because it does exactly what we want - OnResize(front_surface_->size()); +void EGLImageTransportSurface::SetVisibility(VisibilityState visibility_state) { + if (visibility_state_ == visibility_state) + return; + visibility_state_ = visibility_state; + + switch (visibility_state) { + case VISIBILITY_STATE_FOREGROUND: + if (!back_surface_.get() && front_surface_.get()) + OnResize(front_surface_->size()); + break; + + case VISIBILITY_STATE_BACKGROUND: + if (back_surface_.get() && front_surface_.get()) + ReleaseSurface(&back_surface_); + break; + + case VISIBILITY_STATE_HIBERNATED: + if (back_surface_.get() && front_surface_.get()) + ReleaseSurface(&back_surface_); + break; + + default: + NOTREACHED(); } } @@ -531,6 +555,7 @@ GLXImageTransportSurface::GLXImageTransportSurface( GpuChannelManager* manager, GpuCommandBufferStub* stub) : gfx::NativeViewGLSurfaceGLX(), + visibility_state_(VISIBILITY_STATE_FOREGROUND), dummy_parent_(0), size_(1, 1), bound_(false), @@ -614,15 +639,34 @@ void GLXImageTransportSurface::ReleaseSurface() { bound_ = false; } -void GLXImageTransportSurface::SetVisible(bool visible) { - Display* dpy = static_cast<Display*>(GetDisplay()); - if (!visible) { - XResizeWindow(dpy, window_, 1, 1); - } else { - XResizeWindow(dpy, window_, size_.width(), size_.height()); - needs_resize_ = true; +void GLXImageTransportSurface::SetVisibility(VisibilityState visibility_state) { + if (visibility_state_ == visibility_state) + return; + visibility_state_ = visibility_state; + + switch (visibility_state) { + case VISIBILITY_STATE_FOREGROUND: { + Display* dpy = static_cast<Display*>(GetDisplay()); + XResizeWindow(dpy, window_, size_.width(), size_.height()); + needs_resize_ = true; + glXWaitX(); + break; + } + case VISIBILITY_STATE_BACKGROUND: { + Display* dpy = static_cast<Display*>(GetDisplay()); + XResizeWindow(dpy, window_, 1, 1); + glXWaitX(); + break; + } + case VISIBILITY_STATE_HIBERNATED: { + Display* dpy = static_cast<Display*>(GetDisplay()); + XResizeWindow(dpy, window_, 1, 1); + glXWaitX(); + break; + } + default: + NOTREACHED(); } - glXWaitX(); } void GLXImageTransportSurface::OnResize(gfx::Size size) { diff --git a/content/common/gpu/image_transport_surface_win.cc b/content/common/gpu/image_transport_surface_win.cc index 08df39f..cbef17a 100644 --- a/content/common/gpu/image_transport_surface_win.cc +++ b/content/common/gpu/image_transport_surface_win.cc @@ -40,7 +40,7 @@ class PbufferImageTransportSurface virtual bool SwapBuffers() OVERRIDE; virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; virtual std::string GetExtensions() OVERRIDE; - virtual void SetVisible(bool visible) OVERRIDE; + virtual void SetVisibility(VisibilityState visibility_state) OVERRIDE; protected: // ImageTransportSurface implementation @@ -55,8 +55,8 @@ class PbufferImageTransportSurface virtual ~PbufferImageTransportSurface(); void SendBuffersSwapped(); - // Whether the surface is currently visible. - bool is_visible_; + // Tracks the current surface visibility state. + VisibilityState visibility_state_; // Size to resize to when the surface becomes visible. gfx::Size visible_size_; @@ -70,7 +70,7 @@ PbufferImageTransportSurface::PbufferImageTransportSurface( GpuChannelManager* manager, GpuCommandBufferStub* stub) : GLSurfaceAdapter(new gfx::PbufferGLSurfaceEGL(false, gfx::Size(1, 1))), - is_visible_(true) { + visibility_state_(VISIBILITY_STATE_FOREGROUND) { helper_.reset(new ImageTransportHelper(this, manager, stub, @@ -121,16 +121,29 @@ bool PbufferImageTransportSurface::PostSubBuffer( return false; } -void PbufferImageTransportSurface::SetVisible(bool visible) { - if (visible == is_visible_) +void PbufferImageTransportSurface::SetVisibility( + VisibilityState visibility_state) { + if (visibility_state_ == visibility_state) return; + visibility_state_ = visibility_state; - is_visible_ = visible; + switch (visibility_state) { + case VISIBILITY_STATE_FOREGROUND: + Resize(visible_size_); + break; - if (visible) - Resize(visible_size_); - else - Resize(gfx::Size(1, 1)); + case VISIBILITY_STATE_BACKGROUND: + Resize(gfx::Size(1, 1)); + break; + + case VISIBILITY_STATE_HIBERNATED: + Resize(gfx::Size(1, 1)); + helper_->Suspend(); + break; + + default: + NOTREACHED(); + } } std::string PbufferImageTransportSurface::GetExtensions() { @@ -168,7 +181,7 @@ void PbufferImageTransportSurface::OnResizeViewACK() { } void PbufferImageTransportSurface::OnResize(gfx::Size size) { - if (is_visible_) + if (visibility_state_ == VISIBILITY_STATE_FOREGROUND) Resize(size); visible_size_ = size; |