| 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.h" | 5 #include "cc/surfaces/surface.h" |
| 6 | 6 |
| 7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/output/copy_output_request.h" |
| 8 #include "cc/surfaces/surface_factory.h" | 9 #include "cc/surfaces/surface_factory.h" |
| 9 | 10 |
| 10 namespace cc { | 11 namespace cc { |
| 11 | 12 |
| 12 // The frame index starts at 2 so that empty frames will be treated as | 13 // The frame index starts at 2 so that empty frames will be treated as |
| 13 // completely damaged the first time they're drawn from. | 14 // completely damaged the first time they're drawn from. |
| 14 static const int kFrameIndexStart = 2; | 15 static const int kFrameIndexStart = 2; |
| 15 | 16 |
| 16 Surface::Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory) | 17 Surface::Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory) |
| 17 : surface_id_(id), | 18 : surface_id_(id), |
| (...skipping 25 matching lines...) Expand all Loading... |
| 43 TransferableResource::ReturnResources( | 44 TransferableResource::ReturnResources( |
| 44 previous_frame->delegated_frame_data->resource_list, | 45 previous_frame->delegated_frame_data->resource_list, |
| 45 &previous_resources); | 46 &previous_resources); |
| 46 factory_->UnrefResources(previous_resources); | 47 factory_->UnrefResources(previous_resources); |
| 47 } | 48 } |
| 48 if (!draw_callback_.is_null()) | 49 if (!draw_callback_.is_null()) |
| 49 draw_callback_.Run(); | 50 draw_callback_.Run(); |
| 50 draw_callback_ = callback; | 51 draw_callback_ = callback; |
| 51 } | 52 } |
| 52 | 53 |
| 54 void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) { |
| 55 // TODO(jbauman): Make this work. |
| 56 copy_request->SendEmptyResult(); |
| 57 } |
| 58 |
| 53 const CompositorFrame* Surface::GetEligibleFrame() { | 59 const CompositorFrame* Surface::GetEligibleFrame() { |
| 54 return current_frame_.get(); | 60 return current_frame_.get(); |
| 55 } | 61 } |
| 56 | 62 |
| 57 void Surface::RunDrawCallbacks() { | 63 void Surface::RunDrawCallbacks() { |
| 58 if (!draw_callback_.is_null()) { | 64 if (!draw_callback_.is_null()) { |
| 59 base::Closure callback = draw_callback_; | 65 base::Closure callback = draw_callback_; |
| 60 draw_callback_ = base::Closure(); | 66 draw_callback_ = base::Closure(); |
| 61 callback.Run(); | 67 callback.Run(); |
| 62 } | 68 } |
| 63 } | 69 } |
| 64 | 70 |
| 65 } // namespace cc | 71 } // namespace cc |
| OLD | NEW |