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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp

Issue 2765053002: Avoid exposing cc::Layer tree to CompositorProxy (Closed)
Patch Set: Rebase onto blink reformat Created 3 years, 8 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "platform/graphics/CompositorMutableStateProvider.h" 5 #include "platform/graphics/CompositorMutableStateProvider.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "cc/layers/layer_impl.h"
9 #include "cc/trees/layer_tree_impl.h"
10 #include "platform/graphics/CompositorElementId.h" 8 #include "platform/graphics/CompositorElementId.h"
11 #include "platform/graphics/CompositorMutableProperties.h"
12 #include "platform/graphics/CompositorMutableState.h" 9 #include "platform/graphics/CompositorMutableState.h"
13 #include "platform/graphics/CompositorMutation.h" 10 #include "platform/graphics/CompositorMutation.h"
14 #include "platform/wtf/PtrUtil.h" 11 #include "platform/wtf/PtrUtil.h"
15 12
16 namespace blink { 13 namespace blink {
17 14
18 CompositorMutableStateProvider::CompositorMutableStateProvider( 15 CompositorMutableStateProvider::CompositorMutableStateProvider(
19 cc::LayerTreeImpl* tree_impl, 16 ProxyCompositorMutablePropertiesMap* input_properties,
20 CompositorMutations* mutations) 17 CompositorMutations* mutations)
21 : tree_(tree_impl), mutations_(mutations) {} 18 : input_properties_(input_properties), mutations_(mutations) {}
22 19
23 CompositorMutableStateProvider::~CompositorMutableStateProvider() {} 20 CompositorMutableStateProvider::~CompositorMutableStateProvider() {}
24 21
25 std::unique_ptr<CompositorMutableState> 22 std::unique_ptr<CompositorMutableState>
26 CompositorMutableStateProvider::GetMutableStateFor(uint64_t element_id) { 23 CompositorMutableStateProvider::GetMutableStateFor(uint64_t proxy_id) {
flackr 2017/04/11 17:51:36 I'm not sure I understand why the change to gettin
smcgruer 2017/04/19 15:38:38 I might not be following you correctly, but the CL
flackr 2017/04/20 06:54:14 Ah I see now, can we intead store the "current" va
smcgruer 2017/04/21 14:42:25 I'm looking at this, but I don't really see how it
27 cc::LayerImpl* main_layer = tree_->LayerByElementId( 24 const auto it = input_properties_->find(proxy_id);
28 CreateCompositorElementId(element_id, CompositorSubElementId::kPrimary)); 25 if (it == input_properties_->end())
29 cc::LayerImpl* scroll_layer = tree_->LayerByElementId( 26 return nullptr;
30 CreateCompositorElementId(element_id, CompositorSubElementId::kScroll));
31 27
32 if (!main_layer && !scroll_layer) 28 CompositorMutableProperties* properties = &it->second;
33 return nullptr;
34 29
35 // Ensure that we have an entry in the map for |elementId| but do as few 30 // Ensure that we have an entry in the map for |elementId| but do as few
36 // allocations and queries as possible. This will update the map only if we 31 // allocations and queries as possible. This will update the map only if we
37 // have not added a value for |elementId|. 32 // have not added a value for |elementId|.
38 auto result = mutations_->map.insert(element_id, nullptr); 33 auto result = mutations_->map.insert(properties->element_id, nullptr);
39 34
40 // Only if this is a new entry do we want to allocate a new mutation. 35 // Only if this is a new entry do we want to allocate a new mutation.
41 if (result.is_new_entry) 36 if (result.is_new_entry)
42 result.stored_value->value = WTF::WrapUnique(new CompositorMutation); 37 result.stored_value->value = WTF::WrapUnique(new CompositorMutation);
43 38
44 return WTF::WrapUnique(new CompositorMutableState( 39 return WTF::WrapUnique(
45 result.stored_value->value.get(), main_layer, scroll_layer)); 40 new CompositorMutableState(result.stored_value->value.get(), properties));
46 } 41 }
47 42
48 } // namespace blink 43 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698