blob: 84d8a9feb941c61bf19ac1de26fd8c5fa876c609 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/logging.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_host_impl.h"
#include "cc/trees/swap_promise_monitor.h"
namespace cc {
SwapPromiseMonitor::SwapPromiseMonitor(LayerTreeHost* layer_tree_host,
LayerTreeHostImpl* layer_tree_host_impl)
: layer_tree_host_(layer_tree_host),
layer_tree_host_impl_(layer_tree_host_impl) {
DCHECK((layer_tree_host && !layer_tree_host_impl) ||
(!layer_tree_host && layer_tree_host_impl));
if (layer_tree_host_)
layer_tree_host_->InsertSwapPromiseMonitor(this);
if (layer_tree_host_impl_)
layer_tree_host_impl_->InsertSwapPromiseMonitor(this);
}
SwapPromiseMonitor::~SwapPromiseMonitor() {
if (layer_tree_host_)
layer_tree_host_->RemoveSwapPromiseMonitor(this);
if (layer_tree_host_impl_)
layer_tree_host_impl_->RemoveSwapPromiseMonitor(this);
}
} // namespace cc
|