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

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

Issue 2773433003: Fix CompositorResizeLock to do something. (Closed)
Patch Set: resizelock: observer-rebase Created 3 years, 8 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 #include "content/browser/renderer_host/compositor_resize_lock.h"
6
7 #include "base/trace_event/trace_event.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "ui/compositor/compositor.h"
10
11 namespace content {
12
13 CompositorResizeLock::CompositorResizeLock(CompositorResizeLockClient* client,
14 const gfx::Size& new_size)
15 : client_(client), expected_size_(new_size) {
16 TRACE_EVENT_ASYNC_BEGIN2("ui", "CompositorResizeLock", this, "width",
17 expected_size().width(), "height",
18 expected_size().height());
19 }
20
21 CompositorResizeLock::~CompositorResizeLock() {
22 compositor_lock_ = nullptr;
23 if (client_)
24 client_->CompositorResizeLockEnded();
25
26 TRACE_EVENT_ASYNC_END2("ui", "CompositorResizeLock", this, "width",
27 expected_size().width(), "height",
28 expected_size().height());
29 }
30
31 bool CompositorResizeLock::Lock() {
32 if (unlocked_ || compositor_lock_)
33 return false;
34 compositor_lock_ = client_->GetCompositorLock(this);
35 return true;
36 }
37
38 void CompositorResizeLock::UnlockCompositor() {
39 unlocked_ = true;
40 compositor_lock_ = nullptr;
41 }
42
43 void CompositorResizeLock::CompositorLockTimedOut() {
44 UnlockCompositor();
45 if (client_) {
46 client_->CompositorResizeLockEnded();
47 client_ = nullptr;
48 }
49 }
50
51 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/compositor_resize_lock.h ('k') | content/browser/renderer_host/compositor_resize_lock_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698