Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: cc/surfaces/surface_factory.cc

Issue 693943003: Update from https://crrev.com/302630 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/surfaces/surface_factory.h ('k') | cc/surfaces/surface_factory_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 if (!surface_map_.empty()) {
21 LOG(ERROR) << "SurfaceFactory has " << surface_map_.size()
22 << " entries in map on destruction.";
23 }
24 DestroyAll();
25 }
26
27 void SurfaceFactory::DestroyAll() {
28 for (auto& surface : surface_map_)
29 manager_->DeregisterSurface(surface.first);
30 surface_map_.clear();
20 } 31 }
21 32
22 void SurfaceFactory::Create(SurfaceId surface_id, const gfx::Size& size) { 33 void SurfaceFactory::Create(SurfaceId surface_id, const gfx::Size& size) {
23 scoped_ptr<Surface> surface(new Surface(surface_id, size, this)); 34 scoped_ptr<Surface> surface(new Surface(surface_id, size, this));
24 manager_->RegisterSurface(surface.get()); 35 manager_->RegisterSurface(surface.get());
25 DCHECK(!surface_map_.count(surface_id)); 36 DCHECK(!surface_map_.count(surface_id));
26 surface_map_.add(surface_id, surface.Pass()); 37 surface_map_.add(surface_id, surface.Pass());
27 } 38 }
28 39
29 void SurfaceFactory::Destroy(SurfaceId surface_id) { 40 void SurfaceFactory::Destroy(SurfaceId surface_id) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 84
74 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { 85 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) {
75 holder_.RefResources(resources); 86 holder_.RefResources(resources);
76 } 87 }
77 88
78 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { 89 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) {
79 holder_.UnrefResources(resources); 90 holder_.UnrefResources(resources);
80 } 91 }
81 92
82 } // namespace cc 93 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/surface_factory.h ('k') | cc/surfaces/surface_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698