OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/compositor_resize_lock_aura.h" | 5 #include "content/browser/renderer_host/compositor_resize_lock_aura.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 #include "ui/aura/window_event_dispatcher.h" | 9 #include "ui/aura/window_event_dispatcher.h" |
10 #include "ui/aura/window_tree_host.h" | 10 #include "ui/aura/window_tree_host.h" |
11 #include "ui/compositor/compositor.h" | 11 #include "ui/compositor/compositor.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 CompositorResizeLock::CompositorResizeLock( | 15 CompositorResizeLock::CompositorResizeLock( |
16 aura::WindowTreeHost* host, | 16 aura::WindowTreeHost* host, |
17 const gfx::Size new_size, | 17 const gfx::Size new_size, |
18 bool defer_compositor_lock, | 18 bool defer_compositor_lock, |
19 const base::TimeDelta& timeout) | 19 const base::TimeDelta& timeout) |
20 : ResizeLock(new_size, defer_compositor_lock), | 20 : ResizeLock(new_size, defer_compositor_lock), |
21 host_(host), | 21 host_(host), |
22 weak_ptr_factory_(this), | 22 cancelled_(false), |
23 cancelled_(false) { | 23 weak_ptr_factory_(this) { |
24 DCHECK(host_); | 24 DCHECK(host_); |
25 | 25 |
26 TRACE_EVENT_ASYNC_BEGIN2("ui", "CompositorResizeLock", this, | 26 TRACE_EVENT_ASYNC_BEGIN2("ui", "CompositorResizeLock", this, |
27 "width", expected_size().width(), | 27 "width", expected_size().width(), |
28 "height", expected_size().height()); | 28 "height", expected_size().height()); |
29 host_->dispatcher()->HoldPointerMoves(); | 29 host_->dispatcher()->HoldPointerMoves(); |
30 | 30 |
31 BrowserThread::PostDelayedTask( | 31 BrowserThread::PostDelayedTask( |
32 BrowserThread::UI, FROM_HERE, | 32 BrowserThread::UI, FROM_HERE, |
33 base::Bind(&CompositorResizeLock::CancelLock, | 33 base::Bind(&CompositorResizeLock::CancelLock, |
(...skipping 24 matching lines...) Expand all Loading... |
58 | 58 |
59 void CompositorResizeLock::CancelLock() { | 59 void CompositorResizeLock::CancelLock() { |
60 if (cancelled_) | 60 if (cancelled_) |
61 return; | 61 return; |
62 cancelled_ = true; | 62 cancelled_ = true; |
63 UnlockCompositor(); | 63 UnlockCompositor(); |
64 host_->dispatcher()->ReleasePointerMoves(); | 64 host_->dispatcher()->ReleasePointerMoves(); |
65 } | 65 } |
66 | 66 |
67 } // namespace content | 67 } // namespace content |
OLD | NEW |