OLD | NEW |
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 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_FBO_MAC_H_ | 5 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_FBO_MAC_H_ |
6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_FBO_MAC_H_ | 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_FBO_MAC_H_ |
7 | 7 |
8 #include "base/mac/scoped_cftyperef.h" | 8 #include "base/mac/scoped_cftyperef.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "content/common/gpu/gpu_command_buffer_stub.h" | 10 #include "content/common/gpu/gpu_command_buffer_stub.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // Called when the context may continue to make forward progress after a swap. | 81 // Called when the context may continue to make forward progress after a swap. |
82 void SendSwapBuffers(uint64 surface_handle, | 82 void SendSwapBuffers(uint64 surface_handle, |
83 const gfx::Size pixel_size, | 83 const gfx::Size pixel_size, |
84 float scale_factor); | 84 float scale_factor); |
85 void SetRendererID(int renderer_id); | 85 void SetRendererID(int renderer_id); |
86 | 86 |
87 protected: | 87 protected: |
88 // ImageTransportSurface implementation | 88 // ImageTransportSurface implementation |
89 void OnBufferPresented( | 89 void OnBufferPresented( |
90 const AcceleratedSurfaceMsg_BufferPresented_Params& params) override; | 90 const AcceleratedSurfaceMsg_BufferPresented_Params& params) override; |
91 void OnResize(gfx::Size size, float scale_factor) override; | 91 void OnResize(gfx::Size pixel_size, float scale_factor) override; |
92 void SetLatencyInfo(const std::vector<ui::LatencyInfo>&) override; | 92 void SetLatencyInfo(const std::vector<ui::LatencyInfo>&) override; |
93 void WakeUpGpu() override; | 93 void WakeUpGpu() override; |
94 | 94 |
95 // GpuCommandBufferStub::DestructionObserver implementation. | 95 // GpuCommandBufferStub::DestructionObserver implementation. |
96 void OnWillDestroyStub() override; | 96 void OnWillDestroyStub() override; |
97 | 97 |
98 private: | 98 private: |
99 ~ImageTransportSurfaceFBO() override; | 99 ~ImageTransportSurfaceFBO() override; |
100 | 100 |
101 void AdjustBufferAllocation(); | 101 void AdjustBufferAllocation(); |
102 void DestroyFramebuffer(); | 102 void DestroyFramebuffer(); |
103 void CreateFramebuffer(); | 103 void AllocateOrResizeFramebuffer( |
| 104 const gfx::Size& pixel_size, float scale_factor); |
104 | 105 |
105 scoped_ptr<StorageProvider> storage_provider_; | 106 scoped_ptr<StorageProvider> storage_provider_; |
106 | 107 |
107 // Tracks the current buffer allocation state. | 108 // Tracks the current buffer allocation state. |
108 bool backbuffer_suggested_allocation_; | 109 bool backbuffer_suggested_allocation_; |
109 bool frontbuffer_suggested_allocation_; | 110 bool frontbuffer_suggested_allocation_; |
110 | 111 |
111 uint32 fbo_id_; | 112 uint32 fbo_id_; |
112 GLuint texture_id_; | 113 GLuint texture_id_; |
113 GLuint depth_stencil_renderbuffer_id_; | 114 GLuint depth_stencil_renderbuffer_id_; |
114 bool has_complete_framebuffer_; | 115 bool has_complete_framebuffer_; |
115 | 116 |
116 // Weak pointer to the context that this was last made current to. | 117 // Weak pointer to the context that this was last made current to. |
117 gfx::GLContext* context_; | 118 gfx::GLContext* context_; |
118 | 119 |
119 gfx::Size size_; | 120 gfx::Size pixel_size_; |
120 gfx::Size rounded_size_; | 121 gfx::Size rounded_pixel_size_; |
121 float scale_factor_; | 122 float scale_factor_; |
122 | 123 |
123 // Whether or not we've successfully made the surface current once. | 124 // Whether or not we've successfully made the surface current once. |
124 bool made_current_; | 125 bool made_current_; |
125 | 126 |
126 // Whether a SwapBuffers IPC needs to be sent to the browser. | 127 // Whether a SwapBuffers IPC needs to be sent to the browser. |
127 bool is_swap_buffers_send_pending_; | 128 bool is_swap_buffers_send_pending_; |
128 std::vector<ui::LatencyInfo> latency_info_; | 129 std::vector<ui::LatencyInfo> latency_info_; |
129 | 130 |
130 scoped_ptr<ImageTransportHelper> helper_; | 131 scoped_ptr<ImageTransportHelper> helper_; |
131 | 132 |
132 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurfaceFBO); | 133 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurfaceFBO); |
133 }; | 134 }; |
134 | 135 |
135 } // namespace content | 136 } // namespace content |
136 | 137 |
137 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_MAC_H_ | 138 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_MAC_H_ |
OLD | NEW |