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

Side by Side Diff: cc/test/fake_layer_tree_host.cc

Issue 1126253005: cc: Add LayerTreeHost::InitParams for LayerTreeHost creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: all Created 5 years, 7 months 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/test/fake_layer_tree_host.h" 5 #include "cc/test/fake_layer_tree_host.h"
6 6
7 namespace cc { 7 namespace cc {
8 FakeLayerTreeHost::FakeLayerTreeHost(FakeLayerTreeHostClient* client, 8 FakeLayerTreeHost::FakeLayerTreeHost(FakeLayerTreeHostClient* client,
9 const LayerTreeSettings& settings) 9 LayerTreeHost::InitParams* params)
10 : LayerTreeHost(client, NULL, NULL, NULL, settings), 10 : LayerTreeHost(params),
11 client_(client), 11 client_(client),
12 host_impl_(settings, &proxy_, &manager_, nullptr), 12 host_impl_(params->settings ? *params->settings : LayerTreeSettings(),
danakj 2015/05/07 00:59:56 not a fan, this is a bit unobvious. i'd rather the
sadrul 2015/05/07 04:39:25 Removed the NULL check (and kept settings as a ptr
13 &proxy_,
14 &manager_,
15 nullptr),
13 needs_commit_(false) { 16 needs_commit_(false) {
14 client_->SetLayerTreeHost(this); 17 client_->SetLayerTreeHost(this);
15 } 18 }
16 19
17 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( 20 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create(
18 FakeLayerTreeHostClient* client) { 21 FakeLayerTreeHostClient* client) {
19 LayerTreeSettings settings; 22 LayerTreeSettings settings;
20 settings.verify_property_trees = true; 23 settings.verify_property_trees = true;
21 return make_scoped_ptr(new FakeLayerTreeHost(client, settings)); 24 return Create(client, settings);
22 } 25 }
23 26
24 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( 27 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create(
25 FakeLayerTreeHostClient* client, 28 FakeLayerTreeHostClient* client,
26 const LayerTreeSettings& settings) { 29 const LayerTreeSettings& settings) {
27 return make_scoped_ptr(new FakeLayerTreeHost(client, settings)); 30 LayerTreeHost::InitParams params;
31 params.client = client;
32 params.settings = &settings;
33 return make_scoped_ptr(new FakeLayerTreeHost(client, &params));
28 } 34 }
29 35
30 FakeLayerTreeHost::~FakeLayerTreeHost() { 36 FakeLayerTreeHost::~FakeLayerTreeHost() {
31 client_->SetLayerTreeHost(NULL); 37 client_->SetLayerTreeHost(NULL);
32 } 38 }
33 39
34 void FakeLayerTreeHost::SetNeedsCommit() { needs_commit_ = true; } 40 void FakeLayerTreeHost::SetNeedsCommit() { needs_commit_ = true; }
35 41
36 LayerImpl* FakeLayerTreeHost::CommitAndCreateLayerImplTree() { 42 LayerImpl* FakeLayerTreeHost::CommitAndCreateLayerImplTree() {
37 scoped_ptr<LayerImpl> old_root_layer_impl = active_tree()->DetachLayerTree(); 43 scoped_ptr<LayerImpl> old_root_layer_impl = active_tree()->DetachLayerTree();
38 44
39 scoped_ptr<LayerImpl> layer_impl = TreeSynchronizer::SynchronizeTrees( 45 scoped_ptr<LayerImpl> layer_impl = TreeSynchronizer::SynchronizeTrees(
40 root_layer(), old_root_layer_impl.Pass(), active_tree()); 46 root_layer(), old_root_layer_impl.Pass(), active_tree());
41 TreeSynchronizer::PushProperties(root_layer(), layer_impl.get()); 47 TreeSynchronizer::PushProperties(root_layer(), layer_impl.get());
42 48
43 active_tree()->SetRootLayer(layer_impl.Pass()); 49 active_tree()->SetRootLayer(layer_impl.Pass());
44 return active_tree()->root_layer(); 50 return active_tree()->root_layer();
45 } 51 }
46 52
47 } // namespace cc 53 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698