Update V8 to version 4.7.42.
[chromium-blink-merge.git] / cc / trees / swap_promise_monitor.h
blobd163af58df3266ccafe24694f341bcd61bf6b9e5
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.
5 #ifndef CC_TREES_SWAP_PROMISE_MONITOR_H_
6 #define CC_TREES_SWAP_PROMISE_MONITOR_H_
8 #include "cc/base/cc_export.h"
10 namespace cc {
12 class LayerTreeHost;
13 class LayerTreeHostImpl;
15 // A SwapPromiseMonitor is used to monitor compositor state change that
16 // should be associated with a SwapPromise, e.g. SetNeedsCommit() is
17 // called on main thread or SetNeedsRedraw() is called on impl thread.
18 // Creating a SwapPromiseMonitor will insert itself into a LayerTreeHost
19 // or LayerTreeHostImpl. You must provide a pointer to the appropriate
20 // structure to the monitor (and only one of the two). Notification of
21 // compositor state change will be sent through OnSetNeedsCommitOnMain()
22 // or OnSetNeedsRedrawOnImpl(). When SwapPromiseMonitor is destroyed, it
23 // will unregister itself from LayerTreeHost or LayerTreeHostImpl.
24 class CC_EXPORT SwapPromiseMonitor {
25 public:
26 // If the monitor lives on the main thread, pass in layer_tree_host
27 // and set layer_tree_host_impl to nullptr.
28 // If the monitor lives on the impl thread, pass in layer_tree_host_impl
29 // and set layer_tree_host to nullptr.
30 SwapPromiseMonitor(LayerTreeHost* layer_tree_host,
31 LayerTreeHostImpl* layer_tree_host_impl);
32 virtual ~SwapPromiseMonitor();
34 virtual void OnSetNeedsCommitOnMain() = 0;
35 virtual void OnSetNeedsRedrawOnImpl() = 0;
36 virtual void OnForwardScrollUpdateToMainThreadOnImpl() = 0;
38 protected:
39 LayerTreeHost* layer_tree_host_;
40 LayerTreeHostImpl* layer_tree_host_impl_;
43 } // namespace cc
45 #endif // CC_TREES_SWAP_PROMISE_MONITOR_H_