OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/display_compositor.h" | 5 #include "services/ui/surfaces/display_compositor.h" |
6 | 6 |
7 #include "cc/output/copy_output_request.h" | 7 #include "cc/output/copy_output_request.h" |
8 #include "cc/output/output_surface.h" | 8 #include "cc/output/output_surface.h" |
9 #include "cc/output/renderer_settings.h" | 9 #include "cc/output/renderer_settings.h" |
10 #include "cc/output/texture_mailbox_deleter.h" | 10 #include "cc/output/texture_mailbox_deleter.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 surfaces_state_->manager()->RegisterSurfaceFactoryClient( | 36 surfaces_state_->manager()->RegisterSurfaceFactoryClient( |
37 allocator_.client_id(), this); | 37 allocator_.client_id(), this); |
38 | 38 |
39 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = | 39 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager = |
40 gpu_channel->gpu_memory_buffer_manager(); | 40 gpu_channel->gpu_memory_buffer_manager(); |
41 scoped_refptr<SurfacesContextProvider> surfaces_context_provider( | 41 scoped_refptr<SurfacesContextProvider> surfaces_context_provider( |
42 new SurfacesContextProvider(widget, std::move(gpu_channel))); | 42 new SurfacesContextProvider(widget, std::move(gpu_channel))); |
43 // TODO(rjkroege): If there is something better to do than CHECK, add it. | 43 // TODO(rjkroege): If there is something better to do than CHECK, add it. |
44 CHECK(surfaces_context_provider->BindToCurrentThread()); | 44 CHECK(surfaces_context_provider->BindToCurrentThread()); |
45 | 45 |
46 synthetic_begin_frame_source_.reset(new cc::DelayBasedBeginFrameSource( | 46 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source( |
47 base::MakeUnique<cc::DelayBasedTimeSource>(task_runner_.get()))); | 47 new cc::DelayBasedBeginFrameSource( |
| 48 base::MakeUnique<cc::DelayBasedTimeSource>(task_runner_.get()))); |
48 | 49 |
49 std::unique_ptr<cc::OutputSurface> display_output_surface; | 50 std::unique_ptr<cc::OutputSurface> display_output_surface; |
50 if (surfaces_context_provider->ContextCapabilities().surfaceless) { | 51 if (surfaces_context_provider->ContextCapabilities().surfaceless) { |
51 #if defined(USE_OZONE) | 52 #if defined(USE_OZONE) |
52 display_output_surface = base::MakeUnique<DirectOutputSurfaceOzone>( | 53 display_output_surface = base::MakeUnique<DirectOutputSurfaceOzone>( |
53 surfaces_context_provider, widget, synthetic_begin_frame_source_.get(), | 54 surfaces_context_provider, widget, synthetic_begin_frame_source.get(), |
54 gpu_memory_buffer_manager, GL_TEXTURE_2D, GL_RGB); | 55 gpu_memory_buffer_manager, GL_TEXTURE_2D, GL_RGB); |
55 #else | 56 #else |
56 NOTREACHED(); | 57 NOTREACHED(); |
57 #endif | 58 #endif |
58 } else { | 59 } else { |
59 display_output_surface = base::MakeUnique<DirectOutputSurface>( | 60 display_output_surface = base::MakeUnique<DirectOutputSurface>( |
60 surfaces_context_provider, synthetic_begin_frame_source_.get()); | 61 surfaces_context_provider, synthetic_begin_frame_source.get()); |
61 } | 62 } |
62 | 63 |
63 int max_frames_pending = | 64 int max_frames_pending = |
64 display_output_surface->capabilities().max_frames_pending; | 65 display_output_surface->capabilities().max_frames_pending; |
65 DCHECK_GT(max_frames_pending, 0); | 66 DCHECK_GT(max_frames_pending, 0); |
66 | 67 |
67 std::unique_ptr<cc::DisplayScheduler> scheduler( | 68 std::unique_ptr<cc::DisplayScheduler> scheduler( |
68 new cc::DisplayScheduler(synthetic_begin_frame_source_.get(), | 69 new cc::DisplayScheduler(synthetic_begin_frame_source.get(), |
69 task_runner_.get(), max_frames_pending)); | 70 task_runner_.get(), max_frames_pending)); |
70 | 71 |
71 display_.reset(new cc::Display( | 72 display_.reset(new cc::Display( |
72 nullptr /* bitmap_manager */, gpu_memory_buffer_manager, | 73 nullptr /* bitmap_manager */, gpu_memory_buffer_manager, |
73 cc::RendererSettings(), synthetic_begin_frame_source_.get(), | 74 cc::RendererSettings(), std::move(synthetic_begin_frame_source), |
74 std::move(display_output_surface), std::move(scheduler), | 75 std::move(display_output_surface), std::move(scheduler), |
75 base::MakeUnique<cc::TextureMailboxDeleter>(task_runner_.get()))); | 76 base::MakeUnique<cc::TextureMailboxDeleter>(task_runner_.get()))); |
76 display_->Initialize(this, surfaces_state_->manager(), | 77 display_->Initialize(this, surfaces_state_->manager(), |
77 allocator_.client_id()); | 78 allocator_.client_id()); |
78 display_->SetVisible(true); | 79 display_->SetVisible(true); |
79 } | 80 } |
80 | 81 |
81 DisplayCompositor::~DisplayCompositor() { | 82 DisplayCompositor::~DisplayCompositor() { |
82 surfaces_state_->manager()->UnregisterSurfaceFactoryClient( | 83 surfaces_state_->manager()->UnregisterSurfaceFactoryClient( |
83 allocator_.client_id()); | 84 allocator_.client_id()); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // This notification is not relevant to our client outside of tests. | 132 // This notification is not relevant to our client outside of tests. |
132 } | 133 } |
133 | 134 |
134 void DisplayCompositor::DisplayDidDrawAndSwap() { | 135 void DisplayCompositor::DisplayDidDrawAndSwap() { |
135 // This notification is not relevant to our client outside of tests. We | 136 // This notification is not relevant to our client outside of tests. We |
136 // unblock the client from the DrawCallback when the surface is going to | 137 // unblock the client from the DrawCallback when the surface is going to |
137 // be drawn. | 138 // be drawn. |
138 } | 139 } |
139 | 140 |
140 } // namespace ui | 141 } // namespace ui |
OLD | NEW |