| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
| 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #if defined(ENABLE_GPU) | 9 #if defined(ENABLE_GPU) |
| 10 | 10 |
| 11 #include <vector> |
| 12 |
| 11 #include "base/callback.h" | 13 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 13 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 16 #include "ipc/ipc_channel.h" | 18 #include "ipc/ipc_channel.h" |
| 17 #include "ipc/ipc_message.h" | 19 #include "ipc/ipc_message.h" |
| 18 #include "ui/gfx/gl/gl_surface.h" | 20 #include "ui/gfx/gl/gl_surface.h" |
| 21 #include "ui/gfx/native_widget_types.h" |
| 22 #include "ui/gfx/rect.h" |
| 19 #include "ui/gfx/size.h" | 23 #include "ui/gfx/size.h" |
| 20 #include "ui/gfx/native_widget_types.h" | |
| 21 #include "ui/gfx/surface/transport_dib.h" | 24 #include "ui/gfx/surface/transport_dib.h" |
| 22 | 25 |
| 23 class GpuChannelManager; | 26 class GpuChannelManager; |
| 24 class GpuCommandBufferStub; | 27 class GpuCommandBufferStub; |
| 25 | 28 |
| 26 struct GpuHostMsg_AcceleratedSurfaceNew_Params; | 29 struct GpuHostMsg_AcceleratedSurfaceNew_Params; |
| 27 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; | 30 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; |
| 28 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; | 31 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; |
| 29 struct GpuHostMsg_AcceleratedSurfaceRelease_Params; | 32 struct GpuHostMsg_AcceleratedSurfaceRelease_Params; |
| 30 | 33 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 virtual void OnBuffersSwappedACK() = 0; | 66 virtual void OnBuffersSwappedACK() = 0; |
| 64 virtual void OnPostSubBufferACK() = 0; | 67 virtual void OnPostSubBufferACK() = 0; |
| 65 virtual void OnResizeViewACK() = 0; | 68 virtual void OnResizeViewACK() = 0; |
| 66 virtual void OnResize(gfx::Size size) = 0; | 69 virtual void OnResize(gfx::Size size) = 0; |
| 67 | 70 |
| 68 // Creates the appropriate surface depending on the GL implementation. | 71 // Creates the appropriate surface depending on the GL implementation. |
| 69 static scoped_refptr<gfx::GLSurface> | 72 static scoped_refptr<gfx::GLSurface> |
| 70 CreateSurface(GpuChannelManager* manager, | 73 CreateSurface(GpuChannelManager* manager, |
| 71 GpuCommandBufferStub* stub, | 74 GpuCommandBufferStub* stub, |
| 72 const gfx::GLSurfaceHandle& handle); | 75 const gfx::GLSurfaceHandle& handle); |
| 76 protected: |
| 77 // Used by certain implements of PostSubBuffer to determine |
| 78 // how much needs to be copied between frames. |
| 79 void GetRegionsToCopy(const gfx::Rect& previous_damage_rect, |
| 80 const gfx::Rect& new_damage_rect, |
| 81 std::vector<gfx::Rect>* regions); |
| 82 |
| 73 private: | 83 private: |
| 74 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurface); | 84 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurface); |
| 75 }; | 85 }; |
| 76 | 86 |
| 77 class ImageTransportHelper : public IPC::Channel::Listener { | 87 class ImageTransportHelper : public IPC::Channel::Listener { |
| 78 public: | 88 public: |
| 79 // Takes weak pointers to objects that outlive the helper. | 89 // Takes weak pointers to objects that outlive the helper. |
| 80 ImageTransportHelper(ImageTransportSurface* surface, | 90 ImageTransportHelper(ImageTransportSurface* surface, |
| 81 GpuChannelManager* manager, | 91 GpuChannelManager* manager, |
| 82 GpuCommandBufferStub* stub, | 92 GpuCommandBufferStub* stub, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 gfx::Size new_size_; | 180 gfx::Size new_size_; |
| 171 bool transport_; | 181 bool transport_; |
| 172 bool did_set_swap_interval_; | 182 bool did_set_swap_interval_; |
| 173 | 183 |
| 174 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 184 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
| 175 }; | 185 }; |
| 176 | 186 |
| 177 #endif // defined(ENABLE_GPU) | 187 #endif // defined(ENABLE_GPU) |
| 178 | 188 |
| 179 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 189 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
| OLD | NEW |