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

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

Issue 1625473002: compositor-worker: blink->cc plumbing Base URL: https://chromium.googlesource.com/chromium/src.git@upstream-compositor-worker
Patch Set: Merge with landing of https://codereview.chromium.org/1599673002/ on master Created 4 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "platform/graphics/CompositorMutatorClient.h"
6
7 #include "cc/animation/mutable_properties.h"
8 #include "platform/TraceEvent.h"
9 #include "platform/graphics/CompositorMutableProperties.h"
10 #include "platform/graphics/CompositorMutableStateProvider.h"
11 #include "platform/graphics/CompositorMutation.h"
12 #include "platform/graphics/CompositorMutator.h"
13 #include "public/platform/WebCompositorMutations.h"
14
15 namespace blink {
16
17 CompositorMutatorClient::CompositorMutatorClient(CompositorMutator* mutator)
18 : m_client(nullptr)
19 , m_mutator(mutator)
20 {
21 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::CompositorMutato rClient");
22 }
23
24 CompositorMutatorClient::~CompositorMutatorClient()
25 {
26 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::~CompositorMutat orClient");
27 }
28
29 bool CompositorMutatorClient::Mutate(
30 base::TimeTicks now,
31 cc::LayerTreeImpl* state)
32 {
33 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::GetMutations");
34 double time = (now - base::TimeTicks()).InSecondsF();
35 if (!m_mutations)
36 m_mutations = adoptPtr(new CompositorMutations);
37 CompositorMutableStateProvider compositorState(state, m_mutations.get());
38 bool shouldReinvoke = m_mutator->mutate(time, &compositorState);
39 return shouldReinvoke;
40 }
41
42 void CompositorMutatorClient::SetClient(cc::LayerTreeMutatorClient* client)
43 {
44 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::SetClient");
45 m_client = client;
46 setNeedsMutate();
47 }
48
49 scoped_ptr<cc::LayerTreeMutations> CompositorMutatorClient::TakeMutations()
50 {
51 return make_scoped_ptr<cc::LayerTreeMutations>(m_mutations.leakPtr());
52 }
53
54 void CompositorMutatorClient::setNeedsMutate()
55 {
56 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::requestMutation" );
57 m_client->SetNeedsMutate();
58 }
59
60 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698