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

Side by Side Diff: services/ui/surfaces/direct_output_surface_ozone.cc

Issue 2481263002: Introduce Display Compositor mojo interface. Use InProcessContextProvider. (Closed)
Patch Set: Speculative fix for android build issue 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 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/direct_output_surface_ozone.h" 5 #include "services/ui/surfaces/direct_output_surface_ozone.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "cc/output/context_provider.h" 11 #include "cc/output/context_provider.h"
12 #include "cc/output/output_surface_client.h" 12 #include "cc/output/output_surface_client.h"
13 #include "cc/output/output_surface_frame.h" 13 #include "cc/output/output_surface_frame.h"
14 #include "cc/scheduler/begin_frame_source.h" 14 #include "cc/scheduler/begin_frame_source.h"
15 #include "components/display_compositor/buffer_queue.h" 15 #include "components/display_compositor/buffer_queue.h"
16 #include "gpu/command_buffer/client/context_support.h" 16 #include "gpu/command_buffer/client/context_support.h"
17 #include "gpu/command_buffer/client/gles2_interface.h" 17 #include "gpu/command_buffer/client/gles2_interface.h"
18 #include "services/ui/surfaces/surfaces_context_provider.h"
19 #include "ui/display/types/display_snapshot.h" 18 #include "ui/display/types/display_snapshot.h"
20 19
21 using display_compositor::BufferQueue; 20 using display_compositor::BufferQueue;
22 21
23 namespace ui { 22 namespace ui {
24 23
25 DirectOutputSurfaceOzone::DirectOutputSurfaceOzone( 24 DirectOutputSurfaceOzone::DirectOutputSurfaceOzone(
26 scoped_refptr<SurfacesContextProvider> context_provider, 25 scoped_refptr<cc::InProcessContextProvider> context_provider,
27 gfx::AcceleratedWidget widget, 26 gfx::AcceleratedWidget widget,
28 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source, 27 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source,
29 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 28 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
30 uint32_t target, 29 uint32_t target,
31 uint32_t internalformat) 30 uint32_t internalformat)
32 : cc::OutputSurface(context_provider), 31 : cc::OutputSurface(context_provider),
33 gl_helper_(context_provider->ContextGL(), 32 gl_helper_(context_provider->ContextGL(),
34 context_provider->ContextSupport()), 33 context_provider->ContextSupport()),
35 synthetic_begin_frame_source_(synthetic_begin_frame_source), 34 synthetic_begin_frame_source_(synthetic_begin_frame_source),
36 weak_ptr_factory_(this) { 35 weak_ptr_factory_(this) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 void DirectOutputSurfaceOzone::ApplyExternalStencil() {} 141 void DirectOutputSurfaceOzone::ApplyExternalStencil() {}
143 142
144 void DirectOutputSurfaceOzone::OnUpdateVSyncParametersFromGpu( 143 void DirectOutputSurfaceOzone::OnUpdateVSyncParametersFromGpu(
145 base::TimeTicks timebase, 144 base::TimeTicks timebase,
146 base::TimeDelta interval) { 145 base::TimeDelta interval) {
147 DCHECK(client_); 146 DCHECK(client_);
148 synthetic_begin_frame_source_->OnUpdateVSyncParameters(timebase, interval); 147 synthetic_begin_frame_source_->OnUpdateVSyncParameters(timebase, interval);
149 } 148 }
150 149
151 void DirectOutputSurfaceOzone::OnGpuSwapBuffersCompleted( 150 void DirectOutputSurfaceOzone::OnGpuSwapBuffersCompleted(
152 gfx::SwapResult result) { 151 const std::vector<ui::LatencyInfo>& latency_info,
152 gfx::SwapResult result,
153 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) {
153 bool force_swap = false; 154 bool force_swap = false;
154 if (result == gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS) { 155 if (result == gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS) {
155 // Even through the swap failed, this is a fixable error so we can pretend 156 // Even through the swap failed, this is a fixable error so we can pretend
156 // it succeeded to the rest of the system. 157 // it succeeded to the rest of the system.
157 result = gfx::SwapResult::SWAP_ACK; 158 result = gfx::SwapResult::SWAP_ACK;
158 buffer_queue_->RecreateBuffers(); 159 buffer_queue_->RecreateBuffers();
159 force_swap = true; 160 force_swap = true;
160 } 161 }
161 162
162 buffer_queue_->PageFlipComplete(); 163 buffer_queue_->PageFlipComplete();
163 client_->DidReceiveSwapBuffersAck(); 164 client_->DidReceiveSwapBuffersAck();
164 165
165 if (force_swap) 166 if (force_swap)
166 client_->SetNeedsRedrawRect(gfx::Rect(swap_size_)); 167 client_->SetNeedsRedrawRect(gfx::Rect(swap_size_));
167 } 168 }
168 169
169 } // namespace ui 170 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698