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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/fake_output_surface_client.cc
diff --git a/cc/test/fake_output_surface_client.cc b/cc/test/fake_output_surface_client.cc
index 6fabdf87d8a541532d01bd23dd3563d6f5e198f5..fdc3c46a6f059dd49de18265400269175e47a544 100644
--- a/cc/test/fake_output_surface_client.cc
+++ b/cc/test/fake_output_surface_client.cc
@@ -6,6 +6,22 @@
#include "cc/test/fake_output_surface_client.h"
namespace cc {
+FakeOutputSurfaceClient::FakeOutputSurfaceClient()
+ : output_surface_(NULL),
+ begin_frame_count_(0),
+ deferred_initialize_called_(false),
+ did_lose_output_surface_called_(false),
+ memory_policy_(0) {
+}
+
+FakeOutputSurfaceClient::FakeOutputSurfaceClient(OutputSurface* output_surface)
+ : output_surface_(output_surface),
+ begin_frame_count_(0),
+ deferred_initialize_called_(false),
+ did_lose_output_surface_called_(false),
+ memory_policy_(0) {
+ output_surface_->AddObserver(this);
+}
void FakeOutputSurfaceClient::DeferredInitialize() {
deferred_initialize_called_ = true;
@@ -16,10 +32,15 @@ void FakeOutputSurfaceClient::ReleaseGL() {
output_surface_->ReleaseContextProvider();
}
-void FakeOutputSurfaceClient::BeginFrame(const BeginFrameArgs& args) {
+void FakeOutputSurfaceClient::OnBeginFrame(const BeginFrameArgs& args) {
+ last_begin_frame_args_ = args;
begin_frame_count_++;
}
+const BeginFrameArgs& FakeOutputSurfaceClient::LastBeginFrameArgs() const {
+ return last_begin_frame_args_;
+}
+
void FakeOutputSurfaceClient::DidLoseOutputSurface() {
did_lose_output_surface_called_ = true;
}
@@ -29,4 +50,19 @@ void FakeOutputSurfaceClient::SetMemoryPolicy(
memory_policy_ = policy;
}
+void FakeOutputSurfaceClient::AsValueInto(
+ base::debug::TracedValue* dict) const {
+ dict->SetString("type", "FakeOutputSurfaceClient");
+ dict->SetInteger("begin_frame_count_", begin_frame_count_);
+ dict->BeginDictionary("last_begin_frame_args_");
+ last_begin_frame_args_.AsValueInto(dict);
+ dict->EndDictionary();
+ dict->SetBoolean("deferred_initialize_called_", deferred_initialize_called_);
+ dict->SetBoolean("did_lose_output_surface_called_",
+ did_lose_output_surface_called_);
+ dict->BeginDictionary("memory_policy_");
+ memory_policy_.AsValueInto(dict);
+ dict->EndDictionary();
+}
+
} // namespace cc
« 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