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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/CompositorMutatorClient.cpp

Issue 2041193005: [compositorworker] compositor proxy mutation updates underlying layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@compositor-worker-upstream-registration
Patch Set: raise if not initialized Created 4 years, 6 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 "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 "platform/TraceEvent.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/trees/layer_tree_impl.h"
11 #include "platform/graphics/CompositorMutableStateProvider.h"
10 #include "platform/graphics/CompositorMutation.h" 12 #include "platform/graphics/CompositorMutation.h"
11 #include "platform/graphics/CompositorMutationsTarget.h" 13 #include "platform/graphics/CompositorMutationsTarget.h"
12 #include "platform/graphics/CompositorMutator.h" 14 #include "platform/graphics/CompositorMutator.h"
13 15
14 namespace blink { 16 namespace blink {
15 17
16 CompositorMutatorClient::CompositorMutatorClient(CompositorMutator* mutator, Com positorMutationsTarget* mutationsTarget) 18 CompositorMutatorClient::CompositorMutatorClient(CompositorMutator* mutator, Com positorMutationsTarget* mutationsTarget)
17 : m_client(nullptr) 19 : m_client(nullptr)
18 , m_mutationsTarget(mutationsTarget) 20 , m_mutationsTarget(mutationsTarget)
19 , m_mutator(mutator) 21 , m_mutator(mutator)
20 , m_mutations(nullptr) 22 , m_mutations(nullptr)
21 { 23 {
22 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositorMuta torClient::CompositorMutatorClient"); 24 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositorMuta torClient::CompositorMutatorClient");
23 } 25 }
24 26
25 CompositorMutatorClient::~CompositorMutatorClient() 27 CompositorMutatorClient::~CompositorMutatorClient()
26 { 28 {
27 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositorMuta torClient::~CompositorMutatorClient"); 29 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), "CompositorMuta torClient::~CompositorMutatorClient");
28 } 30 }
29 31
30 bool CompositorMutatorClient::Mutate( 32 bool CompositorMutatorClient::Mutate(
31 base::TimeTicks monotonicTime) 33 base::TimeTicks monotonicTime,
34 cc::LayerTreeImpl* treeImpl)
32 { 35 {
33 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::Mutate"); 36 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::Mutate");
34 double monotonicTimeNow = (monotonicTime - base::TimeTicks()).InSecondsF(); 37 double monotonicTimeNow = (monotonicTime - base::TimeTicks()).InSecondsF();
35 if (!m_mutations) 38 if (!m_mutations)
36 m_mutations = adoptPtr(new CompositorMutations); 39 m_mutations = adoptPtr(new CompositorMutations);
37 bool shouldReinvoke = m_mutator->mutate(monotonicTimeNow); 40 CompositorMutableStateProvider compositorState(treeImpl, m_mutations.get());
41 bool shouldReinvoke = m_mutator->mutate(monotonicTimeNow, &compositorState);
38 return shouldReinvoke; 42 return shouldReinvoke;
39 } 43 }
40 44
41 void CompositorMutatorClient::SetClient(cc::LayerTreeMutatorClient* client) 45 void CompositorMutatorClient::SetClient(cc::LayerTreeMutatorClient* client)
42 { 46 {
43 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::SetClient"); 47 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::SetClient");
44 m_client = client; 48 m_client = client;
45 setNeedsMutate(); 49 setNeedsMutate();
46 } 50 }
47 51
(...skipping 13 matching lines...) Expand all
61 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::setNeedsMutate") ; 65 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::setNeedsMutate") ;
62 m_client->SetNeedsMutate(); 66 m_client->SetNeedsMutate();
63 } 67 }
64 68
65 void CompositorMutatorClient::setMutationsForTesting(PassOwnPtr<CompositorMutati ons> mutations) 69 void CompositorMutatorClient::setMutationsForTesting(PassOwnPtr<CompositorMutati ons> mutations)
66 { 70 {
67 m_mutations = std::move(mutations); 71 m_mutations = std::move(mutations);
68 } 72 }
69 73
70 } // namespace blink 74 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698