| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "cc/surfaces/direct_compositor_frame_sink.h" | 5 #include "cc/surfaces/direct_compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/output/compositor_frame_sink_client.h" | 9 #include "cc/output/compositor_frame_sink_client.h" |
| 10 #include "cc/surfaces/display.h" | 10 #include "cc/surfaces/display.h" |
| 11 #include "cc/surfaces/frame_sink_id.h" | 11 #include "cc/surfaces/frame_sink_id.h" |
| 12 #include "cc/surfaces/local_surface_id_allocator.h" |
| 12 #include "cc/surfaces/surface.h" | 13 #include "cc/surfaces/surface.h" |
| 13 #include "cc/surfaces/surface_id_allocator.h" | |
| 14 #include "cc/surfaces/surface_manager.h" | 14 #include "cc/surfaces/surface_manager.h" |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 | 17 |
| 18 DirectCompositorFrameSink::DirectCompositorFrameSink( | 18 DirectCompositorFrameSink::DirectCompositorFrameSink( |
| 19 const FrameSinkId& frame_sink_id, | 19 const FrameSinkId& frame_sink_id, |
| 20 SurfaceManager* surface_manager, | 20 SurfaceManager* surface_manager, |
| 21 Display* display, | 21 Display* display, |
| 22 scoped_refptr<ContextProvider> context_provider, | 22 scoped_refptr<ContextProvider> context_provider, |
| 23 scoped_refptr<ContextProvider> worker_context_provider, | 23 scoped_refptr<ContextProvider> worker_context_provider, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // Unregister the SurfaceFactoryClient here instead of the dtor so that only | 89 // Unregister the SurfaceFactoryClient here instead of the dtor so that only |
| 90 // one client is alive for this namespace at any given time. | 90 // one client is alive for this namespace at any given time. |
| 91 support_.reset(); | 91 support_.reset(); |
| 92 | 92 |
| 93 CompositorFrameSink::DetachFromClient(); | 93 CompositorFrameSink::DetachFromClient(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void DirectCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { | 96 void DirectCompositorFrameSink::SubmitCompositorFrame(CompositorFrame frame) { |
| 97 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); | 97 gfx::Size frame_size = frame.render_pass_list.back()->output_rect.size(); |
| 98 if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) { | 98 if (frame_size.IsEmpty() || frame_size != last_swap_frame_size_) { |
| 99 delegated_local_surface_id_ = surface_id_allocator_.GenerateId(); | 99 delegated_local_surface_id_ = local_surface_id_allocator_.GenerateId(); |
| 100 last_swap_frame_size_ = frame_size; | 100 last_swap_frame_size_ = frame_size; |
| 101 } | 101 } |
| 102 display_->SetLocalSurfaceId(delegated_local_surface_id_, | 102 display_->SetLocalSurfaceId(delegated_local_surface_id_, |
| 103 frame.metadata.device_scale_factor); | 103 frame.metadata.device_scale_factor); |
| 104 | 104 |
| 105 support_->SubmitCompositorFrame(delegated_local_surface_id_, | 105 support_->SubmitCompositorFrame(delegated_local_surface_id_, |
| 106 std::move(frame)); | 106 std::move(frame)); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void DirectCompositorFrameSink::ForceReclaimResources() { | 109 void DirectCompositorFrameSink::ForceReclaimResources() { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 const LocalSurfaceId& local_surface_id, | 144 const LocalSurfaceId& local_surface_id, |
| 145 const gfx::Rect& damage_rect) { | 145 const gfx::Rect& damage_rect) { |
| 146 // TODO(staraz): Implement this. | 146 // TODO(staraz): Implement this. |
| 147 } | 147 } |
| 148 | 148 |
| 149 void DirectCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frame) { | 149 void DirectCompositorFrameSink::OnNeedsBeginFrames(bool needs_begin_frame) { |
| 150 support_->SetNeedsBeginFrame(needs_begin_frame); | 150 support_->SetNeedsBeginFrame(needs_begin_frame); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace cc | 153 } // namespace cc |
| OLD | NEW |