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

Unified Diff: chrome/browser/ui/views/tabs/tab_drag_controller.cc

Issue 12179007: While screencasting a tab, do not disable rendering updates while hidden. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Finer-grained increment/decrement, per sky@'s comments. Created 7 years, 10 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: chrome/browser/ui/views/tabs/tab_drag_controller.cc
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
index c3980924258555be4adeb146fc11318f6f8da8a6..d0e2820b4b60a072219d30dc6f89f34b07a1b73d 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc
@@ -1137,7 +1137,7 @@ void TabDragController::Attach(TabStrip* attached_tabstrip,
}
// Return the WebContents to normalcy.
- source_dragged_contents()->SetCapturingContents(false);
+ source_dragged_contents()->DecrementCapturerCount();
}
// Inserting counts as a move. We don't want the tabs to jitter when the
@@ -1226,7 +1226,7 @@ void TabDragController::Detach(ReleaseCapture release_capture) {
// Prevent the WebContents HWND from being hidden by any of the model
// operations performed during the drag.
if (!detach_into_browser_)
- source_dragged_contents()->SetCapturingContents(true);
+ source_dragged_contents()->IncrementCapturerCount();
std::vector<gfx::Rect> drag_bounds = CalculateBoundsForDraggedTabs(0);
TabStripModel* attached_model = GetModel(attached_tabstrip_);
@@ -1660,6 +1660,13 @@ void TabDragController::RevertDrag() {
if (detach_into_browser_ && source_tabstrip_)
source_tabstrip_->GetWidget()->Activate();
+
+ // Return the WebContents to normalcy. If the tab was attached to a
+ // TabStrip before the revert, the decrement has already occurred.
+ // If the tab was destroyed, don't attempt to dereference the
+ // WebContents pointer.
+ if (!detach_into_browser_ && !attached_tabstrip_ && source_dragged_contents())
+ source_dragged_contents()->DecrementCapturerCount();
}
void TabDragController::ResetSelection(TabStripModel* model) {
@@ -1805,6 +1812,10 @@ void TabDragController::CompleteDrag() {
contentses, window_bounds, dock_info_, widget->IsMaximized());
ResetSelection(new_browser->tab_strip_model());
new_browser->window()->Show();
+
+ // Return the WebContents to normalcy.
+ if (!detach_into_browser_)
+ source_dragged_contents()->DecrementCapturerCount();
}
CleanUpHiddenFrame();

Powered by Google App Engine
This is Rietveld 408576698