Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: content/common/gpu/image_transport_surface.h

Issue 8625003: Revert 111040 - Reland 110355 - Use shared D3D9 texture to transport the compositor's backing buf... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/common/gpu/gpu_messages.h ('k') | content/common/gpu/image_transport_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/callback.h"
12 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "ipc/ipc_channel.h" 12 #include "ipc/ipc_channel.h"
15 #include "ipc/ipc_message.h" 13 #include "ipc/ipc_message.h"
16 #include "ui/gfx/gl/gl_surface.h"
17 #include "ui/gfx/size.h" 14 #include "ui/gfx/size.h"
18 #include "ui/gfx/native_widget_types.h" 15 #include "ui/gfx/native_widget_types.h"
19 #include "ui/gfx/surface/transport_dib.h" 16 #include "ui/gfx/surface/transport_dib.h"
20 17
21 class GpuChannelManager; 18 class GpuChannelManager;
22 19
23 struct GpuHostMsg_AcceleratedSurfaceNew_Params; 20 struct GpuHostMsg_AcceleratedSurfaceNew_Params;
24 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; 21 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params;
25 struct GpuHostMsg_AcceleratedSurfaceRelease_Params; 22 struct GpuHostMsg_AcceleratedSurfaceRelease_Params;
26 23
(...skipping 17 matching lines...) Expand all
44 // The ImageTransportSurface class defines an simple interface for events that 41 // The ImageTransportSurface class defines an simple interface for events that
45 // should be responded to. The factory returns an offscreen surface that looks 42 // should be responded to. The factory returns an offscreen surface that looks
46 // a lot like an onscreen surface to the GPU process. 43 // a lot like an onscreen surface to the GPU process.
47 // 44 //
48 // The ImageTransportSurfaceHelper provides some glue to the outside world: 45 // The ImageTransportSurfaceHelper provides some glue to the outside world:
49 // making sure outside events reach the ImageTransportSurface and 46 // making sure outside events reach the ImageTransportSurface and
50 // allowing the ImageTransportSurface to send events to the outside world. 47 // allowing the ImageTransportSurface to send events to the outside world.
51 48
52 class ImageTransportSurface { 49 class ImageTransportSurface {
53 public: 50 public:
54 ImageTransportSurface();
55 virtual ~ImageTransportSurface();
56
57 virtual void OnNewSurfaceACK( 51 virtual void OnNewSurfaceACK(
58 uint64 surface_id, TransportDIB::Handle surface_handle) = 0; 52 uint64 surface_id, TransportDIB::Handle surface_handle) = 0;
59 virtual void OnBuffersSwappedACK() = 0; 53 virtual void OnBuffersSwappedACK() = 0;
60 virtual void OnResizeViewACK() = 0;
61 virtual void OnResize(gfx::Size size) = 0; 54 virtual void OnResize(gfx::Size size) = 0;
62 55
63 // Creates the appropriate surface depending on the GL implementation. 56 // Creates the appropriate surface depending on the GL implementation.
64 static scoped_refptr<gfx::GLSurface> 57 static scoped_refptr<gfx::GLSurface>
65 CreateSurface(GpuChannelManager* manager, 58 CreateSurface(GpuChannelManager* manager,
66 int32 render_view_id, 59 int32 render_view_id,
67 int32 renderer_id, 60 int32 renderer_id,
68 int32 command_buffer_id, 61 int32 command_buffer_id,
69 gfx::PluginWindowHandle handle); 62 gfx::PluginWindowHandle handle);
70 private:
71 DISALLOW_COPY_AND_ASSIGN(ImageTransportSurface);
72 }; 63 };
73 64
74 class ImageTransportHelper : public IPC::Channel::Listener { 65 class ImageTransportHelper : public IPC::Channel::Listener {
75 public: 66 public:
76 // Takes weak pointers to objects that outlive the helper. 67 // Takes weak pointers to objects that outlive the helper.
77 ImageTransportHelper(ImageTransportSurface* surface, 68 ImageTransportHelper(ImageTransportSurface* surface,
78 GpuChannelManager* manager, 69 GpuChannelManager* manager,
79 int32 render_view_id, 70 int32 render_view_id,
80 int32 renderer_id, 71 int32 renderer_id,
81 int32 command_buffer_id, 72 int32 command_buffer_id,
82 gfx::PluginWindowHandle handle); 73 gfx::PluginWindowHandle handle);
83 virtual ~ImageTransportHelper(); 74 virtual ~ImageTransportHelper();
84 75
85 bool Initialize(); 76 bool Initialize();
86 void Destroy(); 77 void Destroy();
87 78
88 // IPC::Channel::Listener implementation: 79 // IPC::Channel::Listener implementation:
89 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 80 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
90 81
91 // Helper send functions. Caller fills in the surface specific params 82 // Helper send functions. Caller fills in the surface specific params
92 // like size and surface id. The helper fills in the rest. 83 // like size and surface id. The helper fills in the rest.
93 void SendAcceleratedSurfaceNew( 84 void SendAcceleratedSurfaceNew(
94 GpuHostMsg_AcceleratedSurfaceNew_Params params); 85 GpuHostMsg_AcceleratedSurfaceNew_Params params);
95 void SendAcceleratedSurfaceBuffersSwapped( 86 void SendAcceleratedSurfaceBuffersSwapped(
96 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); 87 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params);
97 void SendAcceleratedSurfaceRelease( 88 void SendAcceleratedSurfaceRelease(
98 GpuHostMsg_AcceleratedSurfaceRelease_Params params); 89 GpuHostMsg_AcceleratedSurfaceRelease_Params params);
99 void SendResizeView(const gfx::Size& size);
100 90
101 // Whether or not we should execute more commands. 91 // Whether or not we should execute more commands.
102 void SetScheduled(bool is_scheduled); 92 void SetScheduled(bool is_scheduled);
103 93
104 void DeferToFence(base::Closure task);
105
106 // Make the surface's context current. 94 // Make the surface's context current.
107 bool MakeCurrent(); 95 bool MakeCurrent();
108 96
109 private: 97 private:
110 gpu::GpuScheduler* Scheduler(); 98 gpu::GpuScheduler* Scheduler();
111 gpu::gles2::GLES2Decoder* Decoder(); 99 gpu::gles2::GLES2Decoder* Decoder();
112 100
113 // IPC::Message handlers. 101 // IPC::Message handlers.
114 void OnNewSurfaceACK(uint64 surface_id, TransportDIB::Handle surface_handle); 102 void OnNewSurfaceACK(uint64 surface_id, TransportDIB::Handle surface_handle);
115 void OnBuffersSwappedACK(); 103 void OnBuffersSwappedACK();
116 void OnResizeViewACK();
117 104
118 // Backbuffer resize callback. 105 // Backbuffer resize callback.
119 void Resize(gfx::Size size); 106 void Resize(gfx::Size size);
120 107
121 // Set the default swap interval on the surface.
122 void SetSwapInterval();
123
124 // Weak pointers that point to objects that outlive this helper. 108 // Weak pointers that point to objects that outlive this helper.
125 ImageTransportSurface* surface_; 109 ImageTransportSurface* surface_;
126 GpuChannelManager* manager_; 110 GpuChannelManager* manager_;
127 111
128 int32 render_view_id_; 112 int32 render_view_id_;
129 int32 renderer_id_; 113 int32 renderer_id_;
130 int32 command_buffer_id_; 114 int32 command_buffer_id_;
131 int32 route_id_; 115 int32 route_id_;
132 gfx::PluginWindowHandle handle_; 116 gfx::PluginWindowHandle handle_;
133 117
134 DISALLOW_COPY_AND_ASSIGN(ImageTransportHelper); 118 DISALLOW_COPY_AND_ASSIGN(ImageTransportHelper);
135 }; 119 };
136 120
137 // An implementation of ImageTransportSurface that implements GLSurface through
138 // GLSurfaceAdapter, thereby forwarding GLSurface methods through to it.
139 class PassThroughImageTransportSurface
140 : public gfx::GLSurfaceAdapter,
141 public ImageTransportSurface {
142 public:
143 PassThroughImageTransportSurface(GpuChannelManager* manager,
144 int32 render_view_id,
145 int32 renderer_id,
146 int32 command_buffer_id,
147 gfx::GLSurface* surface);
148 virtual ~PassThroughImageTransportSurface();
149
150 // GLSurface implementation.
151 virtual bool Initialize();
152 virtual void Destroy();
153
154 // ImageTransportSurface implementation.
155 virtual void OnNewSurfaceACK(
156 uint64 surface_id, TransportDIB::Handle surface_handle) OVERRIDE;
157 virtual void OnBuffersSwappedACK() OVERRIDE;
158 virtual void OnResizeViewACK() OVERRIDE;
159 virtual void OnResize(gfx::Size size) OVERRIDE;
160
161 private:
162 scoped_ptr<ImageTransportHelper> helper_;
163
164 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface);
165 };
166
167 #endif // defined(ENABLE_GPU) 121 #endif // defined(ENABLE_GPU)
168 122
169 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ 123 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_messages.h ('k') | content/common/gpu/image_transport_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698