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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 853883007: Add occlusion support to WebContentsImpl and RenderWidgetHostView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
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 f9ba939d844ad18acc9ababcfad18f576437144e..ba1faa7ae09dbe1d5f53f4bec8bec92123c767cf 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -925,6 +925,9 @@ void WebContentsImpl::IncrementCapturerCount(const gfx::Size& capture_size) {
preferred_size_for_capture_ = capture_size;
OnPreferredSizeChanged(preferred_size_);
}
+
+ // Ensure that all views are un-occluded before capture begins.
+ WasUnOccluded();
ccameron 2015/01/16 19:01:11 I think there's a bug here where we will get into
}
void WebContentsImpl::DecrementCapturerCount() {
@@ -1025,14 +1028,11 @@ base::TimeTicks WebContentsImpl::GetLastActiveTime() const {
void WebContentsImpl::WasShown() {
controller_.SetActive(true);
- std::set<RenderWidgetHostView*> widgets = GetRenderWidgetHostViewsInTree();
- for (std::set<RenderWidgetHostView*>::iterator iter = widgets.begin();
- iter != widgets.end();
- iter++) {
- if (*iter) {
- (*iter)->Show();
+ for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
+ if (view) {
+ view->Show();
#if defined(OS_MACOSX)
- (*iter)->SetActive(true);
+ view->SetActive(true);
#endif
}
}
@@ -1066,12 +1066,9 @@ void WebContentsImpl::WasHidden() {
// removes the |GetRenderViewHost()|; then when we actually destroy the
// window, OnWindowPosChanged() notices and calls WasHidden() (which
// calls us).
- std::set<RenderWidgetHostView*> widgets = GetRenderWidgetHostViewsInTree();
- for (std::set<RenderWidgetHostView*>::iterator iter = widgets.begin();
- iter != widgets.end();
- iter++) {
- if (*iter)
- (*iter)->Hide();
+ for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
+ if (view)
+ view->Hide();
}
// Release any video power save blockers held as video is not visible.
@@ -1083,6 +1080,23 @@ void WebContentsImpl::WasHidden() {
should_normally_be_visible_ = false;
}
+void WebContentsImpl::WasOccluded() {
+ if (capturer_count_ > 0)
+ return;
+
+ for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
+ if (view)
+ view->WasOccluded();
+ }
+}
+
+void WebContentsImpl::WasUnOccluded() {
+ for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) {
+ if (view)
+ view->WasUnOccluded();
+ }
+}
+
bool WebContentsImpl::NeedToFireBeforeUnload() {
// TODO(creis): Should we fire even for interstitial pages?
return WillNotifyDisconnection() &&

Powered by Google App Engine
This is Rietveld 408576698