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

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

Issue 2514033002: Introducing SurfaceReferenceFactory (Closed)
Patch Set: nits Created 4 years 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
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_manager.h" 5 #include "cc/surfaces/surface_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <queue> 10 #include <queue>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "cc/surfaces/direct_surface_reference_factory.h"
14 #include "cc/surfaces/surface.h" 15 #include "cc/surfaces/surface.h"
15 #include "cc/surfaces/surface_factory_client.h" 16 #include "cc/surfaces/surface_factory_client.h"
16 #include "cc/surfaces/surface_id_allocator.h" 17 #include "cc/surfaces/surface_id_allocator.h"
17 18
18 namespace cc { 19 namespace cc {
19 20
20 SurfaceManager::FrameSinkSourceMapping::FrameSinkSourceMapping() 21 SurfaceManager::FrameSinkSourceMapping::FrameSinkSourceMapping()
21 : client(nullptr), source(nullptr) {} 22 : client(nullptr), source(nullptr) {}
22 23
23 SurfaceManager::FrameSinkSourceMapping::FrameSinkSourceMapping( 24 SurfaceManager::FrameSinkSourceMapping::FrameSinkSourceMapping(
24 const FrameSinkSourceMapping& other) = default; 25 const FrameSinkSourceMapping& other) = default;
25 26
26 SurfaceManager::FrameSinkSourceMapping::~FrameSinkSourceMapping() { 27 SurfaceManager::FrameSinkSourceMapping::~FrameSinkSourceMapping() {
27 DCHECK(is_empty()) << "client: " << client 28 DCHECK(is_empty()) << "client: " << client
28 << ", children: " << children.size(); 29 << ", children: " << children.size();
29 } 30 }
30 31
31 SurfaceManager::SurfaceManager(LifetimeType lifetime_type) 32 SurfaceManager::SurfaceManager(LifetimeType lifetime_type)
32 : lifetime_type_(lifetime_type), 33 : lifetime_type_(lifetime_type),
33 root_surface_id_(FrameSinkId(0u, 0u), 34 root_surface_id_(FrameSinkId(0u, 0u),
34 LocalFrameId(1u, base::UnguessableToken::Create())) { 35 LocalFrameId(1u, base::UnguessableToken::Create())),
36 reference_factory_(new DirectSurfaceReferenceFactory(this)) {
35 thread_checker_.DetachFromThread(); 37 thread_checker_.DetachFromThread();
36 } 38 }
37 39
38 SurfaceManager::~SurfaceManager() { 40 SurfaceManager::~SurfaceManager() {
39 DCHECK(thread_checker_.CalledOnValidThread()); 41 DCHECK(thread_checker_.CalledOnValidThread());
40 for (SurfaceDestroyList::iterator it = surfaces_to_destroy_.begin(); 42 for (SurfaceDestroyList::iterator it = surfaces_to_destroy_.begin();
41 it != surfaces_to_destroy_.end(); 43 it != surfaces_to_destroy_.end();
42 ++it) { 44 ++it) {
43 DeregisterSurface((*it)->surface_id()); 45 DeregisterSurface((*it)->surface_id());
44 } 46 }
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 495
494 void SurfaceManager::SurfaceCreated(const SurfaceId& surface_id, 496 void SurfaceManager::SurfaceCreated(const SurfaceId& surface_id,
495 const gfx::Size& frame_size, 497 const gfx::Size& frame_size,
496 float device_scale_factor) { 498 float device_scale_factor) {
497 CHECK(thread_checker_.CalledOnValidThread()); 499 CHECK(thread_checker_.CalledOnValidThread());
498 for (auto& observer : observer_list_) 500 for (auto& observer : observer_list_)
499 observer.OnSurfaceCreated(surface_id, frame_size, device_scale_factor); 501 observer.OnSurfaceCreated(surface_id, frame_size, device_scale_factor);
500 } 502 }
501 503
502 } // namespace cc 504 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698