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

Side by Side Diff: sky/compositor/layer.cc

Issue 757643002: Add some trace events to Sky compositor (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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 | « no previous file | sky/compositor/layer_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "sky/compositor/layer.h" 5 #include "sky/compositor/layer.h"
6 6
7 #include "base/debug/trace_event.h"
7 #include "mojo/skia/ganesh_surface.h" 8 #include "mojo/skia/ganesh_surface.h"
8 #include "sky/compositor/layer_host.h" 9 #include "sky/compositor/layer_host.h"
9 #include "third_party/skia/include/core/SkCanvas.h" 10 #include "third_party/skia/include/core/SkCanvas.h"
10 11
11 namespace sky { 12 namespace sky {
12 13
13 Layer::Layer(LayerClient* client) : client_(client), host_(nullptr) { 14 Layer::Layer(LayerClient* client) : client_(client), host_(nullptr) {
14 } 15 }
15 16
16 Layer::~Layer() { 17 Layer::~Layer() {
17 } 18 }
18 19
19 void Layer::ClearClient() { 20 void Layer::ClearClient() {
20 client_ = nullptr; 21 client_ = nullptr;
21 } 22 }
22 23
23 void Layer::SetSize(const gfx::Size& size) { 24 void Layer::SetSize(const gfx::Size& size) {
24 size_ = size; 25 size_ = size;
25 } 26 }
26 27
27 void Layer::Display() { 28 void Layer::Display() {
29 TRACE_EVENT0("sky", "Layer::Display");
30
28 DCHECK(host_); 31 DCHECK(host_);
29 32
30 mojo::GaneshSurface surface(host_->ganesh_context(), 33 mojo::GaneshSurface surface(host_->ganesh_context(),
31 host_->resource_manager()->CreateTexture(size_)); 34 host_->resource_manager()->CreateTexture(size_));
32 35
33 SkCanvas* canvas = surface.canvas(); 36 SkCanvas* canvas = surface.canvas();
34 37
35 gfx::Rect rect(size_); 38 gfx::Rect rect(size_);
36 client_->PaintContents(canvas, rect); 39 client_->PaintContents(canvas, rect);
37 canvas->flush(); 40 canvas->flush();
38 41
39 texture_ = surface.TakeTexture(); 42 texture_ = surface.TakeTexture();
40 } 43 }
41 44
42 scoped_ptr<mojo::GLTexture> Layer::GetTexture() { 45 scoped_ptr<mojo::GLTexture> Layer::GetTexture() {
43 return texture_.Pass(); 46 return texture_.Pass();
44 } 47 }
45 48
46 } // namespace sky 49 } // namespace sky
OLDNEW
« no previous file with comments | « no previous file | sky/compositor/layer_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698