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

Side by Side Diff: third_party/WebKit/Source/web/CompositorMutatorImpl.cpp

Issue 1925583003: Replace AllowCrossThreadAccess() + non-GCed pointers with crossThreadUnretained() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Kuroneko_4
Patch Set: Rebase. Created 4 years, 5 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 "web/CompositorMutatorImpl.h" 5 #include "web/CompositorMutatorImpl.h"
6 6
7 #include "core/animation/CustomCompositorAnimationManager.h" 7 #include "core/animation/CustomCompositorAnimationManager.h"
8 #include "core/dom/CompositorProxy.h" 8 #include "core/dom/CompositorProxy.h"
9 #include "platform/ThreadSafeFunctional.h" 9 #include "platform/ThreadSafeFunctional.h"
10 #include "platform/TraceEvent.h" 10 #include "platform/TraceEvent.h"
(...skipping 23 matching lines...) Expand all
34 : m_animationManager(wrapUnique(new CustomCompositorAnimationManager)) 34 : m_animationManager(wrapUnique(new CustomCompositorAnimationManager))
35 , m_client(nullptr) 35 , m_client(nullptr)
36 { 36 {
37 } 37 }
38 38
39 std::unique_ptr<CompositorMutatorClient> CompositorMutatorImpl::createClient() 39 std::unique_ptr<CompositorMutatorClient> CompositorMutatorImpl::createClient()
40 { 40 {
41 std::unique_ptr<CompositorMutatorClient> mutatorClient; 41 std::unique_ptr<CompositorMutatorClient> mutatorClient;
42 WaitableEvent doneEvent; 42 WaitableEvent doneEvent;
43 if (WebThread* compositorThread = Platform::current()->compositorThread()) { 43 if (WebThread* compositorThread = Platform::current()->compositorThread()) {
44 compositorThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSa feBind(&createCompositorMutatorClient, AllowCrossThreadAccess(&mutatorClient), A llowCrossThreadAccess(&doneEvent))); 44 compositorThread->getWebTaskRunner()->postTask(BLINK_FROM_HERE, threadSa feBind(&createCompositorMutatorClient, crossThreadUnretained(&mutatorClient), cr ossThreadUnretained(&doneEvent)));
45 } else { 45 } else {
46 createCompositorMutatorClient(&mutatorClient, &doneEvent); 46 createCompositorMutatorClient(&mutatorClient, &doneEvent);
47 } 47 }
48 // TODO(flackr): Instead of waiting for this event, we may be able to just s et the 48 // TODO(flackr): Instead of waiting for this event, we may be able to just s et the
49 // mutator on the CompositorProxyClient directly from the compositor thread before 49 // mutator on the CompositorProxyClient directly from the compositor thread before
50 // it gets used there. We still need to make sure we only create one mutator though. 50 // it gets used there. We still need to make sure we only create one mutator though.
51 doneEvent.wait(); 51 doneEvent.wait();
52 return mutatorClient; 52 return mutatorClient;
53 } 53 }
54 54
(...skipping 24 matching lines...) Expand all
79 setNeedsMutate(); 79 setNeedsMutate();
80 } 80 }
81 81
82 void CompositorMutatorImpl::setNeedsMutate() 82 void CompositorMutatorImpl::setNeedsMutate()
83 { 83 {
84 TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::setNeedsMutate"); 84 TRACE_EVENT0("compositor-worker", "CompositorMutatorImpl::setNeedsMutate");
85 m_client->setNeedsMutate(); 85 m_client->setNeedsMutate();
86 } 86 }
87 87
88 } // namespace blink 88 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698