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 30 matching lines...) Expand all Loading... |
41 factory_.Destroy(surface_id_); | 41 factory_.Destroy(surface_id_); |
42 } | 42 } |
43 surface_id_ = allocator_.GenerateId(); | 43 surface_id_ = allocator_.GenerateId(); |
44 factory_.Create(surface_id_, frame_size); | 44 factory_.Create(surface_id_, frame_size); |
45 display_size_ = frame_size; | 45 display_size_ = frame_size; |
46 display_->Resize(surface_id_, frame_size); | 46 display_->Resize(surface_id_, frame_size); |
47 } | 47 } |
48 | 48 |
49 scoped_ptr<cc::CompositorFrame> frame_copy(new cc::CompositorFrame()); | 49 scoped_ptr<cc::CompositorFrame> frame_copy(new cc::CompositorFrame()); |
50 frame->AssignTo(frame_copy.get()); | 50 frame->AssignTo(frame_copy.get()); |
51 factory_.SubmitFrame(surface_id_, frame_copy.Pass()); | 51 factory_.SubmitFrame( |
| 52 surface_id_, |
| 53 frame_copy.Pass(), |
| 54 base::Bind(&SurfaceDisplayOutputSurface::SwapBuffersComplete, |
| 55 base::Unretained(this))); |
52 | 56 |
53 client_->DidSwapBuffers(); | 57 client_->DidSwapBuffers(); |
54 client_->DidSwapBuffersComplete(); | |
55 } | 58 } |
56 | 59 |
57 void SurfaceDisplayOutputSurface::ReturnResources( | 60 void SurfaceDisplayOutputSurface::ReturnResources( |
58 const cc::ReturnedResourceArray& resources) { | 61 const cc::ReturnedResourceArray& resources) { |
59 cc::CompositorFrameAck ack; | 62 cc::CompositorFrameAck ack; |
60 ack.resources = resources; | 63 ack.resources = resources; |
61 if (client_) | 64 if (client_) |
62 client_->ReclaimResources(&ack); | 65 client_->ReclaimResources(&ack); |
63 } | 66 } |
64 | 67 |
| 68 void SurfaceDisplayOutputSurface::SwapBuffersComplete() { |
| 69 client_->DidSwapBuffersComplete(); |
| 70 } |
| 71 |
65 } // namespace content | 72 } // namespace content |
OLD | NEW |