| 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/output/compositor_frame_ack.h" | 8 #include "cc/output/compositor_frame_ack.h" |
| 9 #include "cc/surfaces/display.h" | 9 #include "cc/surfaces/display.h" |
| 10 #include "cc/surfaces/surface.h" | 10 #include "cc/surfaces/surface.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 gfx::Size frame_size = | 44 gfx::Size frame_size = |
| 45 frame->delegated_frame_data->render_pass_list.back()->output_rect.size(); | 45 frame->delegated_frame_data->render_pass_list.back()->output_rect.size(); |
| 46 if (frame_size != display_size_) { | 46 if (frame_size != display_size_) { |
| 47 if (!surface_id_.is_null()) { | 47 if (!surface_id_.is_null()) { |
| 48 factory_.Destroy(surface_id_); | 48 factory_.Destroy(surface_id_); |
| 49 } | 49 } |
| 50 surface_id_ = allocator_->GenerateId(); | 50 surface_id_ = allocator_->GenerateId(); |
| 51 factory_.Create(surface_id_); | 51 factory_.Create(surface_id_); |
| 52 display_size_ = frame_size; | 52 display_size_ = frame_size; |
| 53 } | 53 } |
| 54 display_client_->display()->Resize( | 54 display_client_->display()->SetSurfaceId(surface_id_, |
| 55 surface_id_, frame_size, frame->metadata.device_scale_factor); | 55 frame->metadata.device_scale_factor); |
| 56 | 56 |
| 57 scoped_ptr<cc::CompositorFrame> frame_copy(new cc::CompositorFrame()); | 57 scoped_ptr<cc::CompositorFrame> frame_copy(new cc::CompositorFrame()); |
| 58 frame->AssignTo(frame_copy.get()); | 58 frame->AssignTo(frame_copy.get()); |
| 59 factory_.SubmitFrame( | 59 factory_.SubmitFrame( |
| 60 surface_id_, | 60 surface_id_, |
| 61 frame_copy.Pass(), | 61 frame_copy.Pass(), |
| 62 base::Bind(&SurfaceDisplayOutputSurface::SwapBuffersComplete, | 62 base::Bind(&SurfaceDisplayOutputSurface::SwapBuffersComplete, |
| 63 base::Unretained(this))); | 63 base::Unretained(this))); |
| 64 | 64 |
| 65 client_->DidSwapBuffers(); | 65 client_->DidSwapBuffers(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 81 ack.resources = resources; | 81 ack.resources = resources; |
| 82 if (client_) | 82 if (client_) |
| 83 client_->ReclaimResources(&ack); | 83 client_->ReclaimResources(&ack); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void SurfaceDisplayOutputSurface::SwapBuffersComplete() { | 86 void SurfaceDisplayOutputSurface::SwapBuffersComplete() { |
| 87 client_->DidSwapBuffersComplete(); | 87 client_->DidSwapBuffersComplete(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace content | 90 } // namespace content |
| OLD | NEW |