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

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

Issue 2049063002: Revert of Use element id's for animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 "cc/layers/layer_impl.h" 7 #include "cc/layers/layer_impl.h"
8 #include "cc/trees/layer_tree_impl.h" 8 #include "cc/trees/layer_tree_impl.h"
9 #include "platform/graphics/CompositorElementId.h"
10 #include "platform/graphics/CompositorMutableProperties.h"
11 #include "platform/graphics/CompositorMutableState.h" 9 #include "platform/graphics/CompositorMutableState.h"
12 #include "platform/graphics/CompositorMutation.h" 10 #include "platform/graphics/CompositorMutation.h"
13 #include "wtf/PassOwnPtr.h" 11 #include "wtf/PassOwnPtr.h"
14 12
15 namespace blink { 13 namespace blink {
16 14
17 CompositorMutableStateProvider::CompositorMutableStateProvider(cc::LayerTreeImpl * state, CompositorMutations* mutations) 15 CompositorMutableStateProvider::CompositorMutableStateProvider(cc::LayerTreeImpl * state, CompositorMutations* mutations)
18 : m_state(state) 16 : m_state(state)
19 , m_mutations(mutations) 17 , m_mutations(mutations)
20 { 18 {
21 } 19 }
22 20
23 CompositorMutableStateProvider::~CompositorMutableStateProvider() {} 21 CompositorMutableStateProvider::~CompositorMutableStateProvider() {}
24 22
25 PassOwnPtr<CompositorMutableState> 23 PassOwnPtr<CompositorMutableState>
26 CompositorMutableStateProvider::getMutableStateFor(uint64_t element_id) 24 CompositorMutableStateProvider::getMutableStateFor(uint64_t element_id)
27 { 25 {
28 cc::LayerImpl* mainLayer = m_state->LayerByElementId(createCompositorElement Id(element_id, CompositorSubElementId::Primary)); 26 cc::LayerTreeImpl::ElementLayers layers = m_state->GetMutableLayers(element_ id);
29 cc::LayerImpl* scrollLayer = m_state->LayerByElementId(createCompositorEleme ntId(element_id, CompositorSubElementId::Scroll));
30 27
31 if (!mainLayer && !scrollLayer) 28 if (!layers.main && !layers.scroll)
32 return nullptr; 29 return nullptr;
33 30
34 // Ensure that we have an entry in the map for |element_id| but do as few 31 // Ensure that we have an entry in the map for |element_id| but do as few
35 // allocations and queries as possible. This will update the map only if we 32 // allocations and queries as possible. This will update the map only if we
36 // have not added a value for |element_id|. 33 // have not added a value for |element_id|.
37 auto result = m_mutations->map.add(element_id, nullptr); 34 auto result = m_mutations->map.add(element_id, nullptr);
38 35
39 // Only if this is a new entry do we want to allocate a new mutation. 36 // Only if this is a new entry do we want to allocate a new mutation.
40 if (result.isNewEntry) 37 if (result.isNewEntry)
41 result.storedValue->value = adoptPtr(new CompositorMutation); 38 result.storedValue->value = adoptPtr(new CompositorMutation);
42 39
43 return adoptPtr(new CompositorMutableState(result.storedValue->value.get(), mainLayer, scrollLayer)); 40 return adoptPtr(new CompositorMutableState(result.storedValue->value.get(), layers.main, layers.scroll));
44 } 41 }
45 42
46 } // namespace blink 43 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698