| 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 #include "cc/software_output_device.h" | |
| 17 | 16 |
| 18 namespace base { | 17 namespace base { |
| 19 class TaskRunner; | 18 class TaskRunner; |
| 20 } | 19 } |
| 21 | 20 |
| 22 namespace IPC { | 21 namespace IPC { |
| 23 class ForwardingMessageFilter; | 22 class ForwardingMessageFilter; |
| 24 class Message; | 23 class Message; |
| 25 } | 24 } |
| 26 | 25 |
| 27 namespace content { | 26 namespace content { |
| 28 | 27 |
| 29 // 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 |
| 30 // to a fixed thread when bindToClient is called. | 29 // to a fixed thread when bindToClient is called. |
| 31 class CompositorOutputSurface | 30 class CompositorOutputSurface |
| 32 : NON_EXPORTED_BASE(public cc::OutputSurface), | 31 : NON_EXPORTED_BASE(public cc::OutputSurface), |
| 33 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 32 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 34 public: | 33 public: |
| 35 static IPC::ForwardingMessageFilter* CreateFilter( | 34 static IPC::ForwardingMessageFilter* CreateFilter( |
| 36 base::TaskRunner* target_task_runner); | 35 base::TaskRunner* target_task_runner); |
| 37 | 36 |
| 38 CompositorOutputSurface(int32 routing_id, | 37 CompositorOutputSurface(int32 routing_id, |
| 39 WebKit::WebGraphicsContext3D* context3d, | 38 WebKit::WebGraphicsContext3D* context3d, |
| 40 cc::SoftwareOutputDevice* software); | 39 cc::SoftwareOutputDevice* software); |
| 41 virtual ~CompositorOutputSurface(); | 40 virtual ~CompositorOutputSurface(); |
| 42 | 41 |
| 43 // cc::OutputSurface implementation. | 42 // cc::OutputSurface implementation. |
| 44 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; | 43 virtual bool BindToClient(cc::OutputSurfaceClient* client) OVERRIDE; |
| 45 virtual const struct Capabilities& Capabilities() const OVERRIDE; | |
| 46 virtual WebKit::WebGraphicsContext3D* Context3D() const OVERRIDE; | |
| 47 virtual cc::SoftwareOutputDevice* SoftwareDevice() const OVERRIDE; | |
| 48 virtual void SendFrameToParentCompositor(cc::CompositorFrame*) OVERRIDE; | 44 virtual void SendFrameToParentCompositor(cc::CompositorFrame*) OVERRIDE; |
| 49 | 45 |
| 50 // TODO(epenner): This seems out of place here and would be a better fit | 46 // 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) | 47 // int CompositorThread after it is fully refactored (http://crbug/170828) |
| 52 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) OVERRIDE; | 48 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) OVERRIDE; |
| 53 | 49 |
| 54 private: | 50 private: |
| 55 class CompositorOutputSurfaceProxy : | 51 class CompositorOutputSurfaceProxy : |
| 56 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { | 52 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { |
| 57 public: | 53 public: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 71 | 67 |
| 72 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy); | 68 DISALLOW_COPY_AND_ASSIGN(CompositorOutputSurfaceProxy); |
| 73 }; | 69 }; |
| 74 | 70 |
| 75 void OnMessageReceived(const IPC::Message& message); | 71 void OnMessageReceived(const IPC::Message& message); |
| 76 void OnUpdateVSyncParameters( | 72 void OnUpdateVSyncParameters( |
| 77 base::TimeTicks timebase, base::TimeDelta interval); | 73 base::TimeTicks timebase, base::TimeDelta interval); |
| 78 bool Send(IPC::Message* message); | 74 bool Send(IPC::Message* message); |
| 79 | 75 |
| 80 scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_; | 76 scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_; |
| 81 cc::OutputSurfaceClient* client_; | |
| 82 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; | 77 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; |
| 83 int routing_id_; | 78 int routing_id_; |
| 84 struct Capabilities capabilities_; | |
| 85 scoped_ptr<WebKit::WebGraphicsContext3D> context3D_; | |
| 86 scoped_ptr<cc::SoftwareOutputDevice> software_device_; | |
| 87 bool prefers_smoothness_; | 79 bool prefers_smoothness_; |
| 88 base::PlatformThreadId main_thread_id_; | 80 base::PlatformThreadId main_thread_id_; |
| 89 }; | 81 }; |
| 90 | 82 |
| 91 } // namespace content | 83 } // namespace content |
| 92 | 84 |
| 93 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ | 85 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ |
| OLD | NEW |