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/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "cc/output_surface.h" | 15 #include "cc/output_surface.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 cc { |
| 27 class CompositorFrameAck; |
| 28 } |
| 29 |
26 namespace content { | 30 namespace content { |
27 | 31 |
28 // This class can be created only on the main thread, but then becomes pinned | 32 // This class can be created only on the main thread, but then becomes pinned |
29 // to a fixed thread when bindToClient is called. | 33 // to a fixed thread when bindToClient is called. |
30 class CompositorOutputSurface | 34 class CompositorOutputSurface |
31 : NON_EXPORTED_BASE(public cc::OutputSurface), | 35 : NON_EXPORTED_BASE(public cc::OutputSurface), |
32 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 36 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
33 public: | 37 public: |
34 static IPC::ForwardingMessageFilter* CreateFilter( | 38 static IPC::ForwardingMessageFilter* CreateFilter( |
35 base::TaskRunner* target_task_runner); | 39 base::TaskRunner* target_task_runner); |
36 | 40 |
37 CompositorOutputSurface(int32 routing_id, | 41 CompositorOutputSurface(int32 routing_id, |
38 WebKit::WebGraphicsContext3D* context3d, | 42 WebKit::WebGraphicsContext3D* context3d, |
39 cc::SoftwareOutputDevice* software); | 43 cc::SoftwareOutputDevice* software); |
40 virtual ~CompositorOutputSurface(); | 44 virtual ~CompositorOutputSurface(); |
41 | 45 |
42 // cc::OutputSurface implementation. | 46 // cc::OutputSurface implementation. |
43 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; | 47 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; |
44 virtual void SendFrameToParentCompositor(cc::CompositorFrame*) OVERRIDE; | 48 virtual void SendFrameToParentCompositor(cc::CompositorFrame*) OVERRIDE; |
45 | 49 |
46 // TODO(epenner): This seems out of place here and would be a better fit | 50 // TODO(epenner): This seems out of place here and would be a better fit |
47 // int CompositorThread after it is fully refactored (http://crbug/170828) | 51 // int CompositorThread after it is fully refactored (http://crbug/170828) |
48 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) OVERRIDE; | 52 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) OVERRIDE; |
49 | 53 |
| 54 protected: |
| 55 virtual void OnSwapAck(const cc::CompositorFrameAck& ack); |
| 56 |
50 private: | 57 private: |
51 class CompositorOutputSurfaceProxy : | 58 class CompositorOutputSurfaceProxy : |
52 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { | 59 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { |
53 public: | 60 public: |
54 explicit CompositorOutputSurfaceProxy( | 61 explicit CompositorOutputSurfaceProxy( |
55 CompositorOutputSurface* output_surface) | 62 CompositorOutputSurface* output_surface) |
56 : output_surface_(output_surface) {} | 63 : output_surface_(output_surface) {} |
57 void ClearOutputSurface() { output_surface_ = NULL; } | 64 void ClearOutputSurface() { output_surface_ = NULL; } |
58 void OnMessageReceived(const IPC::Message& message) { | 65 void OnMessageReceived(const IPC::Message& message) { |
59 if (output_surface_) | 66 if (output_surface_) |
(...skipping 16 matching lines...) Expand all Loading... |
76 scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_; | 83 scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_; |
77 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; | 84 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; |
78 int routing_id_; | 85 int routing_id_; |
79 bool prefers_smoothness_; | 86 bool prefers_smoothness_; |
80 base::PlatformThreadId main_thread_id_; | 87 base::PlatformThreadId main_thread_id_; |
81 }; | 88 }; |
82 | 89 |
83 } // namespace content | 90 } // namespace content |
84 | 91 |
85 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ | 92 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ |
OLD | NEW |