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

Unified Diff: content/browser/renderer_host/delegated_frame_host_client_aura.cc

Issue 2773433003: Fix CompositorResizeLock to do something. (Closed)
Patch Set: resizelock: observer-rebase Created 3 years, 9 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/renderer_host/delegated_frame_host_client_aura.cc
diff --git a/content/browser/renderer_host/delegated_frame_host_client_aura.cc b/content/browser/renderer_host/delegated_frame_host_client_aura.cc
index 1732f7196d7bae311cb5d5f1e6f23bc0ceefc858..b4e111504ac9e02473872279d601c9bb10ef5190 100644
--- a/content/browser/renderer_host/delegated_frame_host_client_aura.cc
+++ b/content/browser/renderer_host/delegated_frame_host_client_aura.cc
@@ -4,23 +4,15 @@
#include "content/browser/renderer_host/delegated_frame_host_client_aura.h"
-#include "content/browser/renderer_host/compositor_resize_lock_aura.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_aura.h"
#include "content/common/view_messages.h"
#include "ui/aura/window.h"
+#include "ui/aura/window_event_dispatcher.h"
+#include "ui/aura/window_tree_host.h"
#include "ui/compositor/layer.h"
namespace content {
-namespace {
-
-// When accelerated compositing is enabled and a widget resize is pending,
-// we delay further resizes of the UI. The following constant is the maximum
-// length of time that we should delay further UI resizes while waiting for a
-// resized frame from a renderer.
-const int kResizeLockTimeoutMs = 67;
-
-} // namespace
DelegatedFrameHostClientAura::DelegatedFrameHostClientAura(
RenderWidgetHostViewAura* render_widget_host_view)
@@ -71,14 +63,14 @@ bool DelegatedFrameHostClientAura::DelegatedFrameCanCreateResizeLock() const {
#endif
}
-std::unique_ptr<ResizeLock>
-DelegatedFrameHostClientAura::DelegatedFrameHostCreateResizeLock(
- bool defer_compositor_lock) {
+std::unique_ptr<CompositorResizeLock>
+DelegatedFrameHostClientAura::DelegatedFrameHostCreateResizeLock() {
+ // Pointer moves are released when the CompositorResizeLock ends.
+ auto* host = render_widget_host_view_->window_->GetHost();
+ host->dispatcher()->HoldPointerMoves();
+
gfx::Size desired_size = render_widget_host_view_->window_->bounds().size();
- return std::unique_ptr<ResizeLock>(new CompositorResizeLock(
- render_widget_host_view_->window_->GetHost(), desired_size,
- defer_compositor_lock,
- base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs)));
+ return base::MakeUnique<CompositorResizeLock>(this, desired_size);
}
void DelegatedFrameHostClientAura::DelegatedFrameHostResizeLockWasReleased() {
@@ -104,4 +96,16 @@ bool DelegatedFrameHostClientAura::IsAutoResizeEnabled() const {
return render_widget_host_view_->host_->auto_resize_enabled();
}
+std::unique_ptr<ui::CompositorLock>
+DelegatedFrameHostClientAura::GetCompositorLock(
+ ui::CompositorLockClient* client) {
+ auto* host = render_widget_host_view_->window_->GetHost();
+ return host->compositor()->GetCompositorLock(client);
+}
+
+void DelegatedFrameHostClientAura::CompositorResizeLockEnded() {
+ auto* host = render_widget_host_view_->window_->GetHost();
+ host->dispatcher()->ReleasePointerMoves();
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698