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_factory.h" | 5 #include "cc/surfaces/surface_factory.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
11 #include "cc/output/compositor_frame.h" | 11 #include "cc/output/compositor_frame.h" |
12 #include "cc/output/copy_output_request.h" | 12 #include "cc/output/copy_output_request.h" |
13 #include "cc/surfaces/surface.h" | 13 #include "cc/surfaces/surface.h" |
14 #include "cc/surfaces/surface_factory_client.h" | 14 #include "cc/surfaces/surface_factory_client.h" |
15 #include "cc/surfaces/surface_info.h" | 15 #include "cc/surfaces/surface_info.h" |
16 #include "cc/surfaces/surface_manager.h" | 16 #include "cc/surfaces/surface_manager.h" |
17 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
18 | 18 |
19 namespace cc { | 19 namespace cc { |
20 SurfaceFactory::SurfaceFactory( | 20 SurfaceFactory::SurfaceFactory( |
21 const FrameSinkId& frame_sink_id, | 21 const FrameSinkId& frame_sink_id, |
22 SurfaceManager* manager, | 22 SurfaceManager* manager, |
23 SurfaceFactoryClient* client, | 23 SurfaceFactoryClient* client, |
24 SurfaceResourceHolderClient* resource_holder_client) | 24 SurfaceResourceHolderClient* resource_holder_client) |
25 : frame_sink_id_(frame_sink_id), | 25 : frame_sink_id_(frame_sink_id), |
26 manager_(manager), | 26 manager_(manager), |
27 client_(client), | 27 client_(client), |
| 28 resource_holder_client_(resource_holder_client), |
28 holder_(resource_holder_client), | 29 holder_(resource_holder_client), |
29 needs_sync_points_(true), | 30 needs_sync_points_(true), |
30 weak_factory_(this) {} | 31 weak_factory_(this) {} |
31 | 32 |
32 SurfaceFactory::~SurfaceFactory() { | 33 SurfaceFactory::~SurfaceFactory() { |
33 // This is to prevent troubles when a factory that resides in a client is | 34 // This is to prevent troubles when a factory that resides in a client is |
34 // being destroyed. In such cases, the factory might attempt to return | 35 // being destroyed. In such cases, the factory might attempt to return |
35 // resources to the client while it's in the middle of destruction and this | 36 // resources to the client while it's in the middle of destruction and this |
36 // could cause a crash or some unexpected behaviour. | 37 // could cause a crash or some unexpected behaviour. |
37 DCHECK(!current_surface_) << "Please call EvictSurface before destruction"; | 38 DCHECK(!current_surface_) << "Please call EvictSurface before destruction"; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 surface->AddObserver(this); | 147 surface->AddObserver(this); |
147 return surface; | 148 return surface; |
148 } | 149 } |
149 | 150 |
150 void SurfaceFactory::Destroy(std::unique_ptr<Surface> surface) { | 151 void SurfaceFactory::Destroy(std::unique_ptr<Surface> surface) { |
151 surface->RemoveObserver(this); | 152 surface->RemoveObserver(this); |
152 manager_->DestroySurface(std::move(surface)); | 153 manager_->DestroySurface(std::move(surface)); |
153 } | 154 } |
154 | 155 |
155 } // namespace cc | 156 } // namespace cc |
OLD | NEW |