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

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

Issue 577643002: Making OutputSurface a begin frame source and vsync source. (Closed)
Patch Set: Created 6 years, 3 months 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_output_surface_client.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/output_surface.h" 5 #include "cc/output/output_surface.h"
6 #include "cc/test/fake_output_surface_client.h" 6 #include "cc/test/fake_output_surface_client.h"
7 7
8 namespace cc { 8 namespace cc {
9 FakeOutputSurfaceClient::FakeOutputSurfaceClient()
10 : output_surface_(NULL),
11 begin_frame_count_(0),
12 deferred_initialize_called_(false),
13 did_lose_output_surface_called_(false),
14 memory_policy_(0) {
15 }
16
17 FakeOutputSurfaceClient::FakeOutputSurfaceClient(OutputSurface* output_surface)
18 : output_surface_(output_surface),
19 begin_frame_count_(0),
20 deferred_initialize_called_(false),
21 did_lose_output_surface_called_(false),
22 memory_policy_(0) {
23 output_surface_->AddObserver(this);
24 }
9 25
10 void FakeOutputSurfaceClient::DeferredInitialize() { 26 void FakeOutputSurfaceClient::DeferredInitialize() {
11 deferred_initialize_called_ = true; 27 deferred_initialize_called_ = true;
12 } 28 }
13 29
14 void FakeOutputSurfaceClient::ReleaseGL() { 30 void FakeOutputSurfaceClient::ReleaseGL() {
15 if (output_surface_) 31 if (output_surface_)
16 output_surface_->ReleaseContextProvider(); 32 output_surface_->ReleaseContextProvider();
17 } 33 }
18 34
19 void FakeOutputSurfaceClient::BeginFrame(const BeginFrameArgs& args) { 35 void FakeOutputSurfaceClient::OnBeginFrame(const BeginFrameArgs& args) {
36 last_begin_frame_args_ = args;
20 begin_frame_count_++; 37 begin_frame_count_++;
21 } 38 }
22 39
40 const BeginFrameArgs& FakeOutputSurfaceClient::LastBeginFrameArgs() const {
41 return last_begin_frame_args_;
42 }
43
23 void FakeOutputSurfaceClient::DidLoseOutputSurface() { 44 void FakeOutputSurfaceClient::DidLoseOutputSurface() {
24 did_lose_output_surface_called_ = true; 45 did_lose_output_surface_called_ = true;
25 } 46 }
26 47
27 void FakeOutputSurfaceClient::SetMemoryPolicy( 48 void FakeOutputSurfaceClient::SetMemoryPolicy(
28 const ManagedMemoryPolicy& policy) { 49 const ManagedMemoryPolicy& policy) {
29 memory_policy_ = policy; 50 memory_policy_ = policy;
30 } 51 }
31 52
53 void FakeOutputSurfaceClient::AsValueInto(
54 base::debug::TracedValue* dict) const {
55 dict->SetString("type", "FakeOutputSurfaceClient");
56 dict->SetInteger("begin_frame_count_", begin_frame_count_);
57 dict->BeginDictionary("last_begin_frame_args_");
58 last_begin_frame_args_.AsValueInto(dict);
59 dict->EndDictionary();
60 dict->SetBoolean("deferred_initialize_called_", deferred_initialize_called_);
61 dict->SetBoolean("did_lose_output_surface_called_",
62 did_lose_output_surface_called_);
63 dict->BeginDictionary("memory_policy_");
64 memory_policy_.AsValueInto(dict);
65 dict->EndDictionary();
66 }
67
32 } // namespace cc 68 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_output_surface_client.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698