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

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

Issue 2041193005: [compositorworker] compositor proxy mutation updates underlying layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compositor-worker-upstream-registration
Patch Set: Fix inlcudes 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/CompositorMutableState.h" 9 #include "platform/graphics/CompositorMutableState.h"
10 #include "platform/graphics/CompositorMutation.h" 10 #include "platform/graphics/CompositorMutation.h"
11 #include "wtf/PassOwnPtr.h" 11 #include "wtf/PassOwnPtr.h"
12 #include "wtf/PtrUtil.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 CompositorMutableStateProvider::CompositorMutableStateProvider(cc::LayerTreeImpl * state, CompositorMutations* mutations) 16 CompositorMutableStateProvider::CompositorMutableStateProvider(cc::LayerTreeImpl * tree_impl, CompositorMutations* mutations)
jbroman 2016/06/13 19:45:17 nit: "treeImpl" Blink style still uses camelCase
majidvp 2016/06/13 21:52:51 Done.
16 : m_state(state) 17 : m_tree(tree_impl)
17 , m_mutations(mutations) 18 , m_mutations(mutations)
18 { 19 {
19 } 20 }
20 21
21 CompositorMutableStateProvider::~CompositorMutableStateProvider() {} 22 CompositorMutableStateProvider::~CompositorMutableStateProvider() {}
22 23
23 PassOwnPtr<CompositorMutableState> 24 std::unique_ptr<CompositorMutableState>
24 CompositorMutableStateProvider::getMutableStateFor(uint64_t element_id) 25 CompositorMutableStateProvider::getMutableStateFor(uint64_t element_id)
25 { 26 {
26 cc::LayerTreeImpl::ElementLayers layers = m_state->GetMutableLayers(element_ id); 27 cc::LayerTreeImpl::ElementLayers layers = m_tree->GetMutableLayers(element_i d);
27 28
28 if (!layers.main && !layers.scroll) 29 if (!layers.main && !layers.scroll)
29 return nullptr; 30 return nullptr;
30 31
31 // Ensure that we have an entry in the map for |element_id| but do as few 32 // Ensure that we have an entry in the map for |element_id| but do as few
32 // allocations and queries as possible. This will update the map only if we 33 // allocations and queries as possible. This will update the map only if we
33 // have not added a value for |element_id|. 34 // have not added a value for |element_id|.
34 auto result = m_mutations->map.add(element_id, nullptr); 35 auto result = m_mutations->map.add(element_id, nullptr);
35 36
36 // Only if this is a new entry do we want to allocate a new mutation. 37 // Only if this is a new entry do we want to allocate a new mutation.
37 if (result.isNewEntry) 38 if (result.isNewEntry)
38 result.storedValue->value = adoptPtr(new CompositorMutation); 39 result.storedValue->value = adoptPtr(new CompositorMutation);
39 40
40 return adoptPtr(new CompositorMutableState(result.storedValue->value.get(), layers.main, layers.scroll)); 41 return wrapUnique(new CompositorMutableState(result.storedValue->value.get() , layers.main, layers.scroll));
41 } 42 }
42 43
43 } // namespace blink 44 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698