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

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

Issue 2374183006: Remove GLFrameData from CompositorFrame. (Closed)
Patch Set: Rebase. Created 4 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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.h" 5 #include "services/ui/surfaces/direct_output_surface.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
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/compositor_frame.h"
12 #include "cc/output/context_provider.h" 11 #include "cc/output/context_provider.h"
13 #include "cc/output/output_surface_client.h" 12 #include "cc/output/output_surface_client.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 "gpu/command_buffer/client/context_support.h" 15 #include "gpu/command_buffer/client/context_support.h"
16 #include "gpu/command_buffer/client/gles2_interface.h" 16 #include "gpu/command_buffer/client/gles2_interface.h"
17 17
18 namespace ui { 18 namespace ui {
19 19
20 DirectOutputSurface::DirectOutputSurface( 20 DirectOutputSurface::DirectOutputSurface(
21 scoped_refptr<SurfacesContextProvider> context_provider, 21 scoped_refptr<SurfacesContextProvider> context_provider,
22 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source) 22 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source)
23 : cc::OutputSurface(context_provider), 23 : cc::OutputSurface(context_provider),
(...skipping 18 matching lines...) Expand all
42 void DirectOutputSurface::EnsureBackbuffer() {} 42 void DirectOutputSurface::EnsureBackbuffer() {}
43 43
44 void DirectOutputSurface::DiscardBackbuffer() { 44 void DirectOutputSurface::DiscardBackbuffer() {
45 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM(); 45 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM();
46 } 46 }
47 47
48 void DirectOutputSurface::BindFramebuffer() { 48 void DirectOutputSurface::BindFramebuffer() {
49 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0); 49 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0);
50 } 50 }
51 51
52 void DirectOutputSurface::SwapBuffers(cc::CompositorFrame frame) { 52 void DirectOutputSurface::SwapBuffers(cc::OutputSurfaceFrame frame) {
53 DCHECK(context_provider_); 53 DCHECK(context_provider_);
54 DCHECK(frame.gl_frame_data); 54 if (frame.sub_buffer_rect == gfx::Rect(frame.size)) {
55 if (frame.gl_frame_data->sub_buffer_rect ==
56 gfx::Rect(frame.gl_frame_data->size)) {
57 context_provider_->ContextSupport()->Swap(); 55 context_provider_->ContextSupport()->Swap();
58 } else { 56 } else {
59 context_provider_->ContextSupport()->PartialSwapBuffers( 57 context_provider_->ContextSupport()->PartialSwapBuffers(
60 frame.gl_frame_data->sub_buffer_rect); 58 frame.sub_buffer_rect);
61 } 59 }
62 60
63 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); 61 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
64 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM(); 62 const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM();
65 gl->ShallowFlushCHROMIUM(); 63 gl->ShallowFlushCHROMIUM();
66 64
67 gpu::SyncToken sync_token; 65 gpu::SyncToken sync_token;
68 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData()); 66 gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
69 67
70 context_provider_->ContextSupport()->SignalSyncToken( 68 context_provider_->ContextSupport()->SignalSyncToken(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 synthetic_begin_frame_source_->OnUpdateVSyncParameters( 106 synthetic_begin_frame_source_->OnUpdateVSyncParameters(
109 timebase, 107 timebase,
110 interval.is_zero() ? cc::BeginFrameArgs::DefaultInterval() : interval); 108 interval.is_zero() ? cc::BeginFrameArgs::DefaultInterval() : interval);
111 } 109 }
112 110
113 void DirectOutputSurface::OnSwapBuffersComplete() { 111 void DirectOutputSurface::OnSwapBuffersComplete() {
114 client_->DidSwapBuffersComplete(); 112 client_->DidSwapBuffersComplete();
115 } 113 }
116 114
117 } // namespace ui 115 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/surfaces/direct_output_surface.h ('k') | services/ui/surfaces/direct_output_surface_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698