| 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 <algorithm> | 7 #include <algorithm> | 
| 8 | 8 | 
| 9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" | 
| 10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" | 
| 11 #include "cc/surfaces/surface_factory.h" | 11 #include "cc/surfaces/surface_factory.h" | 
| 12 #include "cc/surfaces/surface_id_allocator.h" | 12 #include "cc/surfaces/surface_id_allocator.h" | 
| 13 #include "cc/surfaces/surface_manager.h" | 13 #include "cc/surfaces/surface_manager.h" | 
| 14 | 14 | 
| 15 namespace cc { | 15 namespace cc { | 
| 16 | 16 | 
| 17 // The frame index starts at 2 so that empty frames will be treated as | 17 // The frame index starts at 2 so that empty frames will be treated as | 
| 18 // completely damaged the first time they're drawn from. | 18 // completely damaged the first time they're drawn from. | 
| 19 static const int kFrameIndexStart = 2; | 19 static const int kFrameIndexStart = 2; | 
| 20 | 20 | 
| 21 Surface::Surface(SurfaceId id, const gfx::Size& size, SurfaceFactory* factory) | 21 Surface::Surface(SurfaceId id, SurfaceFactory* factory) | 
| 22     : surface_id_(id), | 22     : surface_id_(id), | 
| 23       size_(size), |  | 
| 24       factory_(factory->AsWeakPtr()), | 23       factory_(factory->AsWeakPtr()), | 
| 25       frame_index_(kFrameIndexStart) { | 24       frame_index_(kFrameIndexStart) { | 
| 26 } | 25 } | 
| 27 | 26 | 
| 28 Surface::~Surface() { | 27 Surface::~Surface() { | 
| 29   ClearCopyRequests(); | 28   ClearCopyRequests(); | 
| 30   if (current_frame_ && factory_) { | 29   if (current_frame_ && factory_) { | 
| 31     ReturnedResourceArray current_resources; | 30     ReturnedResourceArray current_resources; | 
| 32     TransferableResource::ReturnResources( | 31     TransferableResource::ReturnResources( | 
| 33         current_frame_->delegated_frame_data->resource_list, | 32         current_frame_->delegated_frame_data->resource_list, | 
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 130   if (current_frame_) { | 129   if (current_frame_) { | 
| 131     for (const auto& render_pass : | 130     for (const auto& render_pass : | 
| 132          current_frame_->delegated_frame_data->render_pass_list) { | 131          current_frame_->delegated_frame_data->render_pass_list) { | 
| 133       for (const auto& copy_request : render_pass->copy_requests) | 132       for (const auto& copy_request : render_pass->copy_requests) | 
| 134         copy_request->SendEmptyResult(); | 133         copy_request->SendEmptyResult(); | 
| 135     } | 134     } | 
| 136   } | 135   } | 
| 137 } | 136 } | 
| 138 | 137 | 
| 139 }  // namespace cc | 138 }  // namespace cc | 
| OLD | NEW | 
|---|