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

Side by Side Diff: components/viz/frame_sinks/mojo_frame_sink_manager.cc

Issue 2795823003: Create //components/viz/frame_sinks and move code. (Closed)
Patch Set: Fix DEPS. Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « components/viz/frame_sinks/mojo_frame_sink_manager.h ('k') | services/ui/gpu/BUILD.gn » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "services/ui/surfaces/mojo_frame_sink_manager.h" 5 #include "components/viz/frame_sinks/mojo_frame_sink_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "cc/base/switches.h" 11 #include "cc/base/switches.h"
12 #include "cc/scheduler/begin_frame_source.h" 12 #include "cc/scheduler/begin_frame_source.h"
13 #include "cc/surfaces/display.h" 13 #include "cc/surfaces/display.h"
14 #include "cc/surfaces/surface_dependency_tracker.h" 14 #include "cc/surfaces/surface_dependency_tracker.h"
15 #include "components/display_compositor/gpu_compositor_frame_sink.h" 15 #include "components/viz/frame_sinks/display_provider.h"
16 #include "components/display_compositor/gpu_root_compositor_frame_sink.h" 16 #include "components/viz/frame_sinks/gpu_compositor_frame_sink.h"
17 #include "services/ui/surfaces/display_provider.h" 17 #include "components/viz/frame_sinks/gpu_root_compositor_frame_sink.h"
18 18
19 namespace ui { 19 namespace viz {
20 20
21 MojoFrameSinkManager::MojoFrameSinkManager( 21 MojoFrameSinkManager::MojoFrameSinkManager(
22 DisplayProvider* display_provider, 22 DisplayProvider* display_provider,
23 cc::mojom::FrameSinkManagerRequest request, 23 cc::mojom::FrameSinkManagerRequest request,
24 cc::mojom::FrameSinkManagerClientPtr client) 24 cc::mojom::FrameSinkManagerClientPtr client)
25 : manager_(cc::SurfaceManager::LifetimeType::REFERENCES), 25 : manager_(cc::SurfaceManager::LifetimeType::REFERENCES),
26 display_provider_(display_provider), 26 display_provider_(display_provider),
27 client_(std::move(client)), 27 client_(std::move(client)),
28 binding_(this, std::move(request)) { 28 binding_(this, std::move(request)) {
29 manager_.AddObserver(this); 29 manager_.AddObserver(this);
(...skipping 24 matching lines...) Expand all
54 // synchronization is enabled. 54 // synchronization is enabled.
55 if (!manager_.dependency_tracker() && 55 if (!manager_.dependency_tracker() &&
56 base::CommandLine::ForCurrentProcess()->HasSwitch( 56 base::CommandLine::ForCurrentProcess()->HasSwitch(
57 cc::switches::kEnableSurfaceSynchronization)) { 57 cc::switches::kEnableSurfaceSynchronization)) {
58 std::unique_ptr<cc::SurfaceDependencyTracker> dependency_tracker( 58 std::unique_ptr<cc::SurfaceDependencyTracker> dependency_tracker(
59 new cc::SurfaceDependencyTracker(&manager_, begin_frame_source.get())); 59 new cc::SurfaceDependencyTracker(&manager_, begin_frame_source.get()));
60 manager_.SetDependencyTracker(std::move(dependency_tracker)); 60 manager_.SetDependencyTracker(std::move(dependency_tracker));
61 } 61 }
62 62
63 compositor_frame_sinks_[frame_sink_id] = 63 compositor_frame_sinks_[frame_sink_id] =
64 base::MakeUnique<display_compositor::GpuRootCompositorFrameSink>( 64 base::MakeUnique<GpuRootCompositorFrameSink>(
65 this, &manager_, frame_sink_id, std::move(display), 65 this, &manager_, frame_sink_id, std::move(display),
66 std::move(begin_frame_source), std::move(request), 66 std::move(begin_frame_source), std::move(request),
67 std::move(private_request), std::move(client), 67 std::move(private_request), std::move(client),
68 std::move(display_private_request)); 68 std::move(display_private_request));
69 } 69 }
70 70
71 void MojoFrameSinkManager::CreateCompositorFrameSink( 71 void MojoFrameSinkManager::CreateCompositorFrameSink(
72 const cc::FrameSinkId& frame_sink_id, 72 const cc::FrameSinkId& frame_sink_id,
73 cc::mojom::MojoCompositorFrameSinkRequest request, 73 cc::mojom::MojoCompositorFrameSinkRequest request,
74 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, 74 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request,
75 cc::mojom::MojoCompositorFrameSinkClientPtr client) { 75 cc::mojom::MojoCompositorFrameSinkClientPtr client) {
76 DCHECK(thread_checker_.CalledOnValidThread()); 76 DCHECK(thread_checker_.CalledOnValidThread());
77 DCHECK_EQ(0u, compositor_frame_sinks_.count(frame_sink_id)); 77 DCHECK_EQ(0u, compositor_frame_sinks_.count(frame_sink_id));
78 78
79 compositor_frame_sinks_[frame_sink_id] = 79 compositor_frame_sinks_[frame_sink_id] =
80 base::MakeUnique<display_compositor::GpuCompositorFrameSink>( 80 base::MakeUnique<GpuCompositorFrameSink>(
81 this, &manager_, frame_sink_id, std::move(request), 81 this, &manager_, frame_sink_id, std::move(request),
82 std::move(private_request), std::move(client)); 82 std::move(private_request), std::move(client));
83 } 83 }
84 84
85 void MojoFrameSinkManager::RegisterFrameSinkHierarchy( 85 void MojoFrameSinkManager::RegisterFrameSinkHierarchy(
86 const cc::FrameSinkId& parent_frame_sink_id, 86 const cc::FrameSinkId& parent_frame_sink_id,
87 const cc::FrameSinkId& child_frame_sink_id) { 87 const cc::FrameSinkId& child_frame_sink_id) {
88 manager_.RegisterFrameSinkHierarchy(parent_frame_sink_id, 88 manager_.RegisterFrameSinkHierarchy(parent_frame_sink_id,
89 child_frame_sink_id); 89 child_frame_sink_id);
90 } 90 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 135
136 void MojoFrameSinkManager::OnPrivateConnectionLost( 136 void MojoFrameSinkManager::OnPrivateConnectionLost(
137 const cc::FrameSinkId& frame_sink_id, 137 const cc::FrameSinkId& frame_sink_id,
138 bool destroy_compositor_frame_sink) { 138 bool destroy_compositor_frame_sink) {
139 DCHECK(thread_checker_.CalledOnValidThread()); 139 DCHECK(thread_checker_.CalledOnValidThread());
140 if (destroy_compositor_frame_sink) 140 if (destroy_compositor_frame_sink)
141 DestroyCompositorFrameSink(frame_sink_id); 141 DestroyCompositorFrameSink(frame_sink_id);
142 } 142 }
143 143
144 } // namespace ui 144 } // namespace viz
OLDNEW
« no previous file with comments | « components/viz/frame_sinks/mojo_frame_sink_manager.h ('k') | services/ui/gpu/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698