| 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 "content/browser/compositor/surface_display_output_surface.h" | 5 #include "content/browser/compositor/surface_display_output_surface.h" |
| 6 | 6 |
| 7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/surfaces/display.h" | 8 #include "cc/surfaces/display.h" |
| 9 #include "cc/surfaces/surface.h" | 9 #include "cc/surfaces/surface.h" |
| 10 #include "cc/surfaces/surface_manager.h" | 10 #include "cc/surfaces/surface_manager.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 capabilities_.max_frames_pending = 1; | 23 capabilities_.max_frames_pending = 1; |
| 24 } | 24 } |
| 25 | 25 |
| 26 SurfaceDisplayOutputSurface::~SurfaceDisplayOutputSurface() { | 26 SurfaceDisplayOutputSurface::~SurfaceDisplayOutputSurface() { |
| 27 } | 27 } |
| 28 | 28 |
| 29 void SurfaceDisplayOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { | 29 void SurfaceDisplayOutputSurface::SwapBuffers(cc::CompositorFrame* frame) { |
| 30 gfx::Size frame_size = | 30 gfx::Size frame_size = |
| 31 frame->delegated_frame_data->render_pass_list.back()->output_rect.size(); | 31 frame->delegated_frame_data->render_pass_list.back()->output_rect.size(); |
| 32 display_->Resize(frame_size); | 32 display_->Resize(frame_size); |
| 33 int surface_id = display_->CurrentSurfaceID(); | 33 cc::SurfaceId surface_id = display_->CurrentSurfaceId(); |
| 34 cc::Surface* surface = surface_manager_->GetSurfaceForID(surface_id); | 34 cc::Surface* surface = surface_manager_->GetSurfaceForId(surface_id); |
| 35 if (!surface) | 35 if (!surface) |
| 36 return; | 36 return; |
| 37 | 37 |
| 38 scoped_ptr<cc::CompositorFrame> frame_copy(new cc::CompositorFrame()); | 38 scoped_ptr<cc::CompositorFrame> frame_copy(new cc::CompositorFrame()); |
| 39 frame->AssignTo(frame_copy.get()); | 39 frame->AssignTo(frame_copy.get()); |
| 40 surface->QueueFrame(frame_copy.Pass()); | 40 surface->QueueFrame(frame_copy.Pass()); |
| 41 | 41 |
| 42 if (!display_->Draw()) | 42 if (!display_->Draw()) |
| 43 return; | 43 return; |
| 44 | 44 |
| 45 client_->DidSwapBuffers(); | 45 client_->DidSwapBuffers(); |
| 46 client_->DidSwapBuffersComplete(); | 46 client_->DidSwapBuffersComplete(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 } // namespace content | 49 } // namespace content |
| OLD | NEW |