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 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // should be responded to. The factory returns an offscreen surface that looks | 52 // should be responded to. The factory returns an offscreen surface that looks |
53 // a lot like an onscreen surface to the GPU process. | 53 // a lot like an onscreen surface to the GPU process. |
54 // | 54 // |
55 // The ImageTransportSurfaceHelper provides some glue to the outside world: | 55 // The ImageTransportSurfaceHelper provides some glue to the outside world: |
56 // making sure outside events reach the ImageTransportSurface and | 56 // making sure outside events reach the ImageTransportSurface and |
57 // allowing the ImageTransportSurface to send events to the outside world. | 57 // allowing the ImageTransportSurface to send events to the outside world. |
58 | 58 |
59 class ImageTransportSurface { | 59 class ImageTransportSurface { |
60 public: | 60 public: |
61 ImageTransportSurface(); | 61 ImageTransportSurface(); |
62 virtual ~ImageTransportSurface(); | |
63 | 62 |
64 virtual void OnNewSurfaceACK( | 63 virtual void OnNewSurfaceACK( |
65 uint64 surface_id, TransportDIB::Handle surface_handle) = 0; | 64 uint64 surface_id, TransportDIB::Handle surface_handle) = 0; |
66 virtual void OnBuffersSwappedACK() = 0; | 65 virtual void OnBuffersSwappedACK() = 0; |
67 virtual void OnPostSubBufferACK() = 0; | 66 virtual void OnPostSubBufferACK() = 0; |
68 virtual void OnResizeViewACK() = 0; | 67 virtual void OnResizeViewACK() = 0; |
69 virtual void OnResize(gfx::Size size) = 0; | 68 virtual void OnResize(gfx::Size size) = 0; |
70 | 69 |
71 // Creates the appropriate surface depending on the GL implementation. | 70 // Creates the appropriate surface depending on the GL implementation. |
72 static scoped_refptr<gfx::GLSurface> | 71 static scoped_refptr<gfx::GLSurface> |
73 CreateSurface(GpuChannelManager* manager, | 72 CreateSurface(GpuChannelManager* manager, |
74 GpuCommandBufferStub* stub, | 73 GpuCommandBufferStub* stub, |
75 const gfx::GLSurfaceHandle& handle); | 74 const gfx::GLSurfaceHandle& handle); |
76 protected: | 75 protected: |
77 // Used by certain implements of PostSubBuffer to determine | 76 // Used by certain implements of PostSubBuffer to determine |
78 // how much needs to be copied between frames. | 77 // how much needs to be copied between frames. |
79 void GetRegionsToCopy(const gfx::Rect& previous_damage_rect, | 78 void GetRegionsToCopy(const gfx::Rect& previous_damage_rect, |
80 const gfx::Rect& new_damage_rect, | 79 const gfx::Rect& new_damage_rect, |
81 std::vector<gfx::Rect>* regions); | 80 std::vector<gfx::Rect>* regions); |
82 | 81 |
| 82 protected: |
| 83 virtual ~ImageTransportSurface(); |
| 84 |
83 private: | 85 private: |
84 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurface); | 86 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurface); |
85 }; | 87 }; |
86 | 88 |
87 class ImageTransportHelper : public IPC::Channel::Listener { | 89 class ImageTransportHelper : public IPC::Channel::Listener { |
88 public: | 90 public: |
89 // Takes weak pointers to objects that outlive the helper. | 91 // Takes weak pointers to objects that outlive the helper. |
90 ImageTransportHelper(ImageTransportSurface* surface, | 92 ImageTransportHelper(ImageTransportSurface* surface, |
91 GpuChannelManager* manager, | 93 GpuChannelManager* manager, |
92 GpuCommandBufferStub* stub, | 94 GpuCommandBufferStub* stub, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 gfx::Size new_size_; | 184 gfx::Size new_size_; |
183 bool transport_; | 185 bool transport_; |
184 bool did_set_swap_interval_; | 186 bool did_set_swap_interval_; |
185 | 187 |
186 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 188 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
187 }; | 189 }; |
188 | 190 |
189 #endif // defined(ENABLE_GPU) | 191 #endif // defined(ENABLE_GPU) |
190 | 192 |
191 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 193 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |