Index: third_party/WebKit/Source/web/CompositorProxyClientImpl.h |
diff --git a/third_party/WebKit/Source/web/CompositorProxyClientImpl.h b/third_party/WebKit/Source/web/CompositorProxyClientImpl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..10039219a1ea719381731a427bdc3da440bf846f |
--- /dev/null |
+++ b/third_party/WebKit/Source/web/CompositorProxyClientImpl.h |
@@ -0,0 +1,74 @@ |
+// Copyright 2015 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. |
+ |
+#ifndef CompositorProxyClientImpl_h |
+#define CompositorProxyClientImpl_h |
+ |
+#include "core/dom/CompositorProxyClient.h" |
+ |
+#include "wtf/Noncopyable.h" |
+ |
+#include <map> |
+#include <set> |
+#include <vector> |
+ |
+namespace blink { |
+ |
+class CompositorMutableStateProvider; |
+class CompositorMutatorImpl; |
+class CompositorProxy; |
+class CompositorWorkerGlobalScope; |
+class WorkerGlobalScope; |
+ |
+class CompositorProxyClientImpl : public CompositorProxyClient { |
+ WTF_MAKE_NONCOPYABLE(CompositorProxyClientImpl); |
+ |
+public: |
+ explicit CompositorProxyClientImpl(CompositorMutatorImpl*); |
+ ~CompositorProxyClientImpl() override; |
+ |
+ bool mutate(double timeNow, CompositorMutableStateProvider*); |
+ |
+ // CompositorProxyClient: |
+ void registerCompositorProxy(CompositorProxy*) override; |
+ void unregisterCompositorProxy(CompositorProxy*) override; |
+ void requestSync(CompositorProxy*) override; |
+ |
+ void setGlobalScope(WorkerGlobalScope*) override; |
+ void requestMutation() override; |
+ |
+private: |
+ void willStartCompositorFrameCallbacks(CompositorMutableStateProvider*); |
+ bool executeAnimationFrameCallbacks(double time); |
+ |
+ CompositorMutatorImpl* m_mutator; |
+ |
+ // TODO(vollick): These could use wtf containers, but this would force us to |
+ // oilpan-ify CompositorProxyImpl and, transitively, a lot more stuff. |
+ // Particularly problematic in that stuff is the rAF task which must be |
+ // created outside of a safe point and whose ownership is passed between |
+ // threads. The code as it stands is correct and the raw pointers here have |
+ // the right semantics. Namely, they should not be traced (i.e., they do not |
+ // hide memory that should be visible to oilpan), they do not retain the |
+ // CompositorProxies (their lifetime is managed by oilpan), they will |
+ // continue to be valid during the lifetime of the CompositorProxies (since |
+ // oilpan is not a compacting GC), and we do not want oilpan to take action |
+ // to clear out these collections or update weak pointers when the objects |
+ // are destroyed (we handle that ourselves via disconnection). In short, we |
+ // do not need oilpan to do management for us because we're handling it |
+ // ourself and we need to handle it ourself because of our unique |
+ // multi-threaded requirements. |
+ typedef std::vector<CompositorProxy*> ProxyVector; |
+ typedef std::map<uint64_t, ProxyVector> ProxyMap; |
+ ProxyMap m_proxies; |
+ HashSet<uint64_t> m_requiresSync; |
+ |
+ CompositorWorkerGlobalScope* m_globalScope; |
+ bool m_executingAnimationFrameCallbacks; |
+ bool m_requestedAnimationFrameCallbacks; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // CompositorProxyClientImpl_h |