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

Side by Side Diff: cc/test/fake_external_begin_frame_source.cc

Issue 1533773002: Delete CC. (Closed) Base URL: git@github.com:domokit/mojo.git@cl-2e
Patch Set: rebase Created 5 years 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
« no previous file with comments | « cc/test/fake_external_begin_frame_source.h ('k') | cc/test/fake_output_surface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #include "cc/test/fake_external_begin_frame_source.h"
6
7 #include "base/location.h"
8 #include "base/message_loop/message_loop.h"
9 #include "base/time/time.h"
10 #include "cc/test/begin_frame_args_test.h"
11
12 namespace cc {
13
14 FakeExternalBeginFrameSource::FakeExternalBeginFrameSource(double refresh_rate)
15 : milliseconds_per_frame_(1000.0 / refresh_rate),
16 is_ready_(false),
17 weak_ptr_factory_(this) {
18 DetachFromThread();
19 }
20
21 FakeExternalBeginFrameSource::~FakeExternalBeginFrameSource() {
22 DCHECK(CalledOnValidThread());
23 }
24
25 void FakeExternalBeginFrameSource::SetClientReady() {
26 DCHECK(CalledOnValidThread());
27 is_ready_ = true;
28 }
29
30 void FakeExternalBeginFrameSource::OnNeedsBeginFramesChange(
31 bool needs_begin_frames) {
32 DCHECK(CalledOnValidThread());
33 if (needs_begin_frames) {
34 PostTestOnBeginFrame();
35 }
36 }
37
38 void FakeExternalBeginFrameSource::TestOnBeginFrame() {
39 DCHECK(CalledOnValidThread());
40 CallOnBeginFrame(CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE));
41
42 if (NeedsBeginFrames()) {
43 PostTestOnBeginFrame();
44 }
45 }
46
47 void FakeExternalBeginFrameSource::PostTestOnBeginFrame() {
48 base::MessageLoop::current()->PostDelayedTask(
49 FROM_HERE, base::Bind(&FakeExternalBeginFrameSource::TestOnBeginFrame,
50 weak_ptr_factory_.GetWeakPtr()),
51 base::TimeDelta::FromMilliseconds(milliseconds_per_frame_));
52 }
53
54 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_external_begin_frame_source.h ('k') | cc/test/fake_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698