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

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

Issue 2452483002: Move GpuMemoryBufferManager and SharedBitmapManager to CompositorFrameSink (Closed)
Patch Set: rebase 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
« no previous file with comments | « content/test/fake_compositor_dependencies.cc ('k') | services/ui/demo/bitmap_uploader.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 (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,
332 CompositorDependencies* deps) override { 333 CompositorDependencies* deps) override {
333 // This could override the GpuChannel for a CompositorFrameSink that was 334 // This could override the GpuChannel for a CompositorFrameSink that was
334 // previously being created but in that case the old GpuChannel would be 335 // previously being created but in that case the old GpuChannel would be
335 // lost as would the CompositorFrameSink. 336 // lost as would the CompositorFrameSink.
336 gpu_channel_ = gpu_channel; 337 gpu_channel_ = gpu_channel;
337 338
338 auto* task_runner = deps->GetCompositorImplThreadTaskRunner().get(); 339 auto* task_runner = deps->GetCompositorImplThreadTaskRunner().get();
339 bool synchronous_composite = !task_runner; 340 bool synchronous_composite = !task_runner;
340 if (!task_runner) 341 if (!task_runner)
341 task_runner = base::ThreadTaskRunnerHandle::Get().get(); 342 task_runner = base::ThreadTaskRunnerHandle::Get().get();
342 343
343 cc::LayerTreeSettings settings = 344 cc::LayerTreeSettings settings =
344 RenderWidgetCompositor::GenerateLayerTreeSettings( 345 RenderWidgetCompositor::GenerateLayerTreeSettings(
345 *base::CommandLine::ForCurrentProcess(), deps, 1.f); 346 *base::CommandLine::ForCurrentProcess(), deps, 1.f);
346 347
347 auto compositor_frame_sink = base::MakeUnique<cc::TestCompositorFrameSink>( 348 auto compositor_frame_sink = base::MakeUnique<cc::TestCompositorFrameSink>(
348 std::move(compositor_context_provider), 349 std::move(compositor_context_provider),
349 std::move(worker_context_provider), deps->GetSharedBitmapManager(), 350 std::move(worker_context_provider), nullptr /* shared_bitmap_manager */,
350 deps->GetGpuMemoryBufferManager(), settings.renderer_settings, 351 gpu_memory_buffer_manager, settings.renderer_settings, task_runner,
351 task_runner, synchronous_composite, 352 synchronous_composite, false /* force_disable_reclaim_resources */);
352 false /* force_disable_reclaim_resources */);
353 compositor_frame_sink->SetClient(this); 353 compositor_frame_sink->SetClient(this);
354 compositor_frame_sinks_[routing_id] = compositor_frame_sink.get(); 354 compositor_frame_sinks_[routing_id] = compositor_frame_sink.get();
355 return std::move(compositor_frame_sink); 355 return std::move(compositor_frame_sink);
356 } 356 }
357 357
358 std::unique_ptr<cc::SwapPromise> RequestCopyOfOutput( 358 std::unique_ptr<cc::SwapPromise> RequestCopyOfOutput(
359 int32_t routing_id, 359 int32_t routing_id,
360 std::unique_ptr<cc::CopyOutputRequest> request) override { 360 std::unique_ptr<cc::CopyOutputRequest> request) override {
361 // Note that we can't immediately check compositor_frame_sinks_, since it 361 // 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 362 // 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; 1123 return result;
1124 } 1124 }
1125 1125
1126 void SchedulerRunIdleTasks(const base::Closure& callback) { 1126 void SchedulerRunIdleTasks(const base::Closure& callback) {
1127 blink::scheduler::RendererScheduler* scheduler = 1127 blink::scheduler::RendererScheduler* scheduler =
1128 content::RenderThreadImpl::current()->GetRendererScheduler(); 1128 content::RenderThreadImpl::current()->GetRendererScheduler();
1129 blink::scheduler::RunIdleTasksForTesting(scheduler, callback); 1129 blink::scheduler::RunIdleTasksForTesting(scheduler, callback);
1130 } 1130 }
1131 1131
1132 } // namespace content 1132 } // namespace content
OLDNEW
« no previous file with comments | « content/test/fake_compositor_dependencies.cc ('k') | services/ui/demo/bitmap_uploader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698