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

Unified Diff: ui/compositor/test/fake_context_factory.cc

Issue 2879463002: Initialize RendererSettings in ContextFactory (Closed)
Patch Set: const RendererSettings Created 3 years, 7 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 | « ui/compositor/test/fake_context_factory.h ('k') | ui/compositor/test/in_process_context_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/test/fake_context_factory.cc
diff --git a/ui/compositor/test/fake_context_factory.cc b/ui/compositor/test/fake_context_factory.cc
index a1f4219b75a7724c53ab2dd57ea956d2cb6846e9..cc0cd269da4d2e4a27f7cb10ac17eb94307def61 100644
--- a/ui/compositor/test/fake_context_factory.cc
+++ b/ui/compositor/test/fake_context_factory.cc
@@ -4,15 +4,43 @@
#include "ui/compositor/test/fake_context_factory.h"
+#include "base/command_line.h"
#include "base/threading/thread_task_runner_handle.h"
+#include "cc/base/switches.h"
#include "cc/output/compositor_frame.h"
#include "cc/output/compositor_frame_sink_client.h"
#include "cc/scheduler/begin_frame_source.h"
#include "cc/scheduler/delay_based_time_source.h"
#include "cc/test/fake_compositor_frame_sink.h"
+#include "ui/compositor/compositor_switches.h"
+#include "ui/display/display_switches.h"
+#include "ui/gfx/switches.h"
namespace ui {
+FakeContextFactory::FakeContextFactory() {
+#if defined(OS_WIN)
+ renderer_settings_.finish_rendering_on_resize = true;
+#elif defined(OS_MACOSX)
+ renderer_settings_.release_overlay_resources_after_gpu_query = true;
+#endif
+ // Populate buffer_to_texture_target_map for all buffer usage/formats.
+ for (int usage_idx = 0; usage_idx <= static_cast<int>(gfx::BufferUsage::LAST);
+ ++usage_idx) {
+ gfx::BufferUsage usage = static_cast<gfx::BufferUsage>(usage_idx);
+ for (int format_idx = 0;
+ format_idx <= static_cast<int>(gfx::BufferFormat::LAST);
+ ++format_idx) {
+ gfx::BufferFormat format = static_cast<gfx::BufferFormat>(format_idx);
+ renderer_settings_
+ .buffer_to_texture_target_map[std::make_pair(usage, format)] =
+ GL_TEXTURE_2D;
+ }
+ }
+}
+
+FakeContextFactory::~FakeContextFactory() = default;
+
const cc::CompositorFrame& FakeContextFactory::GetLastCompositorFrame() const {
return *frame_sink_->last_sent_frame();
}
@@ -37,11 +65,6 @@ double FakeContextFactory::GetRefreshRate() const {
return 200.0;
}
-uint32_t FakeContextFactory::GetImageTextureTarget(gfx::BufferFormat format,
- gfx::BufferUsage usage) {
- return GL_TEXTURE_2D;
-}
-
gpu::GpuMemoryBufferManager* FakeContextFactory::GetGpuMemoryBufferManager() {
return &gpu_memory_buffer_manager_;
}
@@ -50,4 +73,8 @@ cc::TaskGraphRunner* FakeContextFactory::GetTaskGraphRunner() {
return &task_graph_runner_;
}
+const cc::RendererSettings& FakeContextFactory::GetRendererSettings() const {
+ return renderer_settings_;
+}
+
} // namespace ui
« no previous file with comments | « ui/compositor/test/fake_context_factory.h ('k') | ui/compositor/test/in_process_context_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698