| 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" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 WebKit::WebGraphicsContext3D* context3d, | 39 WebKit::WebGraphicsContext3D* context3d, |
| 40 cc::SoftwareOutputDevice* software); | 40 cc::SoftwareOutputDevice* software); |
| 41 virtual ~CompositorOutputSurface(); | 41 virtual ~CompositorOutputSurface(); |
| 42 | 42 |
| 43 // cc::OutputSurface implementation. | 43 // cc::OutputSurface implementation. |
| 44 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; | 44 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; |
| 45 virtual const struct Capabilities& Capabilities() const OVERRIDE; | 45 virtual const struct Capabilities& Capabilities() const OVERRIDE; |
| 46 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE; | 46 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE; |
| 47 virtual cc::SoftwareOutputDevice* SoftwareDevice() const OVERRIDE; | 47 virtual cc::SoftwareOutputDevice* SoftwareDevice() const OVERRIDE; |
| 48 virtual void SendFrameToParentCompositor(cc::CompositorFrame*) OVERRIDE; | 48 virtual void SendFrameToParentCompositor(cc::CompositorFrame*) OVERRIDE; |
| 49 virtual void EnableVSyncNotification(bool enable) OVERRIDE; |
| 49 | 50 |
| 50 // TODO(epenner): This seems out of place here and would be a better fit | 51 // TODO(epenner): This seems out of place here and would be a better fit |
| 51 // int CompositorThread after it is fully refactored (http://crbug/170828) | 52 // int CompositorThread after it is fully refactored (http://crbug/170828) |
| 52 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) OVERRIDE; | 53 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) OVERRIDE; |
| 53 | 54 |
| 54 private: | 55 private: |
| 55 class CompositorOutputSurfaceProxy : | 56 class CompositorOutputSurfaceProxy : |
| 56 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { | 57 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { |
| 57 public: | 58 public: |
| 58 explicit CompositorOutputSurfaceProxy( | 59 explicit CompositorOutputSurfaceProxy( |
| 59 CompositorOutputSurface* output_surface) | 60 CompositorOutputSurface* output_surface) |
| 60 : output_surface_(output_surface) {} | 61 : output_surface_(output_surface) {} |
| 61 void ClearOutputSurface() { output_surface_ = NULL; } | 62 void ClearOutputSurface() { output_surface_ = NULL; } |
| 62 void OnMessageReceived(const IPC::Message& message) { | 63 void OnMessageReceived(const IPC::Message& message) { |
| 63 if (output_surface_) | 64 if (output_surface_) |
| 64 output_surface_->OnMessageReceived(message); | 65 output_surface_->OnMessageReceived(message); |
| 65 } | 66 } |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 friend class base::RefCountedThreadSafe<CompositorOutputSurfaceProxy>; | 69 friend class base::RefCountedThreadSafe<CompositorOutputSurfaceProxy>; |
| 69 ~CompositorOutputSurfaceProxy() {} | 70 ~CompositorOutputSurfaceProxy() {} |
| 70 CompositorOutputSurface* output_surface_; | 71 CompositorOutputSurface* output_surface_; |
| 71 | 72 |
| 72 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy); | 73 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy); |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 void OnMessageReceived(const IPC::Message& message); | 76 void OnMessageReceived(const IPC::Message& message); |
| 76 void OnUpdateVSyncParameters( | 77 void OnUpdateVSyncParameters( |
| 77 base::TimeTicks timebase, base::TimeDelta interval); | 78 base::TimeTicks timebase, base::TimeDelta interval); |
| 79 void DidVSync(base::TimeTicks frame_time); |
| 78 bool Send(IPC::Message* message); | 80 bool Send(IPC::Message* message); |
| 79 | 81 |
| 80 scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_; | 82 scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_; |
| 81 cc::OutputSurfaceClient* client_; | 83 cc::OutputSurfaceClient* client_; |
| 82 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; | 84 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; |
| 83 int routing_id_; | 85 int routing_id_; |
| 84 struct Capabilities capabilities_; | 86 struct Capabilities capabilities_; |
| 85 scoped_ptr<WebKit::WebGraphicsContext3D> context3D_; | 87 scoped_ptr<WebKit::WebGraphicsContext3D> context3D_; |
| 86 scoped_ptr<cc::SoftwareOutputDevice> software_device_; | 88 scoped_ptr<cc::SoftwareOutputDevice> software_device_; |
| 87 bool prefers_smoothness_; | 89 bool prefers_smoothness_; |
| 88 base::PlatformThreadId main_thread_id_; | 90 base::PlatformThreadId main_thread_id_; |
| 89 }; | 91 }; |
| 90 | 92 |
| 91 } // namespace content | 93 } // namespace content |
| 92 | 94 |
| 93 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ | 95 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ |
| OLD | NEW |