Index: content/browser/aura/owned_mailbox.cc |
diff --git a/content/browser/aura/owned_mailbox.cc b/content/browser/aura/owned_mailbox.cc |
index 1a99d335ac245f3760d29c29af9c7ae531eb632b..5994903b33220a908dba061a304f1830e535f6c1 100644 |
--- a/content/browser/aura/owned_mailbox.cc |
+++ b/content/browser/aura/owned_mailbox.cc |
@@ -18,11 +18,8 @@ OwnedMailbox::OwnedMailbox(GLHelper* gl_helper) |
} |
OwnedMailbox::~OwnedMailbox() { |
- ImageTransportFactory::GetInstance()->RemoveObserver(this); |
- if (gl_helper_) { |
- gl_helper_->WaitSyncPoint(sync_point_); |
- gl_helper_->DeleteTexture(texture_id_); |
- } |
+ if (gl_helper_) |
+ Destroy(); |
} |
void OwnedMailbox::UpdateSyncPoint(uint32 sync_point) { |
@@ -30,7 +27,8 @@ void OwnedMailbox::UpdateSyncPoint(uint32 sync_point) { |
sync_point_ = sync_point; |
} |
-void OwnedMailbox::OnLostResources() { |
+void OwnedMailbox::Destroy() { |
+ ImageTransportFactory::GetInstance()->RemoveObserver(this); |
gl_helper_->WaitSyncPoint(sync_point_); |
gl_helper_->DeleteTexture(texture_id_); |
texture_id_ = 0; |
@@ -39,4 +37,9 @@ void OwnedMailbox::OnLostResources() { |
gl_helper_ = NULL; |
} |
+void OwnedMailbox::OnLostResources() { |
+ if (gl_helper_) |
+ Destroy(); |
+} |
+ |
} // namespace content |