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 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source( | 46 synthetic_begin_frame_source_.reset(new cc::DelayBasedBeginFrameSource( |
47 new cc::DelayBasedBeginFrameSource( | 47 base::MakeUnique<cc::DelayBasedTimeSource>(task_runner_.get()))); |
48 base::MakeUnique<cc::DelayBasedTimeSource>(task_runner_.get()))); | |
49 | 48 |
50 std::unique_ptr<cc::OutputSurface> display_output_surface; | 49 std::unique_ptr<cc::OutputSurface> display_output_surface; |
51 if (surfaces_context_provider->ContextCapabilities().surfaceless) { | 50 if (surfaces_context_provider->ContextCapabilities().surfaceless) { |
52 #if defined(USE_OZONE) | 51 #if defined(USE_OZONE) |
53 display_output_surface = base::MakeUnique<DirectOutputSurfaceOzone>( | 52 display_output_surface = base::MakeUnique<DirectOutputSurfaceOzone>( |
54 surfaces_context_provider, widget, synthetic_begin_frame_source.get(), | 53 surfaces_context_provider, widget, synthetic_begin_frame_source_.get(), |
55 gpu_memory_buffer_manager, GL_TEXTURE_2D, GL_RGB); | 54 gpu_memory_buffer_manager, GL_TEXTURE_2D, GL_RGB); |
56 #else | 55 #else |
57 NOTREACHED(); | 56 NOTREACHED(); |
58 #endif | 57 #endif |
59 } else { | 58 } else { |
60 display_output_surface = base::MakeUnique<DirectOutputSurface>( | 59 display_output_surface = base::MakeUnique<DirectOutputSurface>( |
61 surfaces_context_provider, synthetic_begin_frame_source.get()); | 60 surfaces_context_provider, synthetic_begin_frame_source_.get()); |
62 } | 61 } |
63 | 62 |
64 int max_frames_pending = | 63 int max_frames_pending = |
65 display_output_surface->capabilities().max_frames_pending; | 64 display_output_surface->capabilities().max_frames_pending; |
66 DCHECK_GT(max_frames_pending, 0); | 65 DCHECK_GT(max_frames_pending, 0); |
67 | 66 |
68 std::unique_ptr<cc::DisplayScheduler> scheduler( | 67 std::unique_ptr<cc::DisplayScheduler> scheduler( |
69 new cc::DisplayScheduler(synthetic_begin_frame_source.get(), | 68 new cc::DisplayScheduler(synthetic_begin_frame_source_.get(), |
70 task_runner_.get(), max_frames_pending)); | 69 task_runner_.get(), max_frames_pending)); |
71 | 70 |
72 display_.reset(new cc::Display( | 71 display_.reset(new cc::Display( |
73 nullptr /* bitmap_manager */, gpu_memory_buffer_manager, | 72 nullptr /* bitmap_manager */, gpu_memory_buffer_manager, |
74 cc::RendererSettings(), std::move(synthetic_begin_frame_source), | 73 cc::RendererSettings(), synthetic_begin_frame_source_.get(), |
75 std::move(display_output_surface), std::move(scheduler), | 74 std::move(display_output_surface), std::move(scheduler), |
76 base::MakeUnique<cc::TextureMailboxDeleter>(task_runner_.get()))); | 75 base::MakeUnique<cc::TextureMailboxDeleter>(task_runner_.get()))); |
77 display_->Initialize(this, surfaces_state_->manager(), | 76 display_->Initialize(this, surfaces_state_->manager(), |
78 allocator_.client_id()); | 77 allocator_.client_id()); |
79 display_->SetVisible(true); | 78 display_->SetVisible(true); |
80 } | 79 } |
81 | 80 |
82 DisplayCompositor::~DisplayCompositor() { | 81 DisplayCompositor::~DisplayCompositor() { |
83 surfaces_state_->manager()->UnregisterSurfaceFactoryClient( | 82 surfaces_state_->manager()->UnregisterSurfaceFactoryClient( |
84 allocator_.client_id()); | 83 allocator_.client_id()); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // This notification is not relevant to our client outside of tests. | 131 // This notification is not relevant to our client outside of tests. |
133 } | 132 } |
134 | 133 |
135 void DisplayCompositor::DisplayDidDrawAndSwap() { | 134 void DisplayCompositor::DisplayDidDrawAndSwap() { |
136 // This notification is not relevant to our client outside of tests. We | 135 // This notification is not relevant to our client outside of tests. We |
137 // unblock the client from the DrawCallback when the surface is going to | 136 // unblock the client from the DrawCallback when the surface is going to |
138 // be drawn. | 137 // be drawn. |
139 } | 138 } |
140 | 139 |
141 } // namespace ui | 140 } // namespace ui |
OLD | NEW |