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 OnBufferPresented() = 0; | 65 virtual void OnBufferPresented() = 0; |
67 virtual void OnResizeViewACK() = 0; | 66 virtual void OnResizeViewACK() = 0; |
68 virtual void OnResize(gfx::Size size) = 0; | 67 virtual void OnResize(gfx::Size size) = 0; |
69 | 68 |
70 // Creates the appropriate surface depending on the GL implementation. | 69 // Creates the appropriate surface depending on the GL implementation. |
71 static scoped_refptr<gfx::GLSurface> | 70 static scoped_refptr<gfx::GLSurface> |
72 CreateSurface(GpuChannelManager* manager, | 71 CreateSurface(GpuChannelManager* manager, |
73 GpuCommandBufferStub* stub, | 72 GpuCommandBufferStub* stub, |
74 const gfx::GLSurfaceHandle& handle); | 73 const gfx::GLSurfaceHandle& handle); |
75 protected: | 74 protected: |
76 // Used by certain implements of PostSubBuffer to determine | 75 // Used by certain implements of PostSubBuffer to determine |
77 // how much needs to be copied between frames. | 76 // how much needs to be copied between frames. |
78 void GetRegionsToCopy(const gfx::Rect& previous_damage_rect, | 77 void GetRegionsToCopy(const gfx::Rect& previous_damage_rect, |
79 const gfx::Rect& new_damage_rect, | 78 const gfx::Rect& new_damage_rect, |
80 std::vector<gfx::Rect>* regions); | 79 std::vector<gfx::Rect>* regions); |
81 | 80 |
| 81 protected: |
| 82 virtual ~ImageTransportSurface(); |
| 83 |
82 private: | 84 private: |
83 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurface); | 85 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurface); |
84 }; | 86 }; |
85 | 87 |
86 class ImageTransportHelper : public IPC::Listener { | 88 class ImageTransportHelper : public IPC::Listener { |
87 public: | 89 public: |
88 // Takes weak pointers to objects that outlive the helper. | 90 // Takes weak pointers to objects that outlive the helper. |
89 ImageTransportHelper(ImageTransportSurface* surface, | 91 ImageTransportHelper(ImageTransportSurface* surface, |
90 GpuChannelManager* manager, | 92 GpuChannelManager* manager, |
91 GpuCommandBufferStub* stub, | 93 GpuCommandBufferStub* stub, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 gfx::Size new_size_; | 186 gfx::Size new_size_; |
185 bool transport_; | 187 bool transport_; |
186 bool did_set_swap_interval_; | 188 bool did_set_swap_interval_; |
187 | 189 |
188 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); | 190 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); |
189 }; | 191 }; |
190 | 192 |
191 #endif // defined(ENABLE_GPU) | 193 #endif // defined(ENABLE_GPU) |
192 | 194 |
193 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ | 195 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ |
OLD | NEW |