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

Side by Side Diff: content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc

Issue 516663003: Surfaceless OutputSurface implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s urface.h"
6
7 #include "cc/output/compositor_frame.h"
8 #include "content/browser/compositor/buffered_output_surface.h"
9 #include "content/browser/compositor/reflector_impl.h"
10 #include "content/browser/gpu/gpu_surface_tracker.h"
11 #include "content/common/gpu/client/context_provider_command_buffer.h"
12 #include "gpu/GLES2/gl2extchromium.h"
13 #include "gpu/command_buffer/client/gles2_interface.h"
14
15 namespace content {
16
17 GpuSurfacelessBrowserCompositorOutputSurface::
18 GpuSurfacelessBrowserCompositorOutputSurface(
19 const scoped_refptr<ContextProviderCommandBuffer>& context,
20 int surface_id,
21 IDMap<BrowserCompositorOutputSurface>* output_surface_map,
22 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager,
23 scoped_ptr<cc::OverlayCandidateValidator> overlay_candidate_validator,
24 unsigned internalformat,
25 int z_order)
26 : GpuBrowserCompositorOutputSurface(context,
27 surface_id,
28 output_surface_map,
29 vsync_manager,
30 overlay_candidate_validator.Pass()),
31 z_order_(z_order),
32 expects_pageflip_messages_(false),
33 internalformat_(internalformat) {
34 }
35
36 GpuSurfacelessBrowserCompositorOutputSurface::
37 ~GpuSurfacelessBrowserCompositorOutputSurface() {
38 }
39
40 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers(
41 cc::CompositorFrame* frame) {
42 DCHECK(output_surface_);
43 output_surface_->SwapBuffers();
44
45 const gfx::Size& size = frame->gl_frame_data->size;
46 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
47 gl->Finish();
alexst (slow to review) 2014/09/10 15:39:07 Put a comment here to indicate this glFinish is te
48 gl->ScheduleOverlayPlaneCHROMIUM(z_order_,
49 GL_OVERLAY_TRANSFORM_NONE_CHROMIUM,
50 output_surface_->tex_id(),
alexst (slow to review) 2014/09/10 15:39:07 Let's rename this to something more descriptive, m
achaulk 2014/09/10 16:47:55 Well the texture never changes, we just rebind new
51 0,
52 0,
53 size.width(),
54 size.height(),
55 0,
56 0,
57 1.0f,
58 1.0f);
59 GpuBrowserCompositorOutputSurface::SwapBuffers(frame);
60 }
61
62 void GpuSurfacelessBrowserCompositorOutputSurface::OnSwapBuffersComplete() {
63 DCHECK(output_surface_);
64 // PageFlipComplete must be called to properly drive the buffering. If we
65 // don't expect to receive these calls from IPCs, we should call it here.
66 if (!expects_pageflip_messages_)
67 output_surface_->PageFlipComplete();
68 GpuBrowserCompositorOutputSurface::OnSwapBuffersComplete();
69 }
70
71 void GpuSurfacelessBrowserCompositorOutputSurface::BindFramebuffer() {
72 DCHECK(output_surface_);
73 output_surface_->BindFramebuffer();
74 }
75
76 void GpuSurfacelessBrowserCompositorOutputSurface::Reshape(
77 const gfx::Size& size,
78 float scale_factor) {
79 gfx::Size current = SurfaceSize();
80 GpuBrowserCompositorOutputSurface::Reshape(size, scale_factor);
81 DCHECK(output_surface_);
82 output_surface_->Reshape(SurfaceSize(), scale_factor);
83 }
84
85 bool GpuSurfacelessBrowserCompositorOutputSurface::BindToClient(
86 cc::OutputSurfaceClient* client) {
87 DCHECK(output_surface_);
88 if (!GpuBrowserCompositorOutputSurface::BindToClient(client))
89 return false;
90 if (!output_surface_) {
91 output_surface_.reset(
92 new BufferedOutputSurface(context_provider_, internalformat_));
93 }
94 return true;
95 }
96
97 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698