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

Side by Side Diff: content/test/layouttest_support.cc

Issue 2452483002: Move GpuMemoryBufferManager and SharedBitmapManager to CompositorFrameSink (Closed)
Patch Set: compile fixes Created 4 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/public/test/layouttest_support.h" 5 #include "content/public/test/layouttest_support.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } // namespace 322 } // namespace
323 323
324 class LayoutTestDependenciesImpl : public LayoutTestDependencies, 324 class LayoutTestDependenciesImpl : public LayoutTestDependencies,
325 public cc::TestCompositorFrameSinkClient { 325 public cc::TestCompositorFrameSinkClient {
326 public: 326 public:
327 std::unique_ptr<cc::CompositorFrameSink> CreateCompositorFrameSink( 327 std::unique_ptr<cc::CompositorFrameSink> CreateCompositorFrameSink(
328 int32_t routing_id, 328 int32_t routing_id,
329 scoped_refptr<gpu::GpuChannelHost> gpu_channel, 329 scoped_refptr<gpu::GpuChannelHost> gpu_channel,
330 scoped_refptr<cc::ContextProvider> compositor_context_provider, 330 scoped_refptr<cc::ContextProvider> compositor_context_provider,
331 scoped_refptr<cc::ContextProvider> worker_context_provider, 331 scoped_refptr<cc::ContextProvider> worker_context_provider,
332 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
333 cc::SharedBitmapManager* shared_bitmap_manager,
danakj 2016/10/27 21:00:34 layout tests are never software, so no need for SB
piman 2016/10/28 00:58:36 Done.
332 CompositorDependencies* deps) override { 334 CompositorDependencies* deps) override {
333 // This could override the GpuChannel for a CompositorFrameSink that was 335 // This could override the GpuChannel for a CompositorFrameSink that was
334 // previously being created but in that case the old GpuChannel would be 336 // previously being created but in that case the old GpuChannel would be
335 // lost as would the CompositorFrameSink. 337 // lost as would the CompositorFrameSink.
336 gpu_channel_ = gpu_channel; 338 gpu_channel_ = gpu_channel;
337 339
338 auto* task_runner = deps->GetCompositorImplThreadTaskRunner().get(); 340 auto* task_runner = deps->GetCompositorImplThreadTaskRunner().get();
339 bool synchronous_composite = !task_runner; 341 bool synchronous_composite = !task_runner;
340 if (!task_runner) 342 if (!task_runner)
341 task_runner = base::ThreadTaskRunnerHandle::Get().get(); 343 task_runner = base::ThreadTaskRunnerHandle::Get().get();
342 344
343 cc::LayerTreeSettings settings = 345 cc::LayerTreeSettings settings =
344 RenderWidgetCompositor::GenerateLayerTreeSettings( 346 RenderWidgetCompositor::GenerateLayerTreeSettings(
345 *base::CommandLine::ForCurrentProcess(), deps, 1.f); 347 *base::CommandLine::ForCurrentProcess(), deps, 1.f);
346 348
347 auto compositor_frame_sink = base::MakeUnique<cc::TestCompositorFrameSink>( 349 auto compositor_frame_sink = base::MakeUnique<cc::TestCompositorFrameSink>(
348 std::move(compositor_context_provider), 350 std::move(compositor_context_provider),
349 std::move(worker_context_provider), deps->GetSharedBitmapManager(), 351 std::move(worker_context_provider), shared_bitmap_manager,
350 deps->GetGpuMemoryBufferManager(), settings.renderer_settings, 352 gpu_memory_buffer_manager, settings.renderer_settings, task_runner,
351 task_runner, synchronous_composite, 353 synchronous_composite, false /* force_disable_reclaim_resources */);
352 false /* force_disable_reclaim_resources */);
353 compositor_frame_sink->SetClient(this); 354 compositor_frame_sink->SetClient(this);
354 compositor_frame_sinks_[routing_id] = compositor_frame_sink.get(); 355 compositor_frame_sinks_[routing_id] = compositor_frame_sink.get();
355 return std::move(compositor_frame_sink); 356 return std::move(compositor_frame_sink);
356 } 357 }
357 358
358 std::unique_ptr<cc::SwapPromise> RequestCopyOfOutput( 359 std::unique_ptr<cc::SwapPromise> RequestCopyOfOutput(
359 int32_t routing_id, 360 int32_t routing_id,
360 std::unique_ptr<cc::CopyOutputRequest> request) override { 361 std::unique_ptr<cc::CopyOutputRequest> request) override {
361 // Note that we can't immediately check compositor_frame_sinks_, since it 362 // Note that we can't immediately check compositor_frame_sinks_, since it
362 // may not have been created yet. Instead, we wait until OnCommit to find 363 // may not have been created yet. Instead, we wait until OnCommit to find
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 return result; 1124 return result;
1124 } 1125 }
1125 1126
1126 void SchedulerRunIdleTasks(const base::Closure& callback) { 1127 void SchedulerRunIdleTasks(const base::Closure& callback) {
1127 blink::scheduler::RendererScheduler* scheduler = 1128 blink::scheduler::RendererScheduler* scheduler =
1128 content::RenderThreadImpl::current()->GetRendererScheduler(); 1129 content::RenderThreadImpl::current()->GetRendererScheduler();
1129 blink::scheduler::RunIdleTasksForTesting(scheduler, callback); 1130 blink::scheduler::RunIdleTasksForTesting(scheduler, callback);
1130 } 1131 }
1131 1132
1132 } // namespace content 1133 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698