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

Side by Side Diff: ui/compositor/compositor_lock.cc

Issue 2773433003: Fix CompositorResizeLock to do something. (Closed)
Patch Set: resizelock: timeoutparam 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 2017 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 "ui/compositor/compositor_lock.h"
6
7 #include "base/bind.h"
8 #include "base/sequenced_task_runner.h"
9 #include "base/task_runner.h"
10 #include "ui/compositor/compositor.h"
11
12 namespace ui {
13
14 CompositorLock::CompositorLock(CompositorLockClient* client,
15 CompositorLockDelegate* delegate,
16 base::SequencedTaskRunner* task_runner,
17 base::TimeDelta timeout)
18 : client_(client), delegate_(std::move(delegate)), weak_ptr_factory_(this) {
19 if (!timeout.is_zero()) {
20 task_runner->PostDelayedTask(FROM_HERE,
21 base::Bind(&CompositorLock::TimeoutLock,
22 weak_ptr_factory_.GetWeakPtr()),
23 timeout);
24 }
25 }
26
27 CompositorLock::~CompositorLock() {
28 if (delegate_)
29 delegate_->DoUnlockCompositor();
30 }
31
32 void CompositorLock::TimeoutLock() {
33 delegate_->DoUnlockCompositor();
34 delegate_ = nullptr;
35 if (client_)
36 client_->CompositorLockTimedOut();
37 }
38
39 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698