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

Side by Side Diff: content/browser/aura/compositor_resize_lock.cc

Issue 137893007: Add the UI compositor to the Mac build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missed file Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 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.
4
5 #include "content/browser/aura/compositor_resize_lock.h"
6
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"
11
12 namespace content {
13
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_);
23
24 TRACE_EVENT_ASYNC_BEGIN2("ui", "CompositorResizeLock", this,
25 "width", expected_size().width(),
26 "height", expected_size().height());
27 root_window_->HoldPointerMoves();
28
29 BrowserThread::PostDelayedTask(
30 BrowserThread::UI, FROM_HERE,
31 base::Bind(&CompositorResizeLock::CancelLock,
32 weak_ptr_factory_.GetWeakPtr()),
33 timeout);
34 }
35
36 CompositorResizeLock::~CompositorResizeLock() {
37 CancelLock();
38 TRACE_EVENT_ASYNC_END2("ui", "CompositorResizeLock", this,
39 "width", expected_size().width(),
40 "height", expected_size().height());
41 }
42
43 bool CompositorResizeLock::GrabDeferredLock() {
44 return ResizeLock::GrabDeferredLock();
45 }
46
47 void CompositorResizeLock::UnlockCompositor() {
48 ResizeLock::UnlockCompositor();
49 compositor_lock_ = NULL;
50 }
51
52 void CompositorResizeLock::LockCompositor() {
53 ResizeLock::LockCompositor();
54 compositor_lock_ = root_window_->host()->compositor()->GetCompositorLock();
55 }
56
57 void CompositorResizeLock::CancelLock() {
58 if (cancelled_)
59 return;
60 cancelled_ = true;
61 UnlockCompositor();
62 root_window_->ReleasePointerMoves();
63 }
64
65 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/aura/compositor_resize_lock.h ('k') | content/browser/aura/gpu_browser_compositor_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698