| 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/memory/weak_ptr.h" |
| 12 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
| 13 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
| 14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 15 #include "cc/output/begin_frame_args.h" | 16 #include "cc/output/begin_frame_args.h" |
| 16 #include "cc/output/output_surface.h" | 17 #include "cc/output/output_surface.h" |
| 17 #include "ipc/ipc_sync_message_filter.h" | 18 #include "ipc/ipc_sync_message_filter.h" |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 class TaskRunner; | 21 class TaskRunner; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace IPC { | 24 namespace IPC { |
| 24 class ForwardingMessageFilter; | 25 class ForwardingMessageFilter; |
| 25 class Message; | 26 class Message; |
| 26 } | 27 } |
| 27 | 28 |
| 28 namespace cc { | 29 namespace cc { |
| 29 class CompositorFrame; | 30 class CompositorFrame; |
| 30 class CompositorFrameAck; | 31 class CompositorFrameAck; |
| 32 class GLFrameData; |
| 33 class SoftwareFrameData; |
| 31 } | 34 } |
| 32 | 35 |
| 33 namespace content { | 36 namespace content { |
| 34 class ContextProviderCommandBuffer; | 37 class ContextProviderCommandBuffer; |
| 35 | 38 |
| 36 // This class can be created only on the main thread, but then becomes pinned | 39 // This class can be created only on the main thread, but then becomes pinned |
| 37 // to a fixed thread when bindToClient is called. | 40 // to a fixed thread when bindToClient is called. |
| 38 class CompositorOutputSurface | 41 class CompositorOutputSurface |
| 39 : NON_EXPORTED_BASE(public cc::OutputSurface), | 42 : NON_EXPORTED_BASE(public cc::OutputSurface), |
| 40 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 43 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 55 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE; | 58 virtual void SwapBuffers(cc::CompositorFrame* frame) OVERRIDE; |
| 56 #if defined(OS_ANDROID) | 59 #if defined(OS_ANDROID) |
| 57 virtual void SetNeedsBeginImplFrame(bool enable) OVERRIDE; | 60 virtual void SetNeedsBeginImplFrame(bool enable) OVERRIDE; |
| 58 #endif | 61 #endif |
| 59 | 62 |
| 60 // TODO(epenner): This seems out of place here and would be a better fit | 63 // TODO(epenner): This seems out of place here and would be a better fit |
| 61 // int CompositorThread after it is fully refactored (http://crbug/170828) | 64 // int CompositorThread after it is fully refactored (http://crbug/170828) |
| 62 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) OVERRIDE; | 65 virtual void UpdateSmoothnessTakesPriority(bool prefer_smoothness) OVERRIDE; |
| 63 | 66 |
| 64 protected: | 67 protected: |
| 68 void ShortcutSwapAck(uint32 output_surface_id, |
| 69 scoped_ptr<cc::GLFrameData> gl_frame_data, |
| 70 scoped_ptr<cc::SoftwareFrameData> software_frame_data); |
| 65 virtual void OnSwapAck(uint32 output_surface_id, | 71 virtual void OnSwapAck(uint32 output_surface_id, |
| 66 const cc::CompositorFrameAck& ack); | 72 const cc::CompositorFrameAck& ack); |
| 67 virtual void OnReclaimResources(uint32 output_surface_id, | 73 virtual void OnReclaimResources(uint32 output_surface_id, |
| 68 const cc::CompositorFrameAck& ack); | 74 const cc::CompositorFrameAck& ack); |
| 69 uint32 output_surface_id_; | 75 uint32 output_surface_id_; |
| 70 | 76 |
| 71 private: | 77 private: |
| 72 class CompositorOutputSurfaceProxy : | 78 class CompositorOutputSurfaceProxy : |
| 73 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { | 79 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { |
| 74 public: | 80 public: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 98 bool Send(IPC::Message* message); | 104 bool Send(IPC::Message* message); |
| 99 | 105 |
| 100 bool use_swap_compositor_frame_message_; | 106 bool use_swap_compositor_frame_message_; |
| 101 | 107 |
| 102 scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_; | 108 scoped_refptr<IPC::ForwardingMessageFilter> output_surface_filter_; |
| 103 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; | 109 scoped_refptr<CompositorOutputSurfaceProxy> output_surface_proxy_; |
| 104 scoped_refptr<IPC::SyncMessageFilter> message_sender_; | 110 scoped_refptr<IPC::SyncMessageFilter> message_sender_; |
| 105 int routing_id_; | 111 int routing_id_; |
| 106 bool prefers_smoothness_; | 112 bool prefers_smoothness_; |
| 107 base::PlatformThreadHandle main_thread_handle_; | 113 base::PlatformThreadHandle main_thread_handle_; |
| 114 |
| 115 // TODO(danakj): Remove this when crbug.com/311404 |
| 116 bool layout_test_mode_; |
| 117 scoped_ptr<cc::CompositorFrameAck> layout_test_previous_frame_ack_; |
| 118 base::WeakPtrFactory<CompositorOutputSurface> weak_ptrs_; |
| 108 }; | 119 }; |
| 109 | 120 |
| 110 } // namespace content | 121 } // namespace content |
| 111 | 122 |
| 112 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ | 123 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ |
| OLD | NEW |