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

Side by Side Diff: webkit/renderer/compositor_bindings/web_layer_impl.cc

Issue 16903005: Add layer name into frame viewer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: get debug name in Update() Created 7 years, 4 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "webkit/renderer/compositor_bindings/web_layer_impl.h" 5 #include "webkit/renderer/compositor_bindings/web_layer_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "cc/animation/animation.h" 9 #include "cc/animation/animation.h"
10 #include "cc/base/region.h" 10 #include "cc/base/region.h"
11 #include "cc/layers/layer.h" 11 #include "cc/layers/layer.h"
12 #include "cc/layers/layer_position_constraint.h" 12 #include "cc/layers/layer_position_constraint.h"
13 #include "third_party/WebKit/public/platform/WebCompositingReasons.h" 13 #include "third_party/WebKit/public/platform/WebCompositingReasons.h"
14 #include "third_party/WebKit/public/platform/WebFloatPoint.h" 14 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
15 #include "third_party/WebKit/public/platform/WebFloatRect.h" 15 #include "third_party/WebKit/public/platform/WebFloatRect.h"
16 #include "third_party/WebKit/public/platform/WebLayerClient.h"
16 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" 17 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h"
17 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" 18 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h"
18 #include "third_party/WebKit/public/platform/WebSize.h" 19 #include "third_party/WebKit/public/platform/WebSize.h"
19 #include "third_party/skia/include/utils/SkMatrix44.h" 20 #include "third_party/skia/include/utils/SkMatrix44.h"
20 #include "webkit/renderer/compositor_bindings/web_animation_impl.h" 21 #include "webkit/renderer/compositor_bindings/web_animation_impl.h"
21 #include "webkit/renderer/compositor_bindings/web_filter_operations_impl.h" 22 #include "webkit/renderer/compositor_bindings/web_filter_operations_impl.h"
22 #include "webkit/renderer/compositor_bindings/web_to_cc_animation_delegate_adapt er.h" 23 #include "webkit/renderer/compositor_bindings/web_to_cc_animation_delegate_adapt er.h"
23 24
24 using cc::Animation; 25 using cc::Animation;
25 using cc::Layer; 26 using cc::Layer;
26 using WebKit::WebLayer; 27 using WebKit::WebLayer;
27 using WebKit::WebFloatPoint; 28 using WebKit::WebFloatPoint;
28 using WebKit::WebVector; 29 using WebKit::WebVector;
29 using WebKit::WebRect; 30 using WebKit::WebRect;
30 using WebKit::WebSize; 31 using WebKit::WebSize;
31 using WebKit::WebColor; 32 using WebKit::WebColor;
32 using WebKit::WebFilterOperations; 33 using WebKit::WebFilterOperations;
33 34
34 namespace webkit { 35 namespace webkit {
35 36
36 WebLayerImpl::WebLayerImpl() : layer_(Layer::Create()) {} 37 WebLayerImpl::WebLayerImpl() : layer_(Layer::Create()) {
38 web_layer_client_ = NULL;
39 layer_->SetLayerClient(this);
40 }
37 41
38 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) : layer_(layer) {} 42 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) : layer_(layer) {
43 web_layer_client_ = NULL;
44 layer_->SetLayerClient(this);
45 }
39 46
40 WebLayerImpl::~WebLayerImpl() { 47 WebLayerImpl::~WebLayerImpl() {
41 layer_->ClearRenderSurface(); 48 layer_->ClearRenderSurface();
42 layer_->set_layer_animation_delegate(NULL); 49 layer_->set_layer_animation_delegate(NULL);
50 web_layer_client_ = NULL;
43 } 51 }
44 52
45 int WebLayerImpl::id() const { return layer_->id(); } 53 int WebLayerImpl::id() const { return layer_->id(); }
46 54
47 void WebLayerImpl::invalidateRect(const WebKit::WebFloatRect& rect) { 55 void WebLayerImpl::invalidateRect(const WebKit::WebFloatRect& rect) {
48 layer_->SetNeedsDisplayRect(rect); 56 layer_->SetNeedsDisplayRect(rect);
49 } 57 }
50 58
51 void WebLayerImpl::invalidate() { layer_->SetNeedsDisplay(); } 59 void WebLayerImpl::invalidate() { layer_->SetNeedsDisplay(); }
52 60
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 layer_->set_did_scroll_callback( 363 layer_->set_did_scroll_callback(
356 base::Bind(&WebKit::WebLayerScrollClient::didScroll, 364 base::Bind(&WebKit::WebLayerScrollClient::didScroll,
357 base::Unretained(scroll_client))); 365 base::Unretained(scroll_client)));
358 } else { 366 } else {
359 layer_->set_did_scroll_callback(base::Closure()); 367 layer_->set_did_scroll_callback(base::Closure());
360 } 368 }
361 } 369 }
362 370
363 bool WebLayerImpl::isOrphan() const { return !layer_->layer_tree_host(); } 371 bool WebLayerImpl::isOrphan() const { return !layer_->layer_tree_host(); }
364 372
373 void WebLayerImpl::setWebLayerClient(WebKit::WebLayerClient* client) {
374 web_layer_client_ = client;
375 }
376
377 std::string WebLayerImpl::DebugName() {
378 if (!web_layer_client_)
379 return std::string();
380
381 std::string name = web_layer_client_->debugName(this).utf8();
382 DCHECK(IsStringASCII(name));
383 return name;
384 }
385
365 Layer* WebLayerImpl::layer() const { return layer_.get(); } 386 Layer* WebLayerImpl::layer() const { return layer_.get(); }
366 387
367 } // namespace webkit 388 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698