OLD | NEW |
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 "cc/blink/web_layer_impl.h" | 5 #include "cc/blink/web_layer_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event_impl.h" | 8 #include "base/debug/trace_event_impl.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 using blink::WebFilterOperations; | 40 using blink::WebFilterOperations; |
41 | 41 |
42 namespace cc_blink { | 42 namespace cc_blink { |
43 namespace { | 43 namespace { |
44 | 44 |
45 bool g_impl_side_painting_enabled = false; | 45 bool g_impl_side_painting_enabled = false; |
46 | 46 |
47 } // namespace | 47 } // namespace |
48 | 48 |
49 WebLayerImpl::WebLayerImpl() : layer_(Layer::Create()) { | 49 WebLayerImpl::WebLayerImpl() : layer_(Layer::Create()) { |
50 web_layer_client_ = NULL; | 50 web_layer_client_ = nullptr; |
51 layer_->SetLayerClient(this); | 51 layer_->SetLayerClient(this); |
52 } | 52 } |
53 | 53 |
54 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) : layer_(layer) { | 54 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) : layer_(layer) { |
55 web_layer_client_ = NULL; | 55 web_layer_client_ = nullptr; |
56 layer_->SetLayerClient(this); | 56 layer_->SetLayerClient(this); |
57 } | 57 } |
58 | 58 |
59 WebLayerImpl::~WebLayerImpl() { | 59 WebLayerImpl::~WebLayerImpl() { |
60 layer_->ClearRenderSurface(); | 60 layer_->ClearRenderSurface(); |
61 layer_->set_layer_animation_delegate(NULL); | 61 layer_->set_layer_animation_delegate(nullptr); |
62 web_layer_client_ = NULL; | 62 web_layer_client_ = nullptr; |
63 } | 63 } |
64 | 64 |
65 // static | 65 // static |
66 bool WebLayerImpl::UsingPictureLayer() { | 66 bool WebLayerImpl::UsingPictureLayer() { |
67 return g_impl_side_painting_enabled; | 67 return g_impl_side_painting_enabled; |
68 } | 68 } |
69 | 69 |
70 // static | 70 // static |
71 void WebLayerImpl::SetImplSidePaintingEnabled(bool enabled) { | 71 void WebLayerImpl::SetImplSidePaintingEnabled(bool enabled) { |
72 g_impl_side_painting_enabled = enabled; | 72 g_impl_side_painting_enabled = enabled; |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 | 452 |
453 private: | 453 private: |
454 virtual ~TracedDebugInfo() {} | 454 virtual ~TracedDebugInfo() {} |
455 scoped_ptr<blink::WebGraphicsLayerDebugInfo> debug_info_; | 455 scoped_ptr<blink::WebGraphicsLayerDebugInfo> debug_info_; |
456 base::ThreadChecker thread_checker_; | 456 base::ThreadChecker thread_checker_; |
457 }; | 457 }; |
458 | 458 |
459 scoped_refptr<base::debug::ConvertableToTraceFormat> | 459 scoped_refptr<base::debug::ConvertableToTraceFormat> |
460 WebLayerImpl::TakeDebugInfo() { | 460 WebLayerImpl::TakeDebugInfo() { |
461 if (!web_layer_client_) | 461 if (!web_layer_client_) |
462 return NULL; | 462 return nullptr; |
463 blink::WebGraphicsLayerDebugInfo* debug_info = | 463 blink::WebGraphicsLayerDebugInfo* debug_info = |
464 web_layer_client_->takeDebugInfoFor(this); | 464 web_layer_client_->takeDebugInfoFor(this); |
465 | 465 |
466 if (debug_info) | 466 if (debug_info) |
467 return new TracedDebugInfo(debug_info); | 467 return new TracedDebugInfo(debug_info); |
468 else | 468 else |
469 return NULL; | 469 return nullptr; |
470 } | 470 } |
471 | 471 |
472 void WebLayerImpl::setScrollParent(blink::WebLayer* parent) { | 472 void WebLayerImpl::setScrollParent(blink::WebLayer* parent) { |
473 cc::Layer* scroll_parent = NULL; | 473 cc::Layer* scroll_parent = nullptr; |
474 if (parent) | 474 if (parent) |
475 scroll_parent = static_cast<WebLayerImpl*>(parent)->layer(); | 475 scroll_parent = static_cast<WebLayerImpl*>(parent)->layer(); |
476 layer_->SetScrollParent(scroll_parent); | 476 layer_->SetScrollParent(scroll_parent); |
477 } | 477 } |
478 | 478 |
479 void WebLayerImpl::setClipParent(blink::WebLayer* parent) { | 479 void WebLayerImpl::setClipParent(blink::WebLayer* parent) { |
480 cc::Layer* clip_parent = NULL; | 480 cc::Layer* clip_parent = nullptr; |
481 if (parent) | 481 if (parent) |
482 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); | 482 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); |
483 layer_->SetClipParent(clip_parent); | 483 layer_->SetClipParent(clip_parent); |
484 } | 484 } |
485 | 485 |
486 Layer* WebLayerImpl::layer() const { | 486 Layer* WebLayerImpl::layer() const { |
487 return layer_.get(); | 487 return layer_.get(); |
488 } | 488 } |
489 | 489 |
490 } // namespace cc_blink | 490 } // namespace cc_blink |
OLD | NEW |