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

Side by Side Diff: cc/blink/web_layer_impl.cc

Issue 1405993008: compositor-worker: plumb element id and mutable properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/WebMutable/WebCompositorMutable/g Created 5 years, 1 month 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 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 <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "base/trace_event/trace_event_impl.h" 14 #include "base/trace_event/trace_event_impl.h"
15 #include "cc/animation/animation.h" 15 #include "cc/animation/animation.h"
16 #include "cc/animation/mutable_properties.h"
16 #include "cc/base/region.h" 17 #include "cc/base/region.h"
17 #include "cc/base/switches.h" 18 #include "cc/base/switches.h"
18 #include "cc/blink/web_animation_impl.h" 19 #include "cc/blink/web_animation_impl.h"
19 #include "cc/blink/web_blend_mode.h" 20 #include "cc/blink/web_blend_mode.h"
20 #include "cc/blink/web_filter_operations_impl.h" 21 #include "cc/blink/web_filter_operations_impl.h"
21 #include "cc/blink/web_to_cc_animation_delegate_adapter.h" 22 #include "cc/blink/web_to_cc_animation_delegate_adapter.h"
22 #include "cc/layers/layer.h" 23 #include "cc/layers/layer.h"
23 #include "cc/layers/layer_position_constraint.h" 24 #include "cc/layers/layer_position_constraint.h"
24 #include "cc/trees/layer_tree_host.h" 25 #include "cc/trees/layer_tree_host.h"
26 #include "third_party/WebKit/public/platform/WebCompositorMutableProperties.h"
25 #include "third_party/WebKit/public/platform/WebFloatPoint.h" 27 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
26 #include "third_party/WebKit/public/platform/WebFloatRect.h" 28 #include "third_party/WebKit/public/platform/WebFloatRect.h"
27 #include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h" 29 #include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h"
28 #include "third_party/WebKit/public/platform/WebLayerClient.h" 30 #include "third_party/WebKit/public/platform/WebLayerClient.h"
29 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" 31 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h"
30 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" 32 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h"
31 #include "third_party/WebKit/public/platform/WebSize.h" 33 #include "third_party/WebKit/public/platform/WebSize.h"
32 #include "third_party/skia/include/utils/SkMatrix44.h" 34 #include "third_party/skia/include/utils/SkMatrix44.h"
33 #include "ui/gfx/geometry/rect_conversions.h" 35 #include "ui/gfx/geometry/rect_conversions.h"
34 #include "ui/gfx/geometry/vector2d_conversions.h" 36 #include "ui/gfx/geometry/vector2d_conversions.h"
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 } 487 }
486 488
487 bool WebLayerImpl::isOrphan() const { 489 bool WebLayerImpl::isOrphan() const {
488 return !layer_->layer_tree_host(); 490 return !layer_->layer_tree_host();
489 } 491 }
490 492
491 void WebLayerImpl::setWebLayerClient(blink::WebLayerClient* client) { 493 void WebLayerImpl::setWebLayerClient(blink::WebLayerClient* client) {
492 web_layer_client_ = client; 494 web_layer_client_ = client;
493 } 495 }
494 496
497 void WebLayerImpl::setElementId(uint64_t id) {
498 layer_->SetElementId(id);
499 }
500
501 uint64_t WebLayerImpl::elementId() const {
502 return layer_->element_id();
503 }
504
505 static_assert(
506 static_cast<cc::MutableProperty>(blink::WebCompositorMutablePropertyNone) ==
507 cc::kMutablePropertyNone,
508 "MutableProperty and WebCompositorMutableProperty enums must match");
509
510 static_assert(
511 static_cast<cc::MutableProperty>(
512 blink::WebCompositorMutablePropertyOpacity) ==
513 cc::kMutablePropertyOpacity,
514 "MutableProperty and WebCompositorMutableProperty enums must match");
515
516 static_assert(
517 static_cast<cc::MutableProperty>(
518 blink::WebCompositorMutablePropertyScrollLeft) ==
519 cc::kMutablePropertyScrollLeft,
520 "MutableProperty and WebCompositorMutableProperty enums must match");
521
522 static_assert(
523 static_cast<cc::MutableProperty>(
524 blink::WebCompositorMutablePropertyScrollTop) ==
525 cc::kMutablePropertyScrollTop,
526 "MutableProperty and WebCompositorMutableProperty enums must match");
527
528 static_assert(
529 static_cast<cc::MutableProperty>(
530 blink::WebCompositorMutablePropertyTransform) ==
531 cc::kMutablePropertyTransform,
532 "MutableProperty and WebCompositorMutableProperty enums must match");
533
534 void WebLayerImpl::setMutableProperties(uint32_t properties) {
535 layer_->SetMutableProperties(properties);
536 }
537
538 uint32_t WebLayerImpl::mutableProperties() const {
539 return layer_->mutable_properties();
540 }
541
495 class TracedDebugInfo : public base::trace_event::ConvertableToTraceFormat { 542 class TracedDebugInfo : public base::trace_event::ConvertableToTraceFormat {
496 public: 543 public:
497 // This object takes ownership of the debug_info object. 544 // This object takes ownership of the debug_info object.
498 explicit TracedDebugInfo(blink::WebGraphicsLayerDebugInfo* debug_info) 545 explicit TracedDebugInfo(blink::WebGraphicsLayerDebugInfo* debug_info)
499 : debug_info_(debug_info) {} 546 : debug_info_(debug_info) {}
500 void AppendAsTraceFormat(std::string* out) const override { 547 void AppendAsTraceFormat(std::string* out) const override {
501 DCHECK(thread_checker_.CalledOnValidThread()); 548 DCHECK(thread_checker_.CalledOnValidThread());
502 blink::WebString web_string; 549 blink::WebString web_string;
503 debug_info_->appendAsTraceFormat(&web_string); 550 debug_info_->appendAsTraceFormat(&web_string);
504 out->append(web_string.utf8()); 551 out->append(web_string.utf8());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 586
540 Layer* WebLayerImpl::layer() const { 587 Layer* WebLayerImpl::layer() const {
541 return layer_.get(); 588 return layer_.get();
542 } 589 }
543 590
544 void WebLayerImpl::SetContentsOpaqueIsFixed(bool fixed) { 591 void WebLayerImpl::SetContentsOpaqueIsFixed(bool fixed) {
545 contents_opaque_is_fixed_ = fixed; 592 contents_opaque_is_fixed_ = fixed;
546 } 593 }
547 594
548 } // namespace cc_blink 595 } // namespace cc_blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698