| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 428 |
| 429 void WebLayerImpl::setWebLayerClient(blink::WebLayerClient* client) { | 429 void WebLayerImpl::setWebLayerClient(blink::WebLayerClient* client) { |
| 430 web_layer_client_ = client; | 430 web_layer_client_ = client; |
| 431 } | 431 } |
| 432 | 432 |
| 433 class TracedDebugInfo : public base::debug::ConvertableToTraceFormat { | 433 class TracedDebugInfo : public base::debug::ConvertableToTraceFormat { |
| 434 public: | 434 public: |
| 435 // This object takes ownership of the debug_info object. | 435 // This object takes ownership of the debug_info object. |
| 436 explicit TracedDebugInfo(blink::WebGraphicsLayerDebugInfo* debug_info) | 436 explicit TracedDebugInfo(blink::WebGraphicsLayerDebugInfo* debug_info) |
| 437 : debug_info_(debug_info) {} | 437 : debug_info_(debug_info) {} |
| 438 virtual void AppendAsTraceFormat(std::string* out) const override { | 438 void AppendAsTraceFormat(std::string* out) const override { |
| 439 DCHECK(thread_checker_.CalledOnValidThread()); | 439 DCHECK(thread_checker_.CalledOnValidThread()); |
| 440 blink::WebString web_string; | 440 blink::WebString web_string; |
| 441 debug_info_->appendAsTraceFormat(&web_string); | 441 debug_info_->appendAsTraceFormat(&web_string); |
| 442 out->append(web_string.utf8()); | 442 out->append(web_string.utf8()); |
| 443 } | 443 } |
| 444 | 444 |
| 445 private: | 445 private: |
| 446 virtual ~TracedDebugInfo() {} | 446 ~TracedDebugInfo() override {} |
| 447 scoped_ptr<blink::WebGraphicsLayerDebugInfo> debug_info_; | 447 scoped_ptr<blink::WebGraphicsLayerDebugInfo> debug_info_; |
| 448 base::ThreadChecker thread_checker_; | 448 base::ThreadChecker thread_checker_; |
| 449 }; | 449 }; |
| 450 | 450 |
| 451 scoped_refptr<base::debug::ConvertableToTraceFormat> | 451 scoped_refptr<base::debug::ConvertableToTraceFormat> |
| 452 WebLayerImpl::TakeDebugInfo() { | 452 WebLayerImpl::TakeDebugInfo() { |
| 453 if (!web_layer_client_) | 453 if (!web_layer_client_) |
| 454 return nullptr; | 454 return nullptr; |
| 455 blink::WebGraphicsLayerDebugInfo* debug_info = | 455 blink::WebGraphicsLayerDebugInfo* debug_info = |
| 456 web_layer_client_->takeDebugInfoFor(this); | 456 web_layer_client_->takeDebugInfoFor(this); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 473 if (parent) | 473 if (parent) |
| 474 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); | 474 clip_parent = static_cast<WebLayerImpl*>(parent)->layer(); |
| 475 layer_->SetClipParent(clip_parent); | 475 layer_->SetClipParent(clip_parent); |
| 476 } | 476 } |
| 477 | 477 |
| 478 Layer* WebLayerImpl::layer() const { | 478 Layer* WebLayerImpl::layer() const { |
| 479 return layer_.get(); | 479 return layer_.get(); |
| 480 } | 480 } |
| 481 | 481 |
| 482 } // namespace cc_blink | 482 } // namespace cc_blink |
| OLD | NEW |