Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index 5c5289b355df8115e71cd8525d1d033727f47589..13e5e438945dcf1c355b28fa02bbf00e6c78df75 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -309,7 +309,7 @@ WebContentsImpl::WebContentsImpl( |
upload_size_(0), |
upload_position_(0), |
displayed_insecure_content_(false), |
- capturing_contents_(false), |
+ capturing_count_(0), |
is_being_destroyed_(false), |
notify_disconnection_(false), |
dialog_manager_(NULL), |
@@ -1009,7 +1009,10 @@ bool WebContentsImpl::DisplayedInsecureContent() const { |
} |
void WebContentsImpl::SetCapturingContents(bool cap) { |
sky
2013/02/04 15:02:25
Update the description of this method to indicate
miu
2013/02/04 21:36:52
Done. (in content/public/browser/web_contents.h)
|
- capturing_contents_ = cap; |
+ capturing_count_ += cap ? +1 : -1; |
+ DVLOG(1) << "There are now " << capturing_count_ |
+ << " capturing(s) of WebContentsImpl@" << this; |
+ DCHECK_LE(0, capturing_count_); |
} |
bool WebContentsImpl::IsCrashed() const { |
@@ -1076,9 +1079,11 @@ void WebContentsImpl::WasShown() { |
} |
void WebContentsImpl::WasHidden() { |
- if (!capturing_contents_) { |
+ // If there are entities capturing screenshots or video (e.g., mirroring), |
+ // don't activate the "disable rendering" optimization. |
+ if (capturing_count_ == 0) { |
// |GetRenderViewHost()| can be NULL if the user middle clicks a link to |
- // open a tab in then background, then closes the tab before selecting it. |
+ // open a tab in the background, then closes the tab before selecting it. |
// This is because closing the tab calls WebContentsImpl::Destroy(), which |
// removes the |GetRenderViewHost()|; then when we actually destroy the |
// window, OnWindowPosChanged() notices and calls WasHidden() (which |