| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 GpuProcessHost::gpu_enabled() && | 504 GpuProcessHost::gpu_enabled() && |
| 505 !command_line.HasSwitch(switches::kDisableAccelerated2dCanvas); | 505 !command_line.HasSwitch(switches::kDisableAccelerated2dCanvas); |
| 506 prefs.deferred_2d_canvas_enabled = | 506 prefs.deferred_2d_canvas_enabled = |
| 507 !command_line.HasSwitch(switches::kDisableDeferred2dCanvas); | 507 !command_line.HasSwitch(switches::kDisableDeferred2dCanvas); |
| 508 prefs.accelerated_painting_enabled = | 508 prefs.accelerated_painting_enabled = |
| 509 GpuProcessHost::gpu_enabled() && | 509 GpuProcessHost::gpu_enabled() && |
| 510 command_line.HasSwitch(switches::kEnableAcceleratedPainting); | 510 command_line.HasSwitch(switches::kEnableAcceleratedPainting); |
| 511 prefs.accelerated_filters_enabled = | 511 prefs.accelerated_filters_enabled = |
| 512 GpuProcessHost::gpu_enabled() && | 512 GpuProcessHost::gpu_enabled() && |
| 513 command_line.HasSwitch(switches::kEnableAcceleratedFilters); | 513 command_line.HasSwitch(switches::kEnableAcceleratedFilters); |
| 514 prefs.accelerated_layers_enabled = | 514 prefs.accelerated_compositing_for_3d_transforms_enabled = |
| 515 prefs.accelerated_animation_enabled = | 515 prefs.accelerated_compositing_for_animation_enabled = |
| 516 !command_line.HasSwitch(switches::kDisableAcceleratedLayers); | 516 !command_line.HasSwitch(switches::kDisableAcceleratedLayers); |
| 517 prefs.accelerated_plugins_enabled = | 517 prefs.accelerated_compositing_for_plugins_enabled = |
| 518 !command_line.HasSwitch(switches::kDisableAcceleratedPlugins); | 518 !command_line.HasSwitch(switches::kDisableAcceleratedPlugins); |
| 519 prefs.accelerated_video_enabled = | 519 prefs.accelerated_compositing_for_video_enabled = |
| 520 !command_line.HasSwitch(switches::kDisableAcceleratedVideo); | 520 !command_line.HasSwitch(switches::kDisableAcceleratedVideo); |
| 521 prefs.fullscreen_enabled = | 521 prefs.fullscreen_enabled = |
| 522 !command_line.HasSwitch(switches::kDisableFullScreen); | 522 !command_line.HasSwitch(switches::kDisableFullScreen); |
| 523 prefs.css_sticky_position_enabled = | 523 prefs.css_sticky_position_enabled = |
| 524 command_line.HasSwitch(switches::kEnableExperimentalWebKitFeatures); | 524 command_line.HasSwitch(switches::kEnableExperimentalWebKitFeatures); |
| 525 prefs.css_regions_enabled = | 525 prefs.css_regions_enabled = |
| 526 command_line.HasSwitch(switches::kEnableExperimentalWebKitFeatures); | 526 command_line.HasSwitch(switches::kEnableExperimentalWebKitFeatures); |
| 527 prefs.css_shaders_enabled = | 527 prefs.css_shaders_enabled = |
| 528 command_line.HasSwitch(switches::kEnableCssShaders); | 528 command_line.HasSwitch(switches::kEnableCssShaders); |
| 529 prefs.css_variables_enabled = | 529 prefs.css_variables_enabled = |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 prefs.experimental_webgl_enabled = false; | 564 prefs.experimental_webgl_enabled = false; |
| 565 if (blacklist_type & GPU_FEATURE_TYPE_FLASH3D) | 565 if (blacklist_type & GPU_FEATURE_TYPE_FLASH3D) |
| 566 prefs.flash_3d_enabled = false; | 566 prefs.flash_3d_enabled = false; |
| 567 if (blacklist_type & GPU_FEATURE_TYPE_FLASH_STAGE3D) | 567 if (blacklist_type & GPU_FEATURE_TYPE_FLASH_STAGE3D) |
| 568 prefs.flash_stage3d_enabled = false; | 568 prefs.flash_stage3d_enabled = false; |
| 569 if (blacklist_type & GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) | 569 if (blacklist_type & GPU_FEATURE_TYPE_ACCELERATED_2D_CANVAS) |
| 570 prefs.accelerated_2d_canvas_enabled = false; | 570 prefs.accelerated_2d_canvas_enabled = false; |
| 571 if (blacklist_type & GPU_FEATURE_TYPE_MULTISAMPLING) | 571 if (blacklist_type & GPU_FEATURE_TYPE_MULTISAMPLING) |
| 572 prefs.gl_multisampling_enabled = false; | 572 prefs.gl_multisampling_enabled = false; |
| 573 if (blacklist_type & GPU_FEATURE_TYPE_3D_CSS) { | 573 if (blacklist_type & GPU_FEATURE_TYPE_3D_CSS) { |
| 574 prefs.accelerated_layers_enabled = false; | 574 prefs.accelerated_compositing_for_3d_transforms_enabled = false; |
| 575 prefs.accelerated_animation_enabled = false; | 575 prefs.accelerated_compositing_for_animation_enabled = false; |
| 576 } | 576 } |
| 577 if (blacklist_type & GPU_FEATURE_TYPE_ACCELERATED_VIDEO) | 577 if (blacklist_type & GPU_FEATURE_TYPE_ACCELERATED_VIDEO) |
| 578 prefs.accelerated_video_enabled = false; | 578 prefs.accelerated_compositing_for_video_enabled = false; |
| 579 | 579 |
| 580 // Accelerated video and animation are slower than regular when using a | 580 // Accelerated video and animation are slower than regular when using a |
| 581 // software 3d rasterizer. 3D CSS may also be too slow to be worthwhile. | 581 // software 3d rasterizer. 3D CSS may also be too slow to be worthwhile. |
| 582 if (gpu_data_manager->ShouldUseSoftwareRendering()) { | 582 if (gpu_data_manager->ShouldUseSoftwareRendering()) { |
| 583 prefs.accelerated_video_enabled = false; | 583 prefs.accelerated_compositing_for_video_enabled = false; |
| 584 prefs.accelerated_animation_enabled = false; | 584 prefs.accelerated_compositing_for_animation_enabled = false; |
| 585 prefs.accelerated_layers_enabled = false; | 585 prefs.accelerated_compositing_for_3d_transforms_enabled = false; |
| 586 prefs.accelerated_plugins_enabled = false; | 586 prefs.accelerated_compositing_for_plugins_enabled = false; |
| 587 } | 587 } |
| 588 } | 588 } |
| 589 | 589 |
| 590 if (ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( | 590 if (ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( |
| 591 rvh->GetProcess()->GetID())) { | 591 rvh->GetProcess()->GetID())) { |
| 592 prefs.loads_images_automatically = true; | 592 prefs.loads_images_automatically = true; |
| 593 prefs.javascript_enabled = true; | 593 prefs.javascript_enabled = true; |
| 594 } | 594 } |
| 595 | 595 |
| 596 prefs.is_online = !net::NetworkChangeNotifier::IsOffline(); | 596 prefs.is_online = !net::NetworkChangeNotifier::IsOffline(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 616 prefs.max_untiled_layer_width = | 616 prefs.max_untiled_layer_width = |
| 617 GetSwitchValueAsInt(command_line, switches::kMaxUntiledLayerWidth, 1); | 617 GetSwitchValueAsInt(command_line, switches::kMaxUntiledLayerWidth, 1); |
| 618 if (command_line.HasSwitch(switches::kMaxUntiledLayerHeight)) | 618 if (command_line.HasSwitch(switches::kMaxUntiledLayerHeight)) |
| 619 prefs.max_untiled_layer_height = | 619 prefs.max_untiled_layer_height = |
| 620 GetSwitchValueAsInt(command_line, switches::kMaxUntiledLayerHeight, 1); | 620 GetSwitchValueAsInt(command_line, switches::kMaxUntiledLayerHeight, 1); |
| 621 | 621 |
| 622 // TODO(scottmg): Probably Native is wrong: http://crbug.com/133312 | 622 // TODO(scottmg): Probably Native is wrong: http://crbug.com/133312 |
| 623 if (gfx::Screen::GetNativeScreen()->IsDIPEnabled()) { | 623 if (gfx::Screen::GetNativeScreen()->IsDIPEnabled()) { |
| 624 // Only apply when using DIP coordinate system as this setting interferes | 624 // Only apply when using DIP coordinate system as this setting interferes |
| 625 // with fixed layout mode. | 625 // with fixed layout mode. |
| 626 // TODO(danakj): Fixed layout mode is going away, so turn this on always. |
| 626 prefs.apply_default_device_scale_factor_in_compositor = true; | 627 prefs.apply_default_device_scale_factor_in_compositor = true; |
| 627 } | 628 } |
| 628 | 629 |
| 630 prefs.apply_page_scale_factor_in_compositor = |
| 631 command_line.HasSwitch(cc::switches::kEnablePinchInCompositor); |
| 632 prefs.per_tile_painting_enabled = |
| 633 command_line.HasSwitch(cc::switches::kEnablePerTilePainting); |
| 634 prefs.accelerated_compositing_for_animation_enabled = |
| 635 !command_line.HasSwitch(cc::switches::kDisableThreadedAnimation); |
| 636 |
| 629 prefs.fixed_position_creates_stacking_context = !command_line.HasSwitch( | 637 prefs.fixed_position_creates_stacking_context = !command_line.HasSwitch( |
| 630 switches::kDisableFixedPositionCreatesStackingContext); | 638 switches::kDisableFixedPositionCreatesStackingContext); |
| 631 | 639 |
| 632 prefs.gesture_tap_highlight_enabled = command_line.HasSwitch( | 640 prefs.gesture_tap_highlight_enabled = command_line.HasSwitch( |
| 633 switches::kEnableGestureTapHighlight); | 641 switches::kEnableGestureTapHighlight); |
| 634 | 642 |
| 635 prefs.number_of_cpu_cores = base::SysInfo::NumberOfProcessors(); | 643 prefs.number_of_cpu_cores = base::SysInfo::NumberOfProcessors(); |
| 636 | 644 |
| 637 prefs.apply_page_scale_factor_in_compositor = | |
| 638 command_line.HasSwitch(cc::switches::kEnablePinchInCompositor); | |
| 639 | |
| 640 prefs.deferred_image_decoding_enabled = | 645 prefs.deferred_image_decoding_enabled = |
| 641 command_line.HasSwitch(switches::kEnableDeferredImageDecoding); | 646 command_line.HasSwitch(switches::kEnableDeferredImageDecoding); |
| 642 | 647 |
| 643 GetContentClient()->browser()->OverrideWebkitPrefs(rvh, url, &prefs); | 648 GetContentClient()->browser()->OverrideWebkitPrefs(rvh, url, &prefs); |
| 644 | 649 |
| 645 // Disable compositing in guests until we have compositing path implemented | 650 // Disable compositing in guests until we have compositing path implemented |
| 646 // for guests. | 651 // for guests. |
| 647 if (rvh->GetProcess()->IsGuest()) { | 652 if (rvh->GetProcess()->IsGuest()) { |
| 648 prefs.force_compositing_mode = false; | 653 prefs.force_compositing_mode = false; |
| 649 prefs.accelerated_compositing_enabled = false; | 654 prefs.accelerated_compositing_enabled = false; |
| (...skipping 2671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3321 | 3326 |
| 3322 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { | 3327 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { |
| 3323 return browser_plugin_guest_.get(); | 3328 return browser_plugin_guest_.get(); |
| 3324 } | 3329 } |
| 3325 | 3330 |
| 3326 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { | 3331 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { |
| 3327 return browser_plugin_embedder_.get(); | 3332 return browser_plugin_embedder_.get(); |
| 3328 } | 3333 } |
| 3329 | 3334 |
| 3330 } // namespace content | 3335 } // namespace content |
| OLD | NEW |