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 "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
8 #include "cc/output/copy_output_request.h" | 8 #include "cc/output/copy_output_request.h" |
9 #include "cc/surfaces/surface.h" | 9 #include "cc/surfaces/surface.h" |
10 #include "cc/surfaces/surface_manager.h" | 10 #include "cc/surfaces/surface_manager.h" |
11 #include "ui/gfx/geometry/size.h" | 11 #include "ui/gfx/geometry/size.h" |
12 | 12 |
13 namespace cc { | 13 namespace cc { |
14 SurfaceFactory::SurfaceFactory(SurfaceManager* manager, | 14 SurfaceFactory::SurfaceFactory(SurfaceManager* manager, |
15 SurfaceFactoryClient* client) | 15 SurfaceFactoryClient* client) |
16 : manager_(manager), client_(client), holder_(client) { | 16 : manager_(manager), client_(client), holder_(client) { |
17 } | 17 } |
18 | 18 |
19 SurfaceFactory::~SurfaceFactory() { | 19 SurfaceFactory::~SurfaceFactory() { |
20 DCHECK_EQ(0u, surface_map_.size()); | |
21 } | 20 } |
22 | 21 |
23 void SurfaceFactory::Create(SurfaceId surface_id, const gfx::Size& size) { | 22 void SurfaceFactory::Create(SurfaceId surface_id, const gfx::Size& size) { |
24 scoped_ptr<Surface> surface(new Surface(surface_id, size, this)); | 23 scoped_ptr<Surface> surface(new Surface(surface_id, size, this)); |
25 manager_->RegisterSurface(surface.get()); | 24 manager_->RegisterSurface(surface.get()); |
26 DCHECK(!surface_map_.count(surface_id)); | 25 DCHECK(!surface_map_.count(surface_id)); |
27 surface_map_.add(surface_id, surface.Pass()); | 26 surface_map_.add(surface_id, surface.Pass()); |
28 } | 27 } |
29 | 28 |
30 void SurfaceFactory::Destroy(SurfaceId surface_id) { | 29 void SurfaceFactory::Destroy(SurfaceId surface_id) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 63 |
65 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { | 64 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { |
66 holder_.RefResources(resources); | 65 holder_.RefResources(resources); |
67 } | 66 } |
68 | 67 |
69 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { | 68 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { |
70 holder_.UnrefResources(resources); | 69 holder_.UnrefResources(resources); |
71 } | 70 } |
72 | 71 |
73 } // namespace cc | 72 } // namespace cc |
OLD | NEW |