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

Side by Side Diff: content/common/gpu/image_transport_surface_mac.h

Issue 337303003: CARemoteLayer alive-ish (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_MAC_H_
6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_MAC_H_
7
8 #include "base/mac/scoped_cftyperef.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "content/common/gpu/gpu_command_buffer_stub.h"
11 #include "content/common/gpu/image_transport_surface.h"
12 #include "ui/gl/gl_bindings.h"
13
14 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params;
15 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params;
16
17 namespace content {
18
19 // We are backed by an offscreen surface for the purposes of creating
20 // a context, but use FBOs to render to texture backed IOSurface
21 class ImageTransportSurfaceFBO
22 : public gfx::GLSurface,
23 public ImageTransportSurface,
24 public GpuCommandBufferStub::DestructionObserver {
25 public:
26 class StorageProvider {
27 public:
28 virtual ~StorageProvider() {}
29 virtual gfx::Size GetRoundedSize(gfx::Size size) = 0;
30 virtual bool AllocateColorBufferStorage(
31 CGLContextObj context, gfx::Size size) = 0;
32 virtual void FreeColorBufferStorage() = 0;
33 virtual void PopulateSwapBuffersStorageParams(
34 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params* params) = 0;
35 virtual void PopulateSubBufferStorageParams(
36 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params* params) = 0;
37 };
38
39 ImageTransportSurfaceFBO(StorageProvider* storage_provider,
40 GpuChannelManager* manager,
41 GpuCommandBufferStub* stub,
42 gfx::PluginWindowHandle handle);
43
44 // GLSurface implementation
45 virtual bool Initialize() OVERRIDE;
46 virtual void Destroy() OVERRIDE;
47 virtual bool DeferDraws() OVERRIDE;
48 virtual bool IsOffscreen() OVERRIDE;
49 virtual bool SwapBuffers() OVERRIDE;
50 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE;
51 virtual bool SupportsPostSubBuffer() OVERRIDE;
52 virtual gfx::Size GetSize() OVERRIDE;
53 virtual void* GetHandle() OVERRIDE;
54 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
55 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
56 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE;
57 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE;
58
59 protected:
60 // ImageTransportSurface implementation
61 virtual void OnBufferPresented(
62 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE;
63 virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE;
64 virtual void SetLatencyInfo(
65 const std::vector<ui::LatencyInfo>&) OVERRIDE;
66 virtual void WakeUpGpu() OVERRIDE;
67
68 // GpuCommandBufferStub::DestructionObserver implementation.
69 virtual void OnWillDestroyStub() OVERRIDE;
70
71 private:
72 virtual ~ImageTransportSurfaceFBO() OVERRIDE;
73
74 void AdjustBufferAllocation();
75 void DestroyFramebuffer();
76 void CreateFramebuffer();
77
78 scoped_ptr<StorageProvider> storage_provider_;
79
80 // Tracks the current buffer allocation state.
81 bool backbuffer_suggested_allocation_;
82 bool frontbuffer_suggested_allocation_;
83
84 uint32 fbo_id_;
85 GLuint texture_id_;
86 GLuint depth_stencil_renderbuffer_id_;
87 bool has_complete_framebuffer_;
88
89 // Weak pointer to the context that this was last made current to.
90 gfx::GLContext* context_;
91
92 gfx::Size size_;
93 gfx::Size rounded_size_;
94 float scale_factor_;
95
96 // Whether or not we've successfully made the surface current once.
97 bool made_current_;
98
99 // Whether a SwapBuffers is pending.
100 bool is_swap_buffers_pending_;
101
102 // Whether we unscheduled command buffer because of pending SwapBuffers.
103 bool did_unschedule_;
104
105 std::vector<ui::LatencyInfo> latency_info_;
106
107 scoped_ptr<ImageTransportHelper> helper_;
108
109 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurfaceFBO);
110 };
111
112 } // namespace content
113
114 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_MAC_H_
OLDNEW
« no previous file with comments | « content/common/gpu/image_transport_surface_iosurface_mac.cc ('k') | content/common/gpu/image_transport_surface_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698