Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp |
| diff --git a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a87e2c80de12f174ce3d6cbf8cdf6ebe2043c47c |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp |
| @@ -0,0 +1,35 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "platform/graphics/CompositorMutableStateProvider.h" |
| + |
| +#include "cc/layers/layer_impl.h" |
| +#include "cc/trees/layer_tree_impl.h" |
| +#include "platform/graphics/CompositorMutableState.h" |
| +#include "platform/graphics/CompositorMutation.h" |
| +#include "wtf/PassOwnPtr.h" |
| + |
| +namespace blink { |
| + |
| +CompositorMutableStateProvider::CompositorMutableStateProvider(cc::LayerTreeImpl* state, CompositorMutations* mutations) |
| + : m_state(state) |
| + , m_mutations(mutations) |
| +{ |
| +} |
| + |
| +CompositorMutableStateProvider::~CompositorMutableStateProvider() {} |
| + |
| +PassOwnPtr<CompositorMutableState> |
| +CompositorMutableStateProvider::getMutableStateFor(uint64_t element_id) |
| +{ |
| + cc::LayerTreeImpl::ElementLayers layers = m_state->GetMutableLayers(element_id); |
| + |
| + if (!layers.main && !layers.scroll) |
| + return nullptr; |
| + |
| + return adoptPtr<blink::CompositorMutableState>( |
|
jbroman
2016/01/18 19:07:22
You shouldn't need to supply the template argument
Ian Vollick
2016/01/18 21:25:04
Done.
|
| + new CompositorMutableState(&m_mutations->map[element_id], layers.main, layers.scroll)); |
| +} |
| + |
| +} // namespace blink |