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

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

Issue 11293121: Add latency measurement system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: create cc::LatencyInfo Created 7 years, 11 months 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) 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 7
8 #if defined(ENABLE_GPU) 8 #if defined(ENABLE_GPU)
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "ipc/ipc_listener.h" 17 #include "ipc/ipc_listener.h"
18 #include "ipc/ipc_message.h" 18 #include "ipc/ipc_message.h"
19 #include "ui/gfx/native_widget_types.h" 19 #include "ui/gfx/native_widget_types.h"
20 #include "ui/gfx/rect.h" 20 #include "ui/gfx/rect.h"
21 #include "ui/gfx/size.h" 21 #include "ui/gfx/size.h"
22 #include "ui/gl/gl_surface.h" 22 #include "ui/gl/gl_surface.h"
23 #include "ui/surface/transport_dib.h" 23 #include "ui/surface/transport_dib.h"
24 #include "webkit/compositor_bindings/web_latency_info_impl.h"
24 25
25 struct AcceleratedSurfaceMsg_BufferPresented_Params; 26 struct AcceleratedSurfaceMsg_BufferPresented_Params;
26 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; 27 struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params;
27 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params; 28 struct GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params;
28 struct GpuHostMsg_AcceleratedSurfaceRelease_Params; 29 struct GpuHostMsg_AcceleratedSurfaceRelease_Params;
29 30
30 namespace gfx { 31 namespace gfx {
31 class GLSurface; 32 class GLSurface;
32 } 33 }
33 34
(...skipping 23 matching lines...) Expand all
57 // allowing the ImageTransportSurface to send events to the outside world. 58 // allowing the ImageTransportSurface to send events to the outside world.
58 59
59 class ImageTransportSurface { 60 class ImageTransportSurface {
60 public: 61 public:
61 ImageTransportSurface(); 62 ImageTransportSurface();
62 63
63 virtual void OnBufferPresented( 64 virtual void OnBufferPresented(
64 const AcceleratedSurfaceMsg_BufferPresented_Params& params) = 0; 65 const AcceleratedSurfaceMsg_BufferPresented_Params& params) = 0;
65 virtual void OnResizeViewACK() = 0; 66 virtual void OnResizeViewACK() = 0;
66 virtual void OnResize(gfx::Size size) = 0; 67 virtual void OnResize(gfx::Size size) = 0;
68 virtual void SetLatencyInfo(
69 const cc::LatencyInfo& latency_info) = 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);
73 76
74 virtual gfx::Size GetSize() = 0; 77 virtual gfx::Size GetSize() = 0;
75 78
76 protected: 79 protected:
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 void SendAcceleratedSurfaceBuffersSwapped( 112 void SendAcceleratedSurfaceBuffersSwapped(
110 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params); 113 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params);
111 void SendAcceleratedSurfacePostSubBuffer( 114 void SendAcceleratedSurfacePostSubBuffer(
112 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params); 115 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params);
113 void SendAcceleratedSurfaceRelease( 116 void SendAcceleratedSurfaceRelease(
114 GpuHostMsg_AcceleratedSurfaceRelease_Params params); 117 GpuHostMsg_AcceleratedSurfaceRelease_Params params);
115 void SendResizeView(const gfx::Size& size); 118 void SendResizeView(const gfx::Size& size);
116 void SendUpdateVSyncParameters( 119 void SendUpdateVSyncParameters(
117 base::TimeTicks timebase, base::TimeDelta interval); 120 base::TimeTicks timebase, base::TimeDelta interval);
118 121
122 void SendLatencyInfo(const cc::LatencyInfo& latency_info);
123
119 // Whether or not we should execute more commands. 124 // Whether or not we should execute more commands.
120 void SetScheduled(bool is_scheduled); 125 void SetScheduled(bool is_scheduled);
121 126
122 void DeferToFence(base::Closure task); 127 void DeferToFence(base::Closure task);
123 128
124 void SetPreemptByCounter( 129 void SetPreemptByCounter(
125 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter); 130 scoped_refptr<gpu::RefCountedCounter> preempt_by_counter);
126 131
127 // Make the surface's context current. 132 // Make the surface's context current.
128 bool MakeCurrent(); 133 bool MakeCurrent();
129 134
130 // Set the default swap interval on the surface. 135 // Set the default swap interval on the surface.
131 static void SetSwapInterval(gfx::GLContext* context); 136 static void SetSwapInterval(gfx::GLContext* context);
132 137
133 void Suspend(); 138 void Suspend();
134 139
135 GpuChannelManager* manager() const { return manager_; } 140 GpuChannelManager* manager() const { return manager_; }
136 GpuCommandBufferStub* stub() const { return stub_.get(); } 141 GpuCommandBufferStub* stub() const { return stub_.get(); }
137 142
138 private: 143 private:
139 gpu::GpuScheduler* Scheduler(); 144 gpu::GpuScheduler* Scheduler();
140 gpu::gles2::GLES2Decoder* Decoder(); 145 gpu::gles2::GLES2Decoder* Decoder();
141 146
142 // IPC::Message handlers. 147 // IPC::Message handlers.
143 void OnBufferPresented( 148 void OnBufferPresented(
144 const AcceleratedSurfaceMsg_BufferPresented_Params& params); 149 const AcceleratedSurfaceMsg_BufferPresented_Params& params);
145 void OnResizeViewACK(); 150 void OnResizeViewACK();
151 void OnFrameDisplayed(const cc::LatencyInfo& latency_info);
146 152
147 // Backbuffer resize callback. 153 // Backbuffer resize callback.
148 void Resize(gfx::Size size); 154 void Resize(gfx::Size size);
149 155
156 void SetLatencyInfo(const cc::LatencyInfo& latency_info);
157
150 // Weak pointers that point to objects that outlive this helper. 158 // Weak pointers that point to objects that outlive this helper.
151 ImageTransportSurface* surface_; 159 ImageTransportSurface* surface_;
152 GpuChannelManager* manager_; 160 GpuChannelManager* manager_;
153 161
154 base::WeakPtr<GpuCommandBufferStub> stub_; 162 base::WeakPtr<GpuCommandBufferStub> stub_;
155 int32 route_id_; 163 int32 route_id_;
156 gfx::PluginWindowHandle handle_; 164 gfx::PluginWindowHandle handle_;
157 165
158 DISALLOW_COPY_AND_ASSIGN(ImageTransportHelper); 166 DISALLOW_COPY_AND_ASSIGN(ImageTransportHelper);
159 }; 167 };
(...skipping 15 matching lines...) Expand all
175 virtual bool SwapBuffers() OVERRIDE; 183 virtual bool SwapBuffers() OVERRIDE;
176 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; 184 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE;
177 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; 185 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE;
178 186
179 // ImageTransportSurface implementation. 187 // ImageTransportSurface implementation.
180 virtual void OnBufferPresented( 188 virtual void OnBufferPresented(
181 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; 189 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE;
182 virtual void OnResizeViewACK() OVERRIDE; 190 virtual void OnResizeViewACK() OVERRIDE;
183 virtual void OnResize(gfx::Size size) OVERRIDE; 191 virtual void OnResize(gfx::Size size) OVERRIDE;
184 virtual gfx::Size GetSize() OVERRIDE; 192 virtual gfx::Size GetSize() OVERRIDE;
193 virtual void SetLatencyInfo(
194 const cc::LatencyInfo& latency_info) OVERRIDE;
185 195
186 protected: 196 protected:
187 virtual ~PassThroughImageTransportSurface(); 197 virtual ~PassThroughImageTransportSurface();
188 198
189 // If updated vsync parameters can be determined, send this information to 199 // If updated vsync parameters can be determined, send this information to
190 // the browser. 200 // the browser.
191 virtual void SendVSyncUpdateIfAvailable(); 201 virtual void SendVSyncUpdateIfAvailable();
192 202
193 private: 203 private:
194 scoped_ptr<ImageTransportHelper> helper_; 204 scoped_ptr<ImageTransportHelper> helper_;
195 gfx::Size new_size_; 205 gfx::Size new_size_;
196 bool transport_; 206 bool transport_;
197 bool did_set_swap_interval_; 207 bool did_set_swap_interval_;
208 cc::LatencyInfo latency_info_;
198 209
199 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface); 210 DISALLOW_COPY_AND_ASSIGN(PassThroughImageTransportSurface);
200 }; 211 };
201 212
202 } // namespace content 213 } // namespace content
203 214
204 #endif // defined(ENABLE_GPU) 215 #endif // defined(ENABLE_GPU)
205 216
206 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_H_ 217 #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