OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 "cc/test/fake_remote_compositor_bridge.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "base/logging.h" | |
9 #include "base/single_thread_task_runner.h" | |
10 #include "cc/blimp/remote_compositor_bridge_client.h" | |
11 | |
12 namespace cc { | |
13 | |
14 FakeRemoteCompositorBridge::FakeRemoteCompositorBridge( | |
15 scoped_refptr<base::SingleThreadTaskRunner> compositor_main_task_runner) | |
16 : RemoteCompositorBridge(std::move(compositor_main_task_runner)), | |
17 client_(nullptr), | |
18 weak_factory_(this) {} | |
19 | |
20 FakeRemoteCompositorBridge::~FakeRemoteCompositorBridge() {} | |
21 | |
22 void FakeRemoteCompositorBridge::BindToClient( | |
23 RemoteCompositorBridgeClient* client) { | |
24 DCHECK(!client_); | |
25 client_ = client; | |
26 } | |
27 | |
28 void FakeRemoteCompositorBridge::ScheduleMainFrame() { | |
29 DCHECK(!has_pending_update_); | |
30 has_pending_update_ = true; | |
31 | |
32 compositor_main_task_runner_->PostTask( | |
33 FROM_HERE, base::Bind(&FakeRemoteCompositorBridge::BeginMainFrame, | |
34 weak_factory_.GetWeakPtr())); | |
35 } | |
36 | |
37 void FakeRemoteCompositorBridge::BeginMainFrame() { | |
38 DCHECK(has_pending_update_); | |
39 has_pending_update_ = false; | |
40 | |
41 client_->BeginMainFrame(); | |
42 } | |
43 | |
44 } // namespace cc | |
OLD | NEW |