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

Side by Side Diff: cc/blink/web_mutator_client_impl.cc

Issue 1547893003: WIP - compositor worker mega patch. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « cc/blink/web_mutator_client_impl.h ('k') | cc/cc.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 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 "cc/blink/web_mutator_client_impl.h"
6
7 #include "base/trace_event/trace_event.h"
8 #include "cc/blink/mutation_conversions.h"
9 #include "cc/blink/web_compositor_mutable_state_provider_impl.h"
10 #include "third_party/WebKit/public/platform/Platform.h"
11 #include "third_party/WebKit/public/platform/WebMutator.h"
12
13 namespace cc_blink {
14
15 WebMutatorClientImpl::WebMutatorClientImpl(blink::WebMutator* mutator)
16 : client_(nullptr), mutator_(mutator) {
17 TRACE_EVENT0("compositor-worker",
18 "WebMutatorClientImpl::WebMutatorClientImpl");
19 }
20
21 WebMutatorClientImpl::~WebMutatorClientImpl() {
22 TRACE_EVENT0("compositor-worker",
23 "WebMutatorClientImpl::~WebMutatorClientImpl");
24 }
25
26 bool WebMutatorClientImpl::Mutate(base::TimeTicks now,
27 cc::LayerTreeImpl* state) {
28 TRACE_EVENT0("compositor-worker", "WebMutatorClientImpl::GetMutations");
29 double time = (now - base::TimeTicks()).InSecondsF();
30 if (!mutations_)
31 mutations_.reset(new cc::LayerTreeMutationMap);
32 WebCompositorMutableStateProviderImpl compositor_state(state,
33 mutations_.get());
34 bool should_reinvoke = mutator_->mutate(time, &compositor_state);
35 // TODO(flackr): Detect if there actually were any mutations and set
36 // needs commit?
37 return should_reinvoke;
38 }
39
40 void WebMutatorClientImpl::SetClient(cc::LayerTreeMutatorClient* client) {
41 TRACE_EVENT0("compositor-worker", "WebMutatorClientImpl::SetClient");
42 client_ = client;
43 setNeedsMutate();
44 }
45
46 cc::LayerTreeMutationMap* WebMutatorClientImpl::TakeMutations() {
47 return mutations_.release();
48 }
49
50 void WebMutatorClientImpl::setNeedsMutate() {
51 TRACE_EVENT0("compositor-worker", "WebMutatorClientImpl::requestMutation");
52 client_->SetNeedsMutate();
53 }
54
55 } // namespace cc_blink
OLDNEW
« no previous file with comments | « cc/blink/web_mutator_client_impl.h ('k') | cc/cc.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698