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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // been processed by the browser. |disable_throttling| is set if the | 56 // been processed by the browser. |disable_throttling| is set if the |
57 // browser suspects that GPU back-pressure should be disabled. | 57 // browser suspects that GPU back-pressure should be disabled. |
58 virtual void SwapBuffersAckedByBrowser(bool disable_throttling) = 0; | 58 virtual void SwapBuffersAckedByBrowser(bool disable_throttling) = 0; |
59 }; | 59 }; |
60 | 60 |
61 ImageTransportSurfaceFBO(GpuChannelManager* manager, | 61 ImageTransportSurfaceFBO(GpuChannelManager* manager, |
62 GpuCommandBufferStub* stub, | 62 GpuCommandBufferStub* stub, |
63 gfx::PluginWindowHandle handle); | 63 gfx::PluginWindowHandle handle); |
64 | 64 |
65 // GLSurface implementation | 65 // GLSurface implementation |
66 virtual bool Initialize() override; | 66 bool Initialize() override; |
67 virtual void Destroy() override; | 67 void Destroy() override; |
68 virtual bool DeferDraws() override; | 68 bool DeferDraws() override; |
69 virtual bool IsOffscreen() override; | 69 bool IsOffscreen() override; |
70 virtual bool SwapBuffers() override; | 70 bool SwapBuffers() override; |
71 virtual bool PostSubBuffer(int x, int y, int width, int height) override; | 71 bool PostSubBuffer(int x, int y, int width, int height) override; |
72 virtual bool SupportsPostSubBuffer() override; | 72 bool SupportsPostSubBuffer() override; |
73 virtual gfx::Size GetSize() override; | 73 gfx::Size GetSize() override; |
74 virtual void* GetHandle() override; | 74 void* GetHandle() override; |
75 virtual void* GetDisplay() override; | 75 void* GetDisplay() override; |
76 virtual bool OnMakeCurrent(gfx::GLContext* context) override; | 76 bool OnMakeCurrent(gfx::GLContext* context) override; |
77 virtual unsigned int GetBackingFrameBufferObject() override; | 77 unsigned int GetBackingFrameBufferObject() override; |
78 virtual bool SetBackbufferAllocation(bool allocated) override; | 78 bool SetBackbufferAllocation(bool allocated) override; |
79 virtual void SetFrontbufferAllocation(bool allocated) override; | 79 void SetFrontbufferAllocation(bool allocated) override; |
80 | 80 |
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 virtual void OnBufferPresented( | 89 void OnBufferPresented( |
90 const AcceleratedSurfaceMsg_BufferPresented_Params& params) override; | 90 const AcceleratedSurfaceMsg_BufferPresented_Params& params) override; |
91 virtual void OnResize(gfx::Size size, float scale_factor) override; | 91 void OnResize(gfx::Size size, float scale_factor) override; |
92 virtual void SetLatencyInfo( | 92 void SetLatencyInfo(const std::vector<ui::LatencyInfo>&) override; |
93 const std::vector<ui::LatencyInfo>&) override; | 93 void WakeUpGpu() override; |
94 virtual void WakeUpGpu() override; | |
95 | 94 |
96 // GpuCommandBufferStub::DestructionObserver implementation. | 95 // GpuCommandBufferStub::DestructionObserver implementation. |
97 virtual void OnWillDestroyStub() override; | 96 void OnWillDestroyStub() override; |
98 | 97 |
99 private: | 98 private: |
100 virtual ~ImageTransportSurfaceFBO() override; | 99 ~ImageTransportSurfaceFBO() override; |
101 | 100 |
102 void AdjustBufferAllocation(); | 101 void AdjustBufferAllocation(); |
103 void DestroyFramebuffer(); | 102 void DestroyFramebuffer(); |
104 void CreateFramebuffer(); | 103 void CreateFramebuffer(); |
105 | 104 |
106 scoped_ptr<StorageProvider> storage_provider_; | 105 scoped_ptr<StorageProvider> storage_provider_; |
107 | 106 |
108 // Tracks the current buffer allocation state. | 107 // Tracks the current buffer allocation state. |
109 bool backbuffer_suggested_allocation_; | 108 bool backbuffer_suggested_allocation_; |
110 bool frontbuffer_suggested_allocation_; | 109 bool frontbuffer_suggested_allocation_; |
(...skipping 18 matching lines...) Expand all Loading... |
129 std::vector<ui::LatencyInfo> latency_info_; | 128 std::vector<ui::LatencyInfo> latency_info_; |
130 | 129 |
131 scoped_ptr<ImageTransportHelper> helper_; | 130 scoped_ptr<ImageTransportHelper> helper_; |
132 | 131 |
133 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurfaceFBO); | 132 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurfaceFBO); |
134 }; | 133 }; |
135 | 134 |
136 } // namespace content | 135 } // namespace content |
137 | 136 |
138 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_MAC_H_ | 137 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_MAC_H_ |
OLD | NEW |