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

Side by Side Diff: third_party/WebKit/Source/web/CompositorWorkerProxyClientImpl.h

Issue 2774223002: CompositorWorkerProxyClientImpl to CompositorProxy cross thread reference is using WeakMember (Closed)
Patch Set: fix Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CompositorWorkerProxyClientImpl_h 5 #ifndef CompositorWorkerProxyClientImpl_h
6 #define CompositorWorkerProxyClientImpl_h 6 #define CompositorWorkerProxyClientImpl_h
7 7
8 #include "core/dom/CompositorWorkerProxyClient.h" 8 #include "core/dom/CompositorWorkerProxyClient.h"
9 #include "platform/heap/Handle.h" 9 #include "platform/heap/Handle.h"
10 #include "web/CompositorAnimator.h" 10 #include "web/CompositorAnimator.h"
11 #include "web/CompositorProxyClientImpl.h"
11 #include "wtf/Noncopyable.h" 12 #include "wtf/Noncopyable.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class CompositorMutableStateProvider; 16 class CompositorMutableStateProvider;
16 class CompositorMutatorImpl; 17 class CompositorMutatorImpl;
17 class CompositorWorkerGlobalScope; 18 class CompositorWorkerGlobalScope;
18 class WorkerGlobalScope; 19 class WorkerGlobalScope;
19 20
20 // Mediates between one CompositorWorkerGlobalScope and the associated 21 // Mediates between one CompositorWorkerGlobalScope and the associated
21 // CompositorMutatorImpl. There is one CompositorWorkerProxyClientImpl per 22 // CompositorMutatorImpl. There is one CompositorWorkerProxyClientImpl per
22 // worker but there may be multiple for a given mutator, e.g. if a single 23 // worker but there may be multiple for a given mutator, e.g. if a single
23 // document creates multiple CompositorWorker objects. 24 // document creates multiple CompositorWorker objects.
24 // 25 //
26 // Owned by the main thread.
25 // Should be accessed only on the compositor thread. 27 // Should be accessed only on the compositor thread.
26 class CompositorWorkerProxyClientImpl final 28 class CompositorWorkerProxyClientImpl final
27 : public CompositorWorkerProxyClient, 29 : public GarbageCollectedFinalized<CompositorWorkerProxyClientImpl>,
30 public CompositorWorkerProxyClient,
28 public CompositorAnimator { 31 public CompositorAnimator {
29 WTF_MAKE_NONCOPYABLE(CompositorWorkerProxyClientImpl); 32 WTF_MAKE_NONCOPYABLE(CompositorWorkerProxyClientImpl);
30 USING_GARBAGE_COLLECTED_MIXIN(CompositorWorkerProxyClientImpl); 33 USING_GARBAGE_COLLECTED_MIXIN(CompositorWorkerProxyClientImpl);
31 34
32 public: 35 public:
33 explicit CompositorWorkerProxyClientImpl(CompositorMutatorImpl*); 36 explicit CompositorWorkerProxyClientImpl(CompositorMutatorImpl*);
34 DECLARE_TRACE(); 37 DECLARE_TRACE();
35 38
36 // CompositorAnimator: 39 // CompositorAnimator:
37 bool mutate(double monotonicTimeNow, 40 bool mutate(double monotonicTimeNow,
38 CompositorMutableStateProvider*) override; 41 CompositorMutableStateProvider*) override;
39 42
40 // CompositorWorkerProxyClient: 43 // CompositorWorkerProxyClient:
41 void dispose() override; 44 void dispose() override;
42 void setGlobalScope(WorkerGlobalScope*) override; 45 void setGlobalScope(WorkerGlobalScope*) override;
43 void requestAnimationFrame() override; 46 void requestAnimationFrame() override;
44 void registerCompositorProxy(CompositorProxy*) override; 47 CompositorProxyClient* compositorProxyClient() override {
45 void unregisterCompositorProxy(CompositorProxy*) override; 48 return m_compositorProxyClient.get();
49 };
46 50
47 private: 51 private:
48 bool executeAnimationFrameCallbacks(double monotonicTimeNow); 52 bool executeAnimationFrameCallbacks(double monotonicTimeNow);
49 53
50 CrossThreadPersistent<CompositorMutatorImpl> m_mutator; 54 CrossThreadPersistent<CompositorMutatorImpl> m_mutator;
51 55
52 CrossThreadPersistent<CompositorWorkerGlobalScope> m_globalScope; 56 CrossThreadPersistent<CompositorWorkerGlobalScope> m_globalScope;
53 bool m_requestedAnimationFrameCallbacks; 57 bool m_requestedAnimationFrameCallbacks;
54 58
55 // TODO(majidvp): move this out to a separate class that can be composed in. 59 CrossThreadPersistent<CompositorProxyClientImpl> m_compositorProxyClient;
56 HeapHashSet<WeakMember<CompositorProxy>> m_proxies;
57 }; 60 };
58 61
59 } // namespace blink 62 } // namespace blink
60 63
61 #endif // CompositorWorkerProxyClientImpl_h 64 #endif // CompositorWorkerProxyClientImpl_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698