Update ASan/Android runtime and setup script to LLVM r200682.
[chromium-blink-merge.git] / content / browser / renderer_host / compositor_resize_lock_aura.cc
blob53c2c5bc0dd828108d7b92917b7b1ca0bb2c42d7
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
3 // found in the LICENSE file.
5 #include "content/browser/renderer_host/compositor_resize_lock_aura.h"
7 #include "base/debug/trace_event.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "ui/aura/root_window.h"
10 #include "ui/compositor/compositor.h"
12 namespace content {
14 CompositorResizeLock::CompositorResizeLock(aura::RootWindow* root_window,
15 const gfx::Size new_size,
16 bool defer_compositor_lock,
17 const base::TimeDelta& timeout)
18 : ResizeLock(new_size, defer_compositor_lock),
19 root_window_(root_window),
20 weak_ptr_factory_(this),
21 cancelled_(false) {
22 DCHECK(root_window_);
24 TRACE_EVENT_ASYNC_BEGIN2("ui", "CompositorResizeLock", this,
25 "width", expected_size().width(),
26 "height", expected_size().height());
27 root_window_->HoldPointerMoves();
29 BrowserThread::PostDelayedTask(
30 BrowserThread::UI, FROM_HERE,
31 base::Bind(&CompositorResizeLock::CancelLock,
32 weak_ptr_factory_.GetWeakPtr()),
33 timeout);
36 CompositorResizeLock::~CompositorResizeLock() {
37 CancelLock();
38 TRACE_EVENT_ASYNC_END2("ui", "CompositorResizeLock", this,
39 "width", expected_size().width(),
40 "height", expected_size().height());
43 bool CompositorResizeLock::GrabDeferredLock() {
44 return ResizeLock::GrabDeferredLock();
47 void CompositorResizeLock::UnlockCompositor() {
48 ResizeLock::UnlockCompositor();
49 compositor_lock_ = NULL;
52 void CompositorResizeLock::LockCompositor() {
53 ResizeLock::LockCompositor();
54 compositor_lock_ = root_window_->host()->compositor()->GetCompositorLock();
57 void CompositorResizeLock::CancelLock() {
58 if (cancelled_)
59 return;
60 cancelled_ = true;
61 UnlockCompositor();
62 root_window_->ReleasePointerMoves();
65 } // namespace content