Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / renderer / gpu / queue_message_swap_promise.h
blobe0fcf8c69f048e7855217628d758abe6a595cce1
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.
5 #ifndef CONTENT_RENDERER_GPU_QUEUE_MESSAGE_SWAP_PROMISE_H_
6 #define CONTENT_RENDERER_GPU_QUEUE_MESSAGE_SWAP_PROMISE_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "cc/output/swap_promise.h"
12 namespace IPC {
13 class SyncMessageFilter;
16 namespace content {
18 class FrameSwapMessageQueue;
20 class QueueMessageSwapPromise : public cc::SwapPromise {
21 public:
22 QueueMessageSwapPromise(scoped_refptr<IPC::SyncMessageFilter> message_sender,
23 scoped_refptr<FrameSwapMessageQueue> message_queue,
24 int source_frame_number);
26 ~QueueMessageSwapPromise() override;
28 void DidSwap(cc::CompositorFrameMetadata* metadata) override;
30 void DidNotSwap(DidNotSwapReason reason) override;
32 int64 TraceId() const override;
34 private:
35 void PromiseCompleted();
37 scoped_refptr<IPC::SyncMessageFilter> message_sender_;
38 scoped_refptr<content::FrameSwapMessageQueue> message_queue_;
39 int source_frame_number_;
40 #if DCHECK_IS_ON()
41 bool completed_;
42 #endif
45 } // namespace content
47 #endif // CONTENT_RENDERER_GPU_QUEUE_MESSAGE_SWAP_PROMISE_H_