| 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/surface_display_output_surface.h" | 5 #include "cc/surfaces/surface_display_output_surface.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_ack.h" | 9 #include "cc/output/compositor_frame_ack.h" |
| 10 #include "cc/surfaces/display.h" | 10 #include "cc/surfaces/display.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 display_size_ = frame_size; | 57 display_size_ = frame_size; |
| 58 } | 58 } |
| 59 display_client_->display()->SetSurfaceId(surface_id_, | 59 display_client_->display()->SetSurfaceId(surface_id_, |
| 60 frame->metadata.device_scale_factor); | 60 frame->metadata.device_scale_factor); |
| 61 | 61 |
| 62 client_->DidSwapBuffers(); | 62 client_->DidSwapBuffers(); |
| 63 | 63 |
| 64 scoped_ptr<CompositorFrame> frame_copy(new CompositorFrame()); | 64 scoped_ptr<CompositorFrame> frame_copy(new CompositorFrame()); |
| 65 frame->AssignTo(frame_copy.get()); | 65 frame->AssignTo(frame_copy.get()); |
| 66 factory_.SubmitCompositorFrame( | 66 factory_.SubmitCompositorFrame( |
| 67 surface_id_, frame_copy.Pass(), | 67 surface_id_, std::move(frame_copy), |
| 68 base::Bind(&SurfaceDisplayOutputSurface::SwapBuffersComplete, | 68 base::Bind(&SurfaceDisplayOutputSurface::SwapBuffersComplete, |
| 69 base::Unretained(this))); | 69 base::Unretained(this))); |
| 70 } | 70 } |
| 71 | 71 |
| 72 bool SurfaceDisplayOutputSurface::BindToClient(OutputSurfaceClient* client) { | 72 bool SurfaceDisplayOutputSurface::BindToClient(OutputSurfaceClient* client) { |
| 73 DCHECK(client); | 73 DCHECK(client); |
| 74 DCHECK(display_client_); | 74 DCHECK(display_client_); |
| 75 client_ = client; | 75 client_ = client; |
| 76 // Avoid initializing GL context here, as this should be sharing the | 76 // Avoid initializing GL context here, as this should be sharing the |
| 77 // Display's context. | 77 // Display's context. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 97 BeginFrameSource* begin_frame_source) { | 97 BeginFrameSource* begin_frame_source) { |
| 98 // TODO(tansell): Hook this up. | 98 // TODO(tansell): Hook this up. |
| 99 } | 99 } |
| 100 | 100 |
| 101 void SurfaceDisplayOutputSurface::SwapBuffersComplete(SurfaceDrawStatus drawn) { | 101 void SurfaceDisplayOutputSurface::SwapBuffersComplete(SurfaceDrawStatus drawn) { |
| 102 if (client_ && !display_client_->output_surface_lost()) | 102 if (client_ && !display_client_->output_surface_lost()) |
| 103 client_->DidSwapBuffersComplete(); | 103 client_->DidSwapBuffersComplete(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace cc | 106 } // namespace cc |
| OLD | NEW |