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

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

Issue 1547893003: WIP - compositor worker mega patch. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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/graphics/CompositorMutation.h"
9 #include "platform/graphics/CompositorMutator.h"
10 #include "platform/graphics/CompositorMutableProperties.h"
11 #include "platform/graphics/CompositorMutableStateProvider.h"
12 #include "platform/TraceEvent.h"
13
14 namespace blink {
15
16 static_assert(
17 static_cast<cc::MutableProperty>(CompositorMutablePropertyNone) == cc::kMuta blePropertyNone,
18 "MutableProperty and CompositorMutableProperty enums must match");
19
20 static_assert(
21 static_cast<cc::MutableProperty>(CompositorMutablePropertyOpacity) == cc::kM utablePropertyOpacity,
22 "MutableProperty and CompositorMutableProperty enums must match");
23
24 static_assert(
25 static_cast<cc::MutableProperty>(CompositorMutablePropertyScrollLeft) == cc: :kMutablePropertyScrollLeft,
26 "MutableProperty and CompositorMutableProperty enums must match");
27
28 static_assert(
29 static_cast<cc::MutableProperty>(CompositorMutablePropertyScrollTop) == cc:: kMutablePropertyScrollTop,
30 "MutableProperty and CompositorMutableProperty enums must match");
31
32 static_assert(
33 static_cast<cc::MutableProperty>(CompositorMutablePropertyTransform) == cc:: kMutablePropertyTransform,
34 "MutableProperty and CompositorMutableProperty enums must match");
35
36 CompositorMutatorClient::CompositorMutatorClient(CompositorMutator* mutator)
37 : m_client(nullptr)
38 , m_mutator(mutator)
39 {
40 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::CompositorMutato rClient");
41 }
42
43 CompositorMutatorClient::~CompositorMutatorClient()
44 {
45 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::~CompositorMutat orClient");
46 }
47
48 bool CompositorMutatorClient::Mutate(
49 base::TimeTicks now,
50 cc::LayerTreeImpl* state)
51 {
52 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::GetMutations");
53 double time = (now - base::TimeTicks()).InSecondsF();
54 if (!m_mutations)
55 m_mutations = adoptPtr(new CompositorMutations);
56 CompositorMutableStateProvider compositor_state(state, m_mutations.get());
57 bool should_reinvoke = m_mutator->mutate(time, &compositor_state);
58 // TODO(flackr): Detect if there actually were any mutations and set
59 // needs commit?
60 return should_reinvoke;
61 }
62
63 void CompositorMutatorClient::SetClient(cc::LayerTreeMutatorClient* client)
64 {
65 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::SetClient");
66 m_client = client;
67 setNeedsMutate();
68 }
69
70 scoped_ptr<cc::LayerTreeMutations> CompositorMutatorClient::TakeMutations()
71 {
72 return make_scoped_ptr<cc::LayerTreeMutations>(m_mutations.leakPtr());
73 }
74
75 void CompositorMutatorClient::setNeedsMutate()
76 {
77 TRACE_EVENT0("compositor-worker", "CompositorMutatorClient::requestMutation" );
78 m_client->SetNeedsMutate();
79 }
80
81 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698