| 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 <stdint.h> |
| 9 |
| 9 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 13 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
| 14 #include "base/threading/platform_thread.h" | 16 #include "base/threading/platform_thread.h" |
| 15 #include "base/time/time.h" | 17 #include "base/time/time.h" |
| 18 #include "build/build_config.h" |
| 16 #include "cc/output/begin_frame_args.h" | 19 #include "cc/output/begin_frame_args.h" |
| 17 #include "cc/output/output_surface.h" | 20 #include "cc/output/output_surface.h" |
| 18 #include "content/renderer/gpu/compositor_forwarding_message_filter.h" | 21 #include "content/renderer/gpu/compositor_forwarding_message_filter.h" |
| 19 #include "ipc/ipc_sync_message_filter.h" | 22 #include "ipc/ipc_sync_message_filter.h" |
| 20 | 23 |
| 21 namespace IPC { | 24 namespace IPC { |
| 22 class Message; | 25 class Message; |
| 23 } | 26 } |
| 24 | 27 |
| 25 namespace cc { | 28 namespace cc { |
| 26 class CompositorFrame; | 29 class CompositorFrame; |
| 27 class CompositorFrameAck; | 30 class CompositorFrameAck; |
| 28 class GLFrameData; | 31 class GLFrameData; |
| 29 } | 32 } |
| 30 | 33 |
| 31 namespace content { | 34 namespace content { |
| 32 class ContextProviderCommandBuffer; | 35 class ContextProviderCommandBuffer; |
| 33 class FrameSwapMessageQueue; | 36 class FrameSwapMessageQueue; |
| 34 | 37 |
| 35 // This class can be created only on the main thread, but then becomes pinned | 38 // This class can be created only on the main thread, but then becomes pinned |
| 36 // to a fixed thread when bindToClient is called. | 39 // to a fixed thread when bindToClient is called. |
| 37 class CompositorOutputSurface | 40 class CompositorOutputSurface |
| 38 : NON_EXPORTED_BASE(public cc::OutputSurface), | 41 : NON_EXPORTED_BASE(public cc::OutputSurface), |
| 39 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 42 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 40 public: | 43 public: |
| 41 CompositorOutputSurface( | 44 CompositorOutputSurface( |
| 42 int32 routing_id, | 45 int32_t routing_id, |
| 43 uint32 output_surface_id, | 46 uint32_t output_surface_id, |
| 44 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, | 47 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, |
| 45 const scoped_refptr<ContextProviderCommandBuffer>& | 48 const scoped_refptr<ContextProviderCommandBuffer>& |
| 46 worker_context_provider, | 49 worker_context_provider, |
| 47 scoped_ptr<cc::SoftwareOutputDevice> software, | 50 scoped_ptr<cc::SoftwareOutputDevice> software, |
| 48 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue, | 51 scoped_refptr<FrameSwapMessageQueue> swap_frame_message_queue, |
| 49 bool use_swap_compositor_frame_message); | 52 bool use_swap_compositor_frame_message); |
| 50 ~CompositorOutputSurface() override; | 53 ~CompositorOutputSurface() override; |
| 51 | 54 |
| 52 // cc::OutputSurface implementation. | 55 // cc::OutputSurface implementation. |
| 53 bool BindToClient(cc::OutputSurfaceClient* client) override; | 56 bool BindToClient(cc::OutputSurfaceClient* client) override; |
| 54 void DetachFromClient() override; | 57 void DetachFromClient() override; |
| 55 void SwapBuffers(cc::CompositorFrame* frame) override; | 58 void SwapBuffers(cc::CompositorFrame* frame) override; |
| 56 | 59 |
| 57 // TODO(epenner): This seems out of place here and would be a better fit | 60 // TODO(epenner): This seems out of place here and would be a better fit |
| 58 // int CompositorThread after it is fully refactored (http://crbug/170828) | 61 // int CompositorThread after it is fully refactored (http://crbug/170828) |
| 59 void UpdateSmoothnessTakesPriority(bool prefer_smoothness) override; | 62 void UpdateSmoothnessTakesPriority(bool prefer_smoothness) override; |
| 60 | 63 |
| 61 protected: | 64 protected: |
| 62 void ShortcutSwapAck(uint32 output_surface_id, | 65 void ShortcutSwapAck(uint32_t output_surface_id, |
| 63 scoped_ptr<cc::GLFrameData> gl_frame_data); | 66 scoped_ptr<cc::GLFrameData> gl_frame_data); |
| 64 virtual void OnSwapAck(uint32 output_surface_id, | 67 virtual void OnSwapAck(uint32_t output_surface_id, |
| 65 const cc::CompositorFrameAck& ack); | 68 const cc::CompositorFrameAck& ack); |
| 66 virtual void OnReclaimResources(uint32 output_surface_id, | 69 virtual void OnReclaimResources(uint32_t output_surface_id, |
| 67 const cc::CompositorFrameAck& ack); | 70 const cc::CompositorFrameAck& ack); |
| 68 uint32 output_surface_id_; | 71 uint32_t output_surface_id_; |
| 69 | 72 |
| 70 private: | 73 private: |
| 71 class CompositorOutputSurfaceProxy : | 74 class CompositorOutputSurfaceProxy : |
| 72 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { | 75 public base::RefCountedThreadSafe<CompositorOutputSurfaceProxy> { |
| 73 public: | 76 public: |
| 74 explicit CompositorOutputSurfaceProxy( | 77 explicit CompositorOutputSurfaceProxy( |
| 75 CompositorOutputSurface* output_surface) | 78 CompositorOutputSurface* output_surface) |
| 76 : output_surface_(output_surface) {} | 79 : output_surface_(output_surface) {} |
| 77 void ClearOutputSurface() { output_surface_ = NULL; } | 80 void ClearOutputSurface() { output_surface_ = NULL; } |
| 78 void OnMessageReceived(const IPC::Message& message) { | 81 void OnMessageReceived(const IPC::Message& message) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 108 | 111 |
| 109 // TODO(danakj): Remove this when crbug.com/311404 | 112 // TODO(danakj): Remove this when crbug.com/311404 |
| 110 bool layout_test_mode_; | 113 bool layout_test_mode_; |
| 111 scoped_ptr<cc::CompositorFrameAck> layout_test_previous_frame_ack_; | 114 scoped_ptr<cc::CompositorFrameAck> layout_test_previous_frame_ack_; |
| 112 base::WeakPtrFactory<CompositorOutputSurface> weak_ptrs_; | 115 base::WeakPtrFactory<CompositorOutputSurface> weak_ptrs_; |
| 113 }; | 116 }; |
| 114 | 117 |
| 115 } // namespace content | 118 } // namespace content |
| 116 | 119 |
| 117 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ | 120 #endif // CONTENT_RENDERER_GPU_COMPOSITOR_OUTPUT_SURFACE_H_ |
| OLD | NEW |