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

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: Add static asserts for mutable properties enum. s/ASSERT/EXPECT/ in unit test. 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"
25 #include "third_party/WebKit/public/platform/WebFloatPoint.h" 26 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
26 #include "third_party/WebKit/public/platform/WebFloatRect.h" 27 #include "third_party/WebKit/public/platform/WebFloatRect.h"
27 #include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h" 28 #include "third_party/WebKit/public/platform/WebGraphicsLayerDebugInfo.h"
28 #include "third_party/WebKit/public/platform/WebLayerClient.h" 29 #include "third_party/WebKit/public/platform/WebLayerClient.h"
29 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h" 30 #include "third_party/WebKit/public/platform/WebLayerPositionConstraint.h"
30 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h" 31 #include "third_party/WebKit/public/platform/WebLayerScrollClient.h"
32 #include "third_party/WebKit/public/platform/WebMutableProperties.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"
35 37
36 using cc::Animation; 38 using cc::Animation;
37 using cc::Layer; 39 using cc::Layer;
38 using blink::WebLayer; 40 using blink::WebLayer;
39 using blink::WebFloatPoint; 41 using blink::WebFloatPoint;
40 using blink::WebVector; 42 using blink::WebVector;
(...skipping 444 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(static_cast<cc::MutableProperty>(blink::WebMutablePropertyNone) ==
506 cc::kMutablePropertyNone,
507 "MutableProperty and WebMutableProperty enums must match");
508
509 static_assert(
510 static_cast<cc::MutableProperty>(blink::WebMutablePropertyOpacity) ==
511 cc::kMutablePropertyOpacity,
512 "MutableProperty and WebMutableProperty enums must match");
513
514 static_assert(
515 static_cast<cc::MutableProperty>(blink::WebMutablePropertyScrollLeft) ==
516 cc::kMutablePropertyScrollLeft,
517 "MutableProperty and WebMutableProperty enums must match");
518
519 static_assert(
520 static_cast<cc::MutableProperty>(blink::WebMutablePropertyScrollTop) ==
521 cc::kMutablePropertyScrollTop,
522 "MutableProperty and WebMutableProperty enums must match");
523
524 static_assert(
525 static_cast<cc::MutableProperty>(blink::WebMutablePropertyTransform) ==
526 cc::kMutablePropertyTransform,
527 "MutableProperty and WebMutableProperty enums must match");
528
529 void WebLayerImpl::setMutableProperties(uint32_t properties) {
530 layer_->SetMutableProperties(properties);
531 }
532
533 uint32_t WebLayerImpl::mutableProperties() const {
534 return layer_->mutable_properties();
535 }
536
495 class TracedDebugInfo : public base::trace_event::ConvertableToTraceFormat { 537 class TracedDebugInfo : public base::trace_event::ConvertableToTraceFormat {
496 public: 538 public:
497 // This object takes ownership of the debug_info object. 539 // This object takes ownership of the debug_info object.
498 explicit TracedDebugInfo(blink::WebGraphicsLayerDebugInfo* debug_info) 540 explicit TracedDebugInfo(blink::WebGraphicsLayerDebugInfo* debug_info)
499 : debug_info_(debug_info) {} 541 : debug_info_(debug_info) {}
500 void AppendAsTraceFormat(std::string* out) const override { 542 void AppendAsTraceFormat(std::string* out) const override {
501 DCHECK(thread_checker_.CalledOnValidThread()); 543 DCHECK(thread_checker_.CalledOnValidThread());
502 blink::WebString web_string; 544 blink::WebString web_string;
503 debug_info_->appendAsTraceFormat(&web_string); 545 debug_info_->appendAsTraceFormat(&web_string);
504 out->append(web_string.utf8()); 546 out->append(web_string.utf8());
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 581
540 Layer* WebLayerImpl::layer() const { 582 Layer* WebLayerImpl::layer() const {
541 return layer_.get(); 583 return layer_.get();
542 } 584 }
543 585
544 void WebLayerImpl::SetContentsOpaqueIsFixed(bool fixed) { 586 void WebLayerImpl::SetContentsOpaqueIsFixed(bool fixed) {
545 contents_opaque_is_fixed_ = fixed; 587 contents_opaque_is_fixed_ = fixed;
546 } 588 }
547 589
548 } // namespace cc_blink 590 } // namespace cc_blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698