| 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/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 } | 451 } |
| 452 | 452 |
| 453 bool WebLayerImpl::isOrphan() const { | 453 bool WebLayerImpl::isOrphan() const { |
| 454 return !layer_->layer_tree_host(); | 454 return !layer_->layer_tree_host(); |
| 455 } | 455 } |
| 456 | 456 |
| 457 void WebLayerImpl::setWebLayerClient(blink::WebLayerClient* client) { | 457 void WebLayerImpl::setWebLayerClient(blink::WebLayerClient* client) { |
| 458 web_layer_client_ = client; | 458 web_layer_client_ = client; |
| 459 } | 459 } |
| 460 | 460 |
| 461 class TracedDebugInfo : public base::debug::ConvertableToTraceFormat { | 461 class TracedDebugInfo : public base::trace_event::ConvertableToTraceFormat { |
| 462 public: | 462 public: |
| 463 // This object takes ownership of the debug_info object. | 463 // This object takes ownership of the debug_info object. |
| 464 explicit TracedDebugInfo(blink::WebGraphicsLayerDebugInfo* debug_info) | 464 explicit TracedDebugInfo(blink::WebGraphicsLayerDebugInfo* debug_info) |
| 465 : debug_info_(debug_info) {} | 465 : debug_info_(debug_info) {} |
| 466 void AppendAsTraceFormat(std::string* out) const override { | 466 void AppendAsTraceFormat(std::string* out) const override { |
| 467 DCHECK(thread_checker_.CalledOnValidThread()); | 467 DCHECK(thread_checker_.CalledOnValidThread()); |
| 468 blink::WebString web_string; | 468 blink::WebString web_string; |
| 469 debug_info_->appendAsTraceFormat(&web_string); | 469 debug_info_->appendAsTraceFormat(&web_string); |
| 470 out->append(web_string.utf8()); | 470 out->append(web_string.utf8()); |
| 471 } | 471 } |
| 472 | 472 |
| 473 private: | 473 private: |
| 474 ~TracedDebugInfo() override {} | 474 ~TracedDebugInfo() override {} |
| 475 scoped_ptr<blink::WebGraphicsLayerDebugInfo> debug_info_; | 475 scoped_ptr<blink::WebGraphicsLayerDebugInfo> debug_info_; |
| 476 base::ThreadChecker thread_checker_; | 476 base::ThreadChecker thread_checker_; |
| 477 }; | 477 }; |
| 478 | 478 |
| 479 scoped_refptr<base::debug::ConvertableToTraceFormat> | 479 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 480 WebLayerImpl::TakeDebugInfo() { | 480 WebLayerImpl::TakeDebugInfo() { |
| 481 if (!web_layer_client_) | 481 if (!web_layer_client_) |
| 482 return nullptr; | 482 return nullptr; |
| 483 blink::WebGraphicsLayerDebugInfo* debug_info = | 483 blink::WebGraphicsLayerDebugInfo* debug_info = |
| 484 web_layer_client_->takeDebugInfoFor(this); | 484 web_layer_client_->takeDebugInfoFor(this); |
| 485 | 485 |
| 486 if (debug_info) | 486 if (debug_info) |
| 487 return new TracedDebugInfo(debug_info); | 487 return new TracedDebugInfo(debug_info); |
| 488 else | 488 else |
| 489 return nullptr; | 489 return nullptr; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 501 if (parent) | 501 if (parent) |
| 502 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); | 502 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); |
| 503 layer_->SetClipParent(clip_parent); | 503 layer_->SetClipParent(clip_parent); |
| 504 } | 504 } |
| 505 | 505 |
| 506 Layer* WebLayerImpl::layer() const { | 506 Layer* WebLayerImpl::layer() const { |
| 507 return layer_.get(); | 507 return layer_.get(); |
| 508 } | 508 } |
| 509 | 509 |
| 510 } // namespace cc_blink | 510 } // namespace cc_blink |
| OLD | NEW |