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_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ | 5 #ifndef CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ |
6 #define CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ | 6 #define CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/threading/non_thread_safe.h" | 12 #include "base/threading/non_thread_safe.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
14 #include "cc/output_surface.h" | 14 #include "cc/output_surface.h" |
15 #include "cc/software_output_device.h" | 15 #include "cc/software_output_device.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class TaskRunner; | 18 class TaskRunner; |
19 } | 19 } |
20 | 20 |
21 namespace IPC { | 21 namespace IPC { |
22 class ForwardingMessageFilter; | 22 class ForwardingMessageFilter; |
23 class Message; | 23 class Message; |
24 } | 24 } |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 | 27 |
| 28 class CommandBufferProxyImpl; |
| 29 |
28 // This class can be created only on the main thread, but then becomes pinned | 30 // This class can be created only on the main thread, but then becomes pinned |
29 // to a fixed thread when bindToClient is called. | 31 // to a fixed thread when bindToClient is called. |
30 class CompositorOutputSurface | 32 class CompositorOutputSurface |
31 : NON_EXPORTED_BASE(public cc::OutputSurface), | 33 : NON_EXPORTED_BASE(public cc::OutputSurface), |
32 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 34 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
33 public: | 35 public: |
34 static IPC::ForwardingMessageFilter* CreateFilter( | 36 static IPC::ForwardingMessageFilter* CreateFilter( |
35 base::TaskRunner* target_task_runner); | 37 base::TaskRunner* target_task_runner); |
36 | 38 |
37 CompositorOutputSurface(int32 routing_id, | 39 CompositorOutputSurface(int32 routing_id, |
38 WebKit::WebGraphicsContext3D* context3d, | 40 WebKit::WebGraphicsContext3D* context3d, |
| 41 CommandBufferProxyImpl* command_buffer_proxy, |
39 cc::SoftwareOutputDevice* software); | 42 cc::SoftwareOutputDevice* software); |
40 virtual ~CompositorOutputSurface(); | 43 virtual ~CompositorOutputSurface(); |
41 | 44 |
42 // cc::OutputSurface implementation. | 45 // cc::OutputSurface implementation. |
43 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; | 46 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; |
44 virtual const struct Capabilities& Capabilities() const OVERRIDE; | 47 virtual const struct Capabilities& Capabilities() const OVERRIDE; |
45 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE; | 48 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE; |
46 virtual cc::SoftwareOutputDevice* SoftwareDevice() const OVERRIDE; | 49 virtual cc::SoftwareOutputDevice* SoftwareDevice() const OVERRIDE; |
47 virtual void SendFrameToParentCompositor( | 50 virtual void SendFrameToParentCompositor( |
48 const cc::CompositorFrame&) OVERRIDE; | 51 const cc::CompositorFrame&) OVERRIDE; |
| 52 virtual void SetLatencyInfo(const cc::LatencyInfo&) OVERRIDE; |
49 | 53 |
50 private: | 54 private: |
51 class CompositorOutputSurfaceProxy : | 55 class CompositorOutputSurfaceProxy : |
52 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { | 56 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { |
53 public: | 57 public: |
54 explicit CompositorOutputSurfaceProxy( | 58 explicit CompositorOutputSurfaceProxy( |
55 CompositorOutputSurface* output_surface) | 59 CompositorOutputSurface* output_surface) |
56 : output_surface_(output_surface) {} | 60 : output_surface_(output_surface) {} |
57 void ClearOutputSurface() { output_surface_ = NULL; } | 61 void ClearOutputSurface() { output_surface_ = NULL; } |
58 void OnMessageReceived(const IPC::Message& message) { | 62 void OnMessageReceived(const IPC::Message& message) { |
59 if (output_surface_) | 63 if (output_surface_) |
60 output_surface_->OnMessageReceived(message); | 64 output_surface_->OnMessageReceived(message); |
61 } | 65 } |
62 | 66 |
63 private: | 67 private: |
64 friend class base::RefCountedThreadSafe<CompositorOutputSurfaceProxy>; | 68 friend class base::RefCountedThreadSafe<CompositorOutputSurfaceProxy>; |
65 ~CompositorOutputSurfaceProxy() {} | 69 ~CompositorOutputSurfaceProxy() {} |
66 CompositorOutputSurface* output_surface_; | 70 CompositorOutputSurface* output_surface_; |
67 | 71 |
68 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy); | 72 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy); |
69 }; | 73 }; |
70 | 74 |
71 void OnMessageReceived(const IPC::Message& message); | 75 void OnMessageReceived(const IPC::Message& message); |
72 void OnUpdateVSyncParameters( | 76 void OnUpdateVSyncParameters( |
73 base::TimeTicks timebase, base::TimeDelta interval); | 77 base::TimeTicks timebase, base::TimeDelta interval); |
| 78 void OnReceivedLatencyInfo(const cc::LatencyInfo&); |
74 bool Send(IPC::Message* message); | 79 bool Send(IPC::Message* message); |
75 | 80 |
76 scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_; | 81 scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_; |
77 cc::OutputSurfaceClient* client_; | 82 cc::OutputSurfaceClient* client_; |
78 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; | 83 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; |
79 int routing_id_; | 84 int routing_id_; |
80 struct Capabilities capabilities_; | 85 struct Capabilities capabilities_; |
81 scoped_ptr<WebKit::WebGraphicsContext3D> context3D_; | 86 scoped_ptr<WebKit::WebGraphicsContext3D> context3D_; |
82 scoped_ptr<cc::SoftwareOutputDevice> software_device_; | 87 scoped_ptr<cc::SoftwareOutputDevice> software_device_; |
| 88 CommandBufferProxyImpl* command_buffer_proxy_; |
83 }; | 89 }; |
84 | 90 |
85 } // namespace content | 91 } // namespace content |
86 | 92 |
87 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ | 93 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ |
OLD | NEW |