diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-28 08:10:43 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-28 08:10:43 +0000 |
commit | b5174d716dc307a1b160f571d67edfbe16b9bd35 (patch) | |
tree | f604305bb848fbe78e067f6f3ec87f640e69a446 /cc/test/pixel_test.cc | |
parent | ebc16006305a09c27f2b9ec006f6e4fc78667e1a (diff) | |
download | chromium_src-b5174d716dc307a1b160f571d67edfbe16b9bd35.zip chromium_src-b5174d716dc307a1b160f571d67edfbe16b9bd35.tar.gz chromium_src-b5174d716dc307a1b160f571d67edfbe16b9bd35.tar.bz2 |
cc: Cleanup offscreen context plumbing.
When I added offscreen context provider, I plumbed it to the renderers
through the ResourceProvider. This was a bad idea, and using the
ResourceProvider as a suitcase for plumbing stuff is poor practice.
Secondly, we have a funny round trip from LayerTreeHostImpl to
ThreadProxy::DidTryInitializeRendererOnImplThread which just
goes back through the LayerTreeHostImpl to set the offscreen
contexts.
This patch removes the offscreen ContextProvider from the
ResourceProvider and the removes the DidTryInitializeRendererOnImplThread
method from ThreadProxy. Instead we have SetOffscreenContextProvider()
on the LayerTreeHostImpl, and the LTHI owns the provider and gives
it directly to the renderer for each frame. The renderer holds onto the
provider only while drawing its frame.
While we're at it, make pixel tests faster (~20ms or 10% on my z620) by
only making an offscreen context for tests that want one.
Discussion around this CL also led me to the conclusion that
RendererClient is evil and we should pass things directly into
the Renderer rather than have it call out for them.
R=boliu, piman
BUG=
Review URL: https://chromiumcodereview.appspot.com/23660002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219962 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/pixel_test.cc')
-rw-r--r-- | cc/test/pixel_test.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc index dffe378..73c4437 100644 --- a/cc/test/pixel_test.cc +++ b/cc/test/pixel_test.cc @@ -89,10 +89,12 @@ PixelTest::PixelTest() PixelTest::~PixelTest() {} bool PixelTest::RunPixelTest(RenderPassList* pass_list, + OffscreenContextOption provide_offscreen_context, const base::FilePath& ref_file, const PixelComparator& comparator) { return RunPixelTestWithReadbackTarget(pass_list, pass_list->back(), + provide_offscreen_context, ref_file, comparator); } @@ -100,6 +102,7 @@ bool PixelTest::RunPixelTest(RenderPassList* pass_list, bool PixelTest::RunPixelTestWithReadbackTarget( RenderPassList* pass_list, RenderPass* target, + OffscreenContextOption provide_offscreen_context, const base::FilePath& ref_file, const PixelComparator& comparator) { base::RunLoop run_loop; @@ -109,8 +112,19 @@ bool PixelTest::RunPixelTestWithReadbackTarget( base::Unretained(this), run_loop.QuitClosure()))); + scoped_refptr<webkit::gpu::ContextProviderInProcess> offscreen_contexts; + switch (provide_offscreen_context) { + case NoOffscreenContext: + break; + case WithOffscreenContext: + offscreen_contexts = + webkit::gpu::ContextProviderInProcess::CreateOffscreen(); + CHECK(offscreen_contexts->BindToCurrentThread()); + break; + } + renderer_->DecideRenderPassAllocationsForFrame(*pass_list); - renderer_->DrawFrame(pass_list); + renderer_->DrawFrame(pass_list, offscreen_contexts.get()); // Wait for the readback to complete. resource_provider_->Finish(); @@ -159,11 +173,6 @@ void PixelTest::SetUpGLRenderer(bool use_skia_gpu_backend) { resource_provider_.get(), 0, use_skia_gpu_backend).PassAs<DirectRenderer>(); - - scoped_refptr<webkit::gpu::ContextProviderInProcess> offscreen_contexts = - webkit::gpu::ContextProviderInProcess::CreateOffscreen(); - ASSERT_TRUE(offscreen_contexts->BindToCurrentThread()); - resource_provider_->set_offscreen_context_provider(offscreen_contexts); } void PixelTest::ForceExpandedViewport(gfx::Size surface_expansion, |