OLD | NEW |
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 "platform/graphics/CompositorMutatorClient.h" | 5 #include "platform/graphics/CompositorMutatorClient.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "cc/trees/layer_tree_impl.h" | 10 #include "cc/trees/layer_tree_impl.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 CompositorMutatorClient::~CompositorMutatorClient() { | 31 CompositorMutatorClient::~CompositorMutatorClient() { |
32 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), | 32 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
33 "CompositorMutatorClient::~CompositorMutatorClient"); | 33 "CompositorMutatorClient::~CompositorMutatorClient"); |
34 } | 34 } |
35 | 35 |
36 bool CompositorMutatorClient::Mutate(base::TimeTicks monotonicTime, | 36 bool CompositorMutatorClient::Mutate(base::TimeTicks monotonicTime, |
37 cc::LayerTreeImpl* treeImpl) { | 37 cc::LayerTreeImpl* treeImpl) { |
38 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::Mutate"); | 38 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::Mutate"); |
39 double monotonicTimeNow = (monotonicTime - base::TimeTicks()).InSecondsF(); | 39 double monotonicTimeNow = (monotonicTime - base::TimeTicks()).InSecondsF(); |
40 if (!m_mutations) | 40 if (!m_mutations) |
41 m_mutations = wrapUnique(new CompositorMutations); | 41 m_mutations = WTF::wrapUnique(new CompositorMutations); |
42 CompositorMutableStateProvider compositorState(treeImpl, m_mutations.get()); | 42 CompositorMutableStateProvider compositorState(treeImpl, m_mutations.get()); |
43 bool shouldReinvoke = m_mutator->mutate(monotonicTimeNow, &compositorState); | 43 bool shouldReinvoke = m_mutator->mutate(monotonicTimeNow, &compositorState); |
44 return shouldReinvoke; | 44 return shouldReinvoke; |
45 } | 45 } |
46 | 46 |
47 void CompositorMutatorClient::SetClient(cc::LayerTreeMutatorClient* client) { | 47 void CompositorMutatorClient::SetClient(cc::LayerTreeMutatorClient* client) { |
48 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::SetClient"); | 48 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::SetClient"); |
49 m_client = client; | 49 m_client = client; |
50 setNeedsMutate(); | 50 setNeedsMutate(); |
51 } | 51 } |
(...skipping 13 matching lines...) Expand all Loading... |
65 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::setNeedsMutate"); | 65 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::setNeedsMutate"); |
66 m_client->SetNeedsMutate(); | 66 m_client->SetNeedsMutate(); |
67 } | 67 } |
68 | 68 |
69 void CompositorMutatorClient::setMutationsForTesting( | 69 void CompositorMutatorClient::setMutationsForTesting( |
70 std::unique_ptr<CompositorMutations> mutations) { | 70 std::unique_ptr<CompositorMutations> mutations) { |
71 m_mutations = std::move(mutations); | 71 m_mutations = std::move(mutations); |
72 } | 72 } |
73 | 73 |
74 } // namespace blink | 74 } // namespace blink |
OLD | NEW |