| 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 23 matching lines...) Expand all Loading... |
| 34 // Allocate the storage for the color buffer. The specified context is | 34 // Allocate the storage for the color buffer. The specified context is |
| 35 // current, and there is a texture bound to GL_TEXTURE_RECTANGLE_ARB. | 35 // current, and there is a texture bound to GL_TEXTURE_RECTANGLE_ARB. |
| 36 virtual bool AllocateColorBufferStorage( | 36 virtual bool AllocateColorBufferStorage( |
| 37 CGLContextObj context, const base::Closure& context_dirtied_callback, | 37 CGLContextObj context, const base::Closure& context_dirtied_callback, |
| 38 GLuint texture, gfx::Size size, float scale_factor) = 0; | 38 GLuint texture, gfx::Size size, float scale_factor) = 0; |
| 39 | 39 |
| 40 // Free the storage allocated in the AllocateColorBufferStorage call. The | 40 // Free the storage allocated in the AllocateColorBufferStorage call. The |
| 41 // GL texture that was bound has already been deleted by the caller. | 41 // GL texture that was bound has already been deleted by the caller. |
| 42 virtual void FreeColorBufferStorage() = 0; | 42 virtual void FreeColorBufferStorage() = 0; |
| 43 | 43 |
| 44 // Swap buffers and return the handle for the surface to send to the browser | 44 // Called when the frame size has changed (the buffer may not have been |
| 45 // process to display. | 45 // reallocated, since its size may be rounded). |
| 46 virtual void SwapBuffers(const gfx::Size& size, float scale_factor) = 0; | 46 virtual void FrameSizeChanged( |
| 47 const gfx::Size& pixel_size, float scale_factor) = 0; |
| 48 |
| 49 // Swap buffers, or post sub-buffer. |
| 50 virtual void SwapBuffers() = 0; |
| 47 | 51 |
| 48 // Indicate that the backbuffer will be written to. | 52 // Indicate that the backbuffer will be written to. |
| 49 virtual void WillWriteToBackbuffer() = 0; | 53 virtual void WillWriteToBackbuffer() = 0; |
| 50 | 54 |
| 51 // Indicate that the backbuffer has been discarded and should not be seen | 55 // Indicate that the backbuffer has been discarded and should not be seen |
| 52 // again. | 56 // again. |
| 53 virtual void DiscardBackbuffer() = 0; | 57 virtual void DiscardBackbuffer() = 0; |
| 54 | 58 |
| 55 // Called once for every SwapBuffers call when the IPC for the present has | 59 // Called once for every SwapBuffers call when the IPC for the present has |
| 56 // been processed by the browser. |disable_throttling| is set if the | 60 // been processed by the browser. |disable_throttling| is set if the |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // GpuCommandBufferStub::DestructionObserver implementation. | 100 // GpuCommandBufferStub::DestructionObserver implementation. |
| 97 void OnWillDestroyStub() override; | 101 void OnWillDestroyStub() override; |
| 98 | 102 |
| 99 private: | 103 private: |
| 100 ~ImageTransportSurfaceFBO() override; | 104 ~ImageTransportSurfaceFBO() override; |
| 101 | 105 |
| 102 void AdjustBufferAllocation(); | 106 void AdjustBufferAllocation(); |
| 103 void DestroyFramebuffer(); | 107 void DestroyFramebuffer(); |
| 104 void AllocateOrResizeFramebuffer( | 108 void AllocateOrResizeFramebuffer( |
| 105 const gfx::Size& pixel_size, float scale_factor); | 109 const gfx::Size& pixel_size, float scale_factor); |
| 110 bool SwapBuffersInternal(); |
| 106 | 111 |
| 107 scoped_ptr<StorageProvider> storage_provider_; | 112 scoped_ptr<StorageProvider> storage_provider_; |
| 108 | 113 |
| 109 // Tracks the current buffer allocation state. | 114 // Tracks the current buffer allocation state. |
| 110 bool backbuffer_suggested_allocation_; | 115 bool backbuffer_suggested_allocation_; |
| 111 bool frontbuffer_suggested_allocation_; | 116 bool frontbuffer_suggested_allocation_; |
| 112 | 117 |
| 113 uint32 fbo_id_; | 118 uint32 fbo_id_; |
| 114 GLuint texture_id_; | 119 GLuint texture_id_; |
| 115 GLuint depth_stencil_renderbuffer_id_; | 120 GLuint depth_stencil_renderbuffer_id_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 130 std::vector<ui::LatencyInfo> latency_info_; | 135 std::vector<ui::LatencyInfo> latency_info_; |
| 131 | 136 |
| 132 scoped_ptr<ImageTransportHelper> helper_; | 137 scoped_ptr<ImageTransportHelper> helper_; |
| 133 | 138 |
| 134 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurfaceFBO); | 139 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurfaceFBO); |
| 135 }; | 140 }; |
| 136 | 141 |
| 137 } // namespace content | 142 } // namespace content |
| 138 | 143 |
| 139 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_FBO_MAC_H_ | 144 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_FBO_MAC_H_ |
| OLD | NEW |