| 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 "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput
Surface.h" | 14 #include "cc/output_surface.h" |
| 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorSoftwa
reOutputDevice.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 // This class can be created only on the main thread, but then becomes pinned | 28 // This class can be created only on the main thread, but then becomes pinned |
| 29 // to a fixed thread when bindToClient is called. | 29 // to a fixed thread when bindToClient is called. |
| 30 class CompositorOutputSurface | 30 class CompositorOutputSurface |
| 31 : NON_EXPORTED_BASE(public WebKit::WebCompositorOutputSurface), | 31 : NON_EXPORTED_BASE(public cc::OutputSurface), |
| 32 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 32 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 33 public: | 33 public: |
| 34 static IPC::ForwardingMessageFilter* CreateFilter( | 34 static IPC::ForwardingMessageFilter* CreateFilter( |
| 35 base::TaskRunner* target_task_runner); | 35 base::TaskRunner* target_task_runner); |
| 36 | 36 |
| 37 CompositorOutputSurface(int32 routing_id, | 37 CompositorOutputSurface(int32 routing_id, |
| 38 WebKit::WebGraphicsContext3D* context3d, | 38 WebKit::WebGraphicsContext3D* context3d, |
| 39 WebKit::WebCompositorSoftwareOutputDevice* software); | 39 cc::SoftwareOutputDevice* software); |
| 40 virtual ~CompositorOutputSurface(); | 40 virtual ~CompositorOutputSurface(); |
| 41 | 41 |
| 42 // WebCompositorOutputSurface implementation. | 42 // cc::OutputSurface implementation. |
| 43 virtual bool bindToClient( | 43 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; |
| 44 WebKit::WebCompositorOutputSurfaceClient* client) OVERRIDE; | 44 virtual const struct Capabilities& Capabilities() const OVERRIDE; |
| 45 virtual const Capabilities& capabilities() const OVERRIDE; | 45 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE; |
| 46 virtual WebKit::WebGraphicsContext3D* context3D() const OVERRIDE; | 46 virtual cc::SoftwareOutputDevice* SoftwareDevice() const OVERRIDE; |
| 47 virtual WebKit::WebCompositorSoftwareOutputDevice* softwareDevice() const; | 47 virtual void SendFrameToParentCompositor( |
| 48 virtual void sendFrameToParentCompositor( | 48 const cc::CompositorFrame&) OVERRIDE; |
| 49 const WebKit::WebCompositorFrame&) OVERRIDE; | |
| 50 | 49 |
| 51 private: | 50 private: |
| 52 class CompositorOutputSurfaceProxy : | 51 class CompositorOutputSurfaceProxy : |
| 53 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { | 52 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { |
| 54 public: | 53 public: |
| 55 explicit CompositorOutputSurfaceProxy( | 54 explicit CompositorOutputSurfaceProxy( |
| 56 CompositorOutputSurface* output_surface) | 55 CompositorOutputSurface* output_surface) |
| 57 : output_surface_(output_surface) {} | 56 : output_surface_(output_surface) {} |
| 58 void ClearOutputSurface() { output_surface_ = NULL; } | 57 void ClearOutputSurface() { output_surface_ = NULL; } |
| 59 void OnMessageReceived(const IPC::Message& message) { | 58 void OnMessageReceived(const IPC::Message& message) { |
| 60 if (output_surface_) | 59 if (output_surface_) |
| 61 output_surface_->OnMessageReceived(message); | 60 output_surface_->OnMessageReceived(message); |
| 62 } | 61 } |
| 63 | 62 |
| 64 private: | 63 private: |
| 65 friend class base::RefCountedThreadSafe<CompositorOutputSurfaceProxy>; | 64 friend class base::RefCountedThreadSafe<CompositorOutputSurfaceProxy>; |
| 66 ~CompositorOutputSurfaceProxy() {} | 65 ~CompositorOutputSurfaceProxy() {} |
| 67 CompositorOutputSurface* output_surface_; | 66 CompositorOutputSurface* output_surface_; |
| 68 | 67 |
| 69 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy); | 68 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy); |
| 70 }; | 69 }; |
| 71 | 70 |
| 72 void OnMessageReceived(const IPC::Message& message); | 71 void OnMessageReceived(const IPC::Message& message); |
| 73 void OnUpdateVSyncParameters( | 72 void OnUpdateVSyncParameters( |
| 74 base::TimeTicks timebase, base::TimeDelta interval); | 73 base::TimeTicks timebase, base::TimeDelta interval); |
| 75 | 74 |
| 76 scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_; | 75 scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_; |
| 77 WebKit::WebCompositorOutputSurfaceClient* client_; | 76 cc::OutputSurfaceClient* client_; |
| 78 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; | 77 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; |
| 79 int routing_id_; | 78 int routing_id_; |
| 80 Capabilities capabilities_; | 79 struct Capabilities capabilities_; |
| 81 scoped_ptr<WebKit::WebGraphicsContext3D> context3D_; | 80 scoped_ptr<WebKit::WebGraphicsContext3D> context3D_; |
| 82 scoped_ptr<WebKit::WebCompositorSoftwareOutputDevice> software_device_; | 81 scoped_ptr<cc::SoftwareOutputDevice> software_device_; |
| 83 }; | 82 }; |
| 84 | 83 |
| 85 } // namespace content | 84 } // namespace content |
| 86 | 85 |
| 87 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ | 86 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ |
| OLD | NEW |