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

Side by Side Diff: content/browser/renderer_host/compositor_resize_lock.h

Issue 2773433003: Fix CompositorResizeLock to do something. (Closed)
Patch Set: resizelock: . 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_RESIZE_LOCK_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_RESIZE_LOCK_H_
7
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/time/time.h"
12 #include "ui/compositor/compositor_lock.h"
13 #include "ui/gfx/geometry/size.h"
14
15 namespace content {
16
17 class CompositorResizeLockClient {
18 public:
19 virtual ~CompositorResizeLockClient() {}
20
21 // Creates and returns a CompositorLock for the CompositoResizeLock to
22 // hold.
23 virtual std::unique_ptr<ui::CompositorLock> GetCompositorLock(
24 ui::CompositorLockClient* client) = 0;
25
26 // Called when the CompositorResizeLock ends. This can happen
27 // before the CompositorResizeLock is destroyed if it times out.
28 virtual void CompositorResizeLockEnded() = 0;
29 };
30
31 // Used to prevent further resizes while a resize is pending.
32 class CompositorResizeLock
33 : NON_EXPORTED_BASE(public ui::CompositorLockClient) {
34 public:
35 CompositorResizeLock(CompositorResizeLockClient* client,
36 const gfx::Size& new_size);
37 ~CompositorResizeLock() override;
38
39 // Returns |true| if the call locks the compositor, or false if it was ever
40 // locked/unlocked.
41 bool Lock();
42
43 // Releases the lock on the compositor without releasing the whole resize
44 // lock. The client is not told about this. If called before locking, it will
45 // prevent locking from happening.
46 void UnlockCompositor();
47
48 const gfx::Size& expected_size() const { return expected_size_; }
49
50 private:
51 // ui::CompositorLockClient implementation.
52 void CompositorLockTimedOut() override;
53
54 CompositorResizeLockClient* client_;
55 const gfx::Size expected_size_;
56 std::unique_ptr<ui::CompositorLock> compositor_lock_;
57 bool unlocked_ = false;
58
59 DISALLOW_COPY_AND_ASSIGN(CompositorResizeLock);
60 };
61
62 } // namespace content
63
64 #endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITOR_RESIZE_LOCK_AURA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698