| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 GPU_IPC_SERVICE_PASS_THROUGH_IMAGE_TRANSPORT_SURFACE_H_ | 5 #ifndef GPU_IPC_SERVICE_PASS_THROUGH_IMAGE_TRANSPORT_SURFACE_H_ |
| 6 #define GPU_IPC_SERVICE_PASS_THROUGH_IMAGE_TRANSPORT_SURFACE_H_ | 6 #define GPU_IPC_SERVICE_PASS_THROUGH_IMAGE_TRANSPORT_SURFACE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "gpu/ipc/service/image_transport_surface.h" | 15 #include "gpu/ipc/service/image_transport_surface.h" |
| 16 #include "gpu/ipc/service/image_transport_surface_delegate.h" |
| 16 #include "ui/events/latency_info.h" | 17 #include "ui/events/latency_info.h" |
| 17 #include "ui/gl/gl_surface.h" | 18 #include "ui/gl/gl_surface.h" |
| 18 | 19 |
| 19 namespace gpu { | 20 namespace gpu { |
| 20 class GpuChannelManager; | 21 class GpuChannelManager; |
| 21 class GpuCommandBufferStub; | |
| 22 | 22 |
| 23 // An implementation of ImageTransportSurface that implements GLSurface through | 23 // An implementation of ImageTransportSurface that implements GLSurface through |
| 24 // GLSurfaceAdapter, thereby forwarding GLSurface methods through to it. | 24 // GLSurfaceAdapter, thereby forwarding GLSurface methods through to it. |
| 25 class PassThroughImageTransportSurface : public gl::GLSurfaceAdapter { | 25 class PassThroughImageTransportSurface : public gl::GLSurfaceAdapter { |
| 26 public: | 26 public: |
| 27 PassThroughImageTransportSurface(GpuCommandBufferStub* stub, | 27 PassThroughImageTransportSurface( |
| 28 gl::GLSurface* surface); | 28 base::WeakPtr<ImageTransportSurfaceDelegate> delegate, |
| 29 gl::GLSurface* surface); |
| 29 | 30 |
| 30 // GLSurface implementation. | 31 // GLSurface implementation. |
| 31 bool Initialize(gl::GLSurface::Format format) override; | 32 bool Initialize(gl::GLSurface::Format format) override; |
| 32 void Destroy() override; | 33 void Destroy() override; |
| 33 gfx::SwapResult SwapBuffers() override; | 34 gfx::SwapResult SwapBuffers() override; |
| 34 void SwapBuffersAsync(const SwapCompletionCallback& callback) override; | 35 void SwapBuffersAsync(const SwapCompletionCallback& callback) override; |
| 35 gfx::SwapResult SwapBuffersWithDamage(int x, | 36 gfx::SwapResult SwapBuffersWithDamage(int x, |
| 36 int y, | 37 int y, |
| 37 int width, | 38 int width, |
| 38 int height) override; | 39 int height) override; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 57 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); | 58 void SetLatencyInfo(const std::vector<ui::LatencyInfo>& latency_info); |
| 58 std::unique_ptr<std::vector<ui::LatencyInfo>> StartSwapBuffers(); | 59 std::unique_ptr<std::vector<ui::LatencyInfo>> StartSwapBuffers(); |
| 59 void FinishSwapBuffers( | 60 void FinishSwapBuffers( |
| 60 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info, | 61 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info, |
| 61 gfx::SwapResult result); | 62 gfx::SwapResult result); |
| 62 void FinishSwapBuffersAsync( | 63 void FinishSwapBuffersAsync( |
| 63 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info, | 64 std::unique_ptr<std::vector<ui::LatencyInfo>> latency_info, |
| 64 GLSurface::SwapCompletionCallback callback, | 65 GLSurface::SwapCompletionCallback callback, |
| 65 gfx::SwapResult result); | 66 gfx::SwapResult result); |
| 66 | 67 |
| 67 base::WeakPtr<GpuCommandBufferStub> stub_; | 68 base::WeakPtr<ImageTransportSurfaceDelegate> delegate_; |
| 68 bool did_set_swap_interval_; | 69 bool did_set_swap_interval_; |
| 69 std::vector<ui::LatencyInfo> latency_info_; | 70 std::vector<ui::LatencyInfo> latency_info_; |
| 70 base::WeakPtrFactory<PassThroughImageTransportSurface> weak_ptr_factory_; | 71 base::WeakPtrFactory<PassThroughImageTransportSurface> weak_ptr_factory_; |
| 71 | 72 |
| 72 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 73 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 } // namespace gpu | 76 } // namespace gpu |
| 76 | 77 |
| 77 #endif // GPU_IPC_SERVICE_PASS_THROUGH_IMAGE_TRANSPORT_SURFACE_H_ | 78 #endif // GPU_IPC_SERVICE_PASS_THROUGH_IMAGE_TRANSPORT_SURFACE_H_ |
| OLD | NEW |