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

Unified Diff: third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp

Issue 2765053002: Avoid exposing cc::Layer tree to CompositorProxy (Closed)
Patch Set: Minor changes Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
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
index e5b2392656b9b51e6ebe5048457ad5b56642541a..de76a37739fed7979fca4f223eac41d7fe416a38 100644
--- a/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp
+++ b/third_party/WebKit/Source/platform/graphics/CompositorMutableStateProvider.cpp
@@ -4,10 +4,7 @@
#include "platform/graphics/CompositorMutableStateProvider.h"
-#include "cc/layers/layer_impl.h"
-#include "cc/trees/layer_tree_impl.h"
#include "platform/graphics/CompositorElementId.h"
-#include "platform/graphics/CompositorMutableProperties.h"
#include "platform/graphics/CompositorMutableState.h"
#include "platform/graphics/CompositorMutation.h"
#include "wtf/PtrUtil.h"
@@ -16,33 +13,31 @@
namespace blink {
CompositorMutableStateProvider::CompositorMutableStateProvider(
- cc::LayerTreeImpl* treeImpl,
+ ProxyCompositorMutablePropertiesMap* inputProperties,
CompositorMutations* mutations)
- : m_tree(treeImpl), m_mutations(mutations) {}
+ : m_inputProperties(inputProperties), m_mutations(mutations) {}
CompositorMutableStateProvider::~CompositorMutableStateProvider() {}
std::unique_ptr<CompositorMutableState>
-CompositorMutableStateProvider::getMutableStateFor(uint64_t elementId) {
- cc::LayerImpl* mainLayer = m_tree->LayerByElementId(
- createCompositorElementId(elementId, CompositorSubElementId::Primary));
- cc::LayerImpl* scrollLayer = m_tree->LayerByElementId(
- createCompositorElementId(elementId, CompositorSubElementId::Scroll));
-
- if (!mainLayer && !scrollLayer)
+CompositorMutableStateProvider::getMutableStateFor(uint64_t proxyId) {
+ const auto it = m_inputProperties->find(proxyId);
+ if (it == m_inputProperties->end())
return nullptr;
+ CompositorMutableProperties* properties = &it->second;
+
// Ensure that we have an entry in the map for |elementId| but do as few
// allocations and queries as possible. This will update the map only if we
// have not added a value for |elementId|.
- auto result = m_mutations->map.insert(elementId, nullptr);
+ auto result = m_mutations->map.insert(properties->elementId, nullptr);
// Only if this is a new entry do we want to allocate a new mutation.
if (result.isNewEntry)
result.storedValue->value = WTF::wrapUnique(new CompositorMutation);
- return WTF::wrapUnique(new CompositorMutableState(
- result.storedValue->value.get(), mainLayer, scrollLayer));
+ return WTF::wrapUnique(
+ new CompositorMutableState(result.storedValue->value.get(), properties));
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698