OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/renderer/gpu/render_widget_compositor.h" | 5 #include "content/renderer/gpu/render_widget_compositor.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #if defined(OS_ANDROID) | 10 #if defined(OS_ANDROID) |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" | 32 #include "webkit/renderer/compositor_bindings/web_layer_impl.h" |
33 | 33 |
34 namespace base { | 34 namespace base { |
35 class Value; | 35 class Value; |
36 } | 36 } |
37 | 37 |
38 namespace cc { | 38 namespace cc { |
39 class Layer; | 39 class Layer; |
40 } | 40 } |
41 | 41 |
42 using WebKit::WebFloatPoint; | 42 using blink::WebFloatPoint; |
43 using WebKit::WebSize; | 43 using blink::WebSize; |
44 using WebKit::WebRect; | 44 using blink::WebRect; |
45 | 45 |
46 namespace content { | 46 namespace content { |
47 namespace { | 47 namespace { |
48 | 48 |
49 bool GetSwitchValueAsInt( | 49 bool GetSwitchValueAsInt( |
50 const CommandLine& command_line, | 50 const CommandLine& command_line, |
51 const std::string& switch_string, | 51 const std::string& switch_string, |
52 int min_value, | 52 int min_value, |
53 int max_value, | 53 int max_value, |
54 int* result) { | 54 int* result) { |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 RenderThreadImpl::current()->compositor_message_loop_proxy(); | 418 RenderThreadImpl::current()->compositor_message_loop_proxy(); |
419 layer_tree_host_ = cc::LayerTreeHost::Create( | 419 layer_tree_host_ = cc::LayerTreeHost::Create( |
420 this, NULL, settings, compositor_message_loop_proxy); | 420 this, NULL, settings, compositor_message_loop_proxy); |
421 return layer_tree_host_; | 421 return layer_tree_host_; |
422 } | 422 } |
423 | 423 |
424 void RenderWidgetCompositor::setSurfaceReady() { | 424 void RenderWidgetCompositor::setSurfaceReady() { |
425 layer_tree_host_->SetLayerTreeHostClientReady(); | 425 layer_tree_host_->SetLayerTreeHostClientReady(); |
426 } | 426 } |
427 | 427 |
428 void RenderWidgetCompositor::setRootLayer(const WebKit::WebLayer& layer) { | 428 void RenderWidgetCompositor::setRootLayer(const blink::WebLayer& layer) { |
429 layer_tree_host_->SetRootLayer( | 429 layer_tree_host_->SetRootLayer( |
430 static_cast<const webkit::WebLayerImpl*>(&layer)->layer()); | 430 static_cast<const webkit::WebLayerImpl*>(&layer)->layer()); |
431 } | 431 } |
432 | 432 |
433 void RenderWidgetCompositor::clearRootLayer() { | 433 void RenderWidgetCompositor::clearRootLayer() { |
434 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); | 434 layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); |
435 } | 435 } |
436 | 436 |
437 void RenderWidgetCompositor::setViewportSize( | 437 void RenderWidgetCompositor::setViewportSize( |
438 const WebSize&, | 438 const WebSize&, |
(...skipping 15 matching lines...) Expand all Loading... |
454 } | 454 } |
455 | 455 |
456 void RenderWidgetCompositor::setDeviceScaleFactor(float device_scale) { | 456 void RenderWidgetCompositor::setDeviceScaleFactor(float device_scale) { |
457 layer_tree_host_->SetDeviceScaleFactor(device_scale); | 457 layer_tree_host_->SetDeviceScaleFactor(device_scale); |
458 } | 458 } |
459 | 459 |
460 float RenderWidgetCompositor::deviceScaleFactor() const { | 460 float RenderWidgetCompositor::deviceScaleFactor() const { |
461 return layer_tree_host_->device_scale_factor(); | 461 return layer_tree_host_->device_scale_factor(); |
462 } | 462 } |
463 | 463 |
464 void RenderWidgetCompositor::setBackgroundColor(WebKit::WebColor color) { | 464 void RenderWidgetCompositor::setBackgroundColor(blink::WebColor color) { |
465 layer_tree_host_->set_background_color(color); | 465 layer_tree_host_->set_background_color(color); |
466 } | 466 } |
467 | 467 |
468 void RenderWidgetCompositor::setHasTransparentBackground(bool transparent) { | 468 void RenderWidgetCompositor::setHasTransparentBackground(bool transparent) { |
469 layer_tree_host_->set_has_transparent_background(transparent); | 469 layer_tree_host_->set_has_transparent_background(transparent); |
470 } | 470 } |
471 | 471 |
472 void RenderWidgetCompositor::setOverhangBitmap(const SkBitmap& bitmap) { | 472 void RenderWidgetCompositor::setOverhangBitmap(const SkBitmap& bitmap) { |
473 layer_tree_host_->SetOverhangBitmap(bitmap); | 473 layer_tree_host_->SetOverhangBitmap(bitmap); |
474 } | 474 } |
475 | 475 |
476 void RenderWidgetCompositor::setVisible(bool visible) { | 476 void RenderWidgetCompositor::setVisible(bool visible) { |
477 layer_tree_host_->SetVisible(visible); | 477 layer_tree_host_->SetVisible(visible); |
478 } | 478 } |
479 | 479 |
480 void RenderWidgetCompositor::setPageScaleFactorAndLimits( | 480 void RenderWidgetCompositor::setPageScaleFactorAndLimits( |
481 float page_scale_factor, float minimum, float maximum) { | 481 float page_scale_factor, float minimum, float maximum) { |
482 layer_tree_host_->SetPageScaleFactorAndLimits( | 482 layer_tree_host_->SetPageScaleFactorAndLimits( |
483 page_scale_factor, minimum, maximum); | 483 page_scale_factor, minimum, maximum); |
484 } | 484 } |
485 | 485 |
486 void RenderWidgetCompositor::startPageScaleAnimation( | 486 void RenderWidgetCompositor::startPageScaleAnimation( |
487 const WebKit::WebPoint& destination, | 487 const blink::WebPoint& destination, |
488 bool use_anchor, | 488 bool use_anchor, |
489 float new_page_scale, | 489 float new_page_scale, |
490 double duration_sec) { | 490 double duration_sec) { |
491 base::TimeDelta duration = base::TimeDelta::FromMicroseconds( | 491 base::TimeDelta duration = base::TimeDelta::FromMicroseconds( |
492 duration_sec * base::Time::kMicrosecondsPerSecond); | 492 duration_sec * base::Time::kMicrosecondsPerSecond); |
493 layer_tree_host_->StartPageScaleAnimation( | 493 layer_tree_host_->StartPageScaleAnimation( |
494 gfx::Vector2d(destination.x, destination.y), | 494 gfx::Vector2d(destination.x, destination.y), |
495 use_anchor, | 495 use_anchor, |
496 new_page_scale, | 496 new_page_scale, |
497 duration); | 497 duration); |
(...skipping 11 matching lines...) Expand all Loading... |
509 } | 509 } |
510 | 510 |
511 bool RenderWidgetCompositor::commitRequested() const { | 511 bool RenderWidgetCompositor::commitRequested() const { |
512 return layer_tree_host_->CommitRequested(); | 512 return layer_tree_host_->CommitRequested(); |
513 } | 513 } |
514 | 514 |
515 void RenderWidgetCompositor::didStopFlinging() { | 515 void RenderWidgetCompositor::didStopFlinging() { |
516 layer_tree_host_->DidStopFlinging(); | 516 layer_tree_host_->DidStopFlinging(); |
517 } | 517 } |
518 | 518 |
519 void RenderWidgetCompositor::registerForAnimations(WebKit::WebLayer* layer) { | 519 void RenderWidgetCompositor::registerForAnimations(blink::WebLayer* layer) { |
520 cc::Layer* cc_layer = static_cast<webkit::WebLayerImpl*>(layer)->layer(); | 520 cc::Layer* cc_layer = static_cast<webkit::WebLayerImpl*>(layer)->layer(); |
521 cc_layer->layer_animation_controller()->SetAnimationRegistrar( | 521 cc_layer->layer_animation_controller()->SetAnimationRegistrar( |
522 layer_tree_host_->animation_registrar()); | 522 layer_tree_host_->animation_registrar()); |
523 } | 523 } |
524 | 524 |
525 void RenderWidgetCompositor::registerViewportLayers( | 525 void RenderWidgetCompositor::registerViewportLayers( |
526 const WebKit::WebLayer* pageScaleLayer, | 526 const blink::WebLayer* pageScaleLayer, |
527 const WebKit::WebLayer* innerViewportScrollLayer, | 527 const blink::WebLayer* innerViewportScrollLayer, |
528 const WebKit::WebLayer* outerViewportScrollLayer) { | 528 const blink::WebLayer* outerViewportScrollLayer) { |
529 layer_tree_host_->RegisterViewportLayers( | 529 layer_tree_host_->RegisterViewportLayers( |
530 static_cast<const webkit::WebLayerImpl*>(pageScaleLayer)->layer(), | 530 static_cast<const webkit::WebLayerImpl*>(pageScaleLayer)->layer(), |
531 static_cast<const webkit::WebLayerImpl*>(innerViewportScrollLayer) | 531 static_cast<const webkit::WebLayerImpl*>(innerViewportScrollLayer) |
532 ->layer(), | 532 ->layer(), |
533 // The outer viewport layer will only exist when using pinch virtual | 533 // The outer viewport layer will only exist when using pinch virtual |
534 // viewports. | 534 // viewports. |
535 outerViewportScrollLayer ? static_cast<const webkit::WebLayerImpl*>( | 535 outerViewportScrollLayer ? static_cast<const webkit::WebLayerImpl*>( |
536 outerViewportScrollLayer)->layer() | 536 outerViewportScrollLayer)->layer() |
537 : NULL); | 537 : NULL); |
538 } | 538 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 return RenderThreadImpl::current()->OffscreenCompositorContextProvider(); | 648 return RenderThreadImpl::current()->OffscreenCompositorContextProvider(); |
649 } | 649 } |
650 | 650 |
651 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { | 651 void RenderWidgetCompositor::RateLimitSharedMainThreadContext() { |
652 cc::ContextProvider* provider = | 652 cc::ContextProvider* provider = |
653 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); | 653 RenderThreadImpl::current()->SharedMainThreadContextProvider().get(); |
654 provider->Context3d()->rateLimitOffscreenContextCHROMIUM(); | 654 provider->Context3d()->rateLimitOffscreenContextCHROMIUM(); |
655 } | 655 } |
656 | 656 |
657 } // namespace content | 657 } // namespace content |
OLD | NEW |