render_widget_compositor.cc revision 3551c9c881056c480085172ff9840cab31610854
12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved. 22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file. 42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/renderer/gpu/render_widget_compositor.h" 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include <limits> 890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include <string> 92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/command_line.h" 112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/logging.h" 12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/strings/string_number_conversions.h" 132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/synchronization/lock.h" 14eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "base/time/time.h" 152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "cc/base/switches.h" 162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "cc/debug/layer_tree_debug_state.h" 172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "cc/layers/layer.h" 182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "cc/trees/layer_tree_host.h" 192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/common/gpu/client/context_provider_command_buffer.h" 202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/public/common/content_switches.h" 212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/renderer/gpu/input_handler_manager.h" 222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "content/renderer/render_thread_impl.h" 23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "third_party/WebKit/public/platform/WebSize.h" 247d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)#include "third_party/WebKit/public/web/WebWidget.h" 252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ui/gl/gl_switches.h" 2690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "webkit/renderer/compositor_bindings/web_layer_impl.h" 272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace cc { 292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class Layer; 302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)using WebKit::WebFloatPoint; 332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)using WebKit::WebSize; 342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)using WebKit::WebRect; 352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace content { 372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace { 382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)bool GetSwitchValueAsInt( 402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const CommandLine& command_line, 412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string& switch_string, 422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int min_value, 432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int max_value, 442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int* result) { 452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::string string_value = command_line.GetSwitchValueASCII(switch_string); 462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int int_value; 472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (base::StringToInt(string_value, &int_value) && 482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int_value >= min_value && int_value <= max_value) { 492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *result = int_value; 502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return true; 512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } else { 522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) LOG(WARNING) << "Failed to parse switch " << switch_string << ": " << 532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) string_value; 542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return false; 552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)bool GetSwitchValueAsFloat( 592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const CommandLine& command_line, 602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const std::string& switch_string, 612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) float min_value, 622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) float max_value, 632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) float* result) { 642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::string string_value = command_line.GetSwitchValueASCII(switch_string); 652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) double double_value; 662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (base::StringToDouble(string_value, &double_value) && 672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) double_value >= min_value && double_value <= max_value) { 682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *result = static_cast<float>(double_value); 692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return true; 702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } else { 712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) LOG(WARNING) << "Failed to parse switch " << switch_string << ": " << 722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) string_value; 732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return false; 742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} // namespace 792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// static 812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)scoped_ptr<RenderWidgetCompositor> RenderWidgetCompositor::Create( 82ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch RenderWidget* widget, 83ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch bool threaded) { 842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) scoped_ptr<RenderWidgetCompositor> compositor( 85ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch new RenderWidgetCompositor(widget, threaded)); 862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) CommandLine* cmd = CommandLine::ForCurrentProcess(); 882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cc::LayerTreeSettings settings; 90b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 91b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // For web contents, layer transforms should scale up the contents of layers 92b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // to keep content always crisp when possible. 93b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) settings.layer_transforms_should_scale_layer_contents = true; 94b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 9590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) settings.throttle_frame_production = 9690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) !cmd->HasSwitch(switches::kDisableGpuVsync); 97868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) settings.begin_frame_scheduling_enabled = 98868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) cmd->HasSwitch(switches::kEnableBeginFrameScheduling); 9990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) settings.using_synchronous_renderer_compositor = 10090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) widget->UsingSynchronousRendererCompositor(); 1012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.per_tile_painting_enabled = 1022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->HasSwitch(cc::switches::kEnablePerTilePainting); 1032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.accelerated_animation_enabled = 1042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) !cmd->HasSwitch(cc::switches::kDisableThreadedAnimation); 10590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) settings.force_direct_layer_drawing = 10690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) cmd->HasSwitch(cc::switches::kForceDirectLayerDrawing); 1072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int default_tile_width = settings.default_tile_size.width(); 1092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (cmd->HasSwitch(switches::kDefaultTileWidth)) { 1102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) GetSwitchValueAsInt(*cmd, switches::kDefaultTileWidth, 1, 1112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::numeric_limits<int>::max(), &default_tile_width); 1122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 1132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int default_tile_height = settings.default_tile_size.height(); 1142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (cmd->HasSwitch(switches::kDefaultTileHeight)) { 1152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) GetSwitchValueAsInt(*cmd, switches::kDefaultTileHeight, 1, 1162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::numeric_limits<int>::max(), &default_tile_height); 1172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 1182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.default_tile_size = gfx::Size(default_tile_width, 1192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) default_tile_height); 1202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int max_untiled_layer_width = settings.max_untiled_layer_size.width(); 1222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (cmd->HasSwitch(switches::kMaxUntiledLayerWidth)) { 1232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) GetSwitchValueAsInt(*cmd, switches::kMaxUntiledLayerWidth, 1, 1242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::numeric_limits<int>::max(), 1252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) &max_untiled_layer_width); 1262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 1272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int max_untiled_layer_height = settings.max_untiled_layer_size.height(); 1282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (cmd->HasSwitch(switches::kMaxUntiledLayerHeight)) { 1292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) GetSwitchValueAsInt(*cmd, switches::kMaxUntiledLayerHeight, 1, 1302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::numeric_limits<int>::max(), 1312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) &max_untiled_layer_height); 1322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 1332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.max_untiled_layer_size = gfx::Size(max_untiled_layer_width, 1352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) max_untiled_layer_height); 1362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.impl_side_painting = cc::switches::IsImplSidePaintingEnabled(); 1382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.calculate_top_controls_position = 1402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->HasSwitch(cc::switches::kEnableTopControlsPositionCalculation); 1412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (cmd->HasSwitch(cc::switches::kTopControlsHeight)) { 1422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::string controls_height_str = 1432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->GetSwitchValueASCII(cc::switches::kTopControlsHeight); 1442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) double controls_height; 1452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (base::StringToDouble(controls_height_str, &controls_height) && 1462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) controls_height > 0) 1472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.top_controls_height = controls_height; 1482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 1492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (settings.calculate_top_controls_position && 1515e3f23d412006dc4db4e659864679f29341e113fTorne (Richard Coles) settings.top_controls_height <= 0) { 1525e3f23d412006dc4db4e659864679f29341e113fTorne (Richard Coles) DCHECK(false) 1535e3f23d412006dc4db4e659864679f29341e113fTorne (Richard Coles) << "Top controls repositioning enabled without valid height set."; 1542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.calculate_top_controls_position = false; 1552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 1562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (cmd->HasSwitch(cc::switches::kTopControlsShowThreshold)) { 1582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::string top_threshold_str = 1592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->GetSwitchValueASCII(cc::switches::kTopControlsShowThreshold); 1602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) double show_threshold; 1612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (base::StringToDouble(top_threshold_str, &show_threshold) && 1622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) show_threshold >= 0.f && show_threshold <= 1.f) 1632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.top_controls_show_threshold = show_threshold; 1642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 1652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (cmd->HasSwitch(cc::switches::kTopControlsHideThreshold)) { 1672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::string top_threshold_str = 1682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->GetSwitchValueASCII(cc::switches::kTopControlsHideThreshold); 1692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) double hide_threshold; 1702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (base::StringToDouble(top_threshold_str, &hide_threshold) && 1712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) hide_threshold >= 0.f && hide_threshold <= 1.f) 1722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.top_controls_hide_threshold = hide_threshold; 1732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 1742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.partial_swap_enabled = widget->AllowPartialSwap() && 1762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->HasSwitch(cc::switches::kEnablePartialSwap); 1772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.background_color_instead_of_checkerboard = 1782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->HasSwitch(cc::switches::kBackgroundColorInsteadOfCheckerboard); 1792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.show_overdraw_in_tracing = 1802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->HasSwitch(cc::switches::kTraceOverdraw); 18190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) settings.use_pinch_virtual_viewport = 18290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) cmd->HasSwitch(cc::switches::kEnablePinchVirtualViewport); 183ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch settings.allow_antialiasing &= 184ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch !cmd->HasSwitch(cc::switches::kDisableCompositedAntialiasing); 185c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 1862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // These flags should be mirrored by UI versions in ui/compositor/. 1872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.initial_debug_state.show_debug_borders = 1882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->HasSwitch(cc::switches::kShowCompositedLayerBorders); 1892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.initial_debug_state.show_fps_counter = 1902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->HasSwitch(cc::switches::kShowFPSCounter); 1912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.initial_debug_state.show_paint_rects = 1922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->HasSwitch(switches::kShowPaintRects); 1932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.initial_debug_state.show_property_changed_rects = 1942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->HasSwitch(cc::switches::kShowPropertyChangedRects); 1952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.initial_debug_state.show_surface_damage_rects = 1962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->HasSwitch(cc::switches::kShowSurfaceDamageRects); 1972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.initial_debug_state.show_screen_space_rects = 1982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->HasSwitch(cc::switches::kShowScreenSpaceRects); 1992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.initial_debug_state.show_replica_screen_space_rects = 2002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->HasSwitch(cc::switches::kShowReplicaScreenSpaceRects); 2012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.initial_debug_state.show_occluding_rects = 2022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->HasSwitch(cc::switches::kShowOccludingRects); 2032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.initial_debug_state.show_non_occluding_rects = 2042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->HasSwitch(cc::switches::kShowNonOccludingRects); 2052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.initial_debug_state.SetRecordRenderingStats( 2072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cmd->HasSwitch(switches::kEnableGpuBenchmarking)); 2082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (cmd->HasSwitch(cc::switches::kSlowDownRasterScaleFactor)) { 2102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const int kMinSlowDownScaleFactor = 0; 2112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const int kMaxSlowDownScaleFactor = INT_MAX; 2122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) GetSwitchValueAsInt( 2132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *cmd, 2142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cc::switches::kSlowDownRasterScaleFactor, 2152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) kMinSlowDownScaleFactor, 2162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) kMaxSlowDownScaleFactor, 2172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) &settings.initial_debug_state.slow_down_raster_scale_factor); 2182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 2192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (cmd->HasSwitch(cc::switches::kNumRasterThreads)) { 2212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const int kMinRasterThreads = 1; 2222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const int kMaxRasterThreads = 64; 2232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int num_raster_threads; 2242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (GetSwitchValueAsInt(*cmd, cc::switches::kNumRasterThreads, 2252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) kMinRasterThreads, kMaxRasterThreads, 2262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) &num_raster_threads)) 2272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.num_raster_threads = num_raster_threads; 2282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 2292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (cmd->HasSwitch(cc::switches::kLowResolutionContentsScaleFactor)) { 2312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const int kMinScaleFactor = settings.minimum_contents_scale; 2322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const int kMaxScaleFactor = 1; 2332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) GetSwitchValueAsFloat(*cmd, 2342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cc::switches::kLowResolutionContentsScaleFactor, 2352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) kMinScaleFactor, kMaxScaleFactor, 2362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) &settings.low_res_contents_scale_factor); 2372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) } 2382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 239c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) if (cmd->HasSwitch(cc::switches::kMaxTilesForInterestArea)) { 240c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) int max_tiles_for_interest_area; 241c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) if (GetSwitchValueAsInt(*cmd, 242c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) cc::switches::kMaxTilesForInterestArea, 243c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 1, std::numeric_limits<int>::max(), 244c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) &max_tiles_for_interest_area)) 245c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) settings.max_tiles_for_interest_area = max_tiles_for_interest_area; 246c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) } 247c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 248c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) if (cmd->HasSwitch(cc::switches::kMaxUnusedResourceMemoryUsagePercentage)) { 249c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) int max_unused_resource_memory_percentage; 250c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) if (GetSwitchValueAsInt( 251c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) *cmd, 252c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) cc::switches::kMaxUnusedResourceMemoryUsagePercentage, 253c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 0, 100, 254c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) &max_unused_resource_memory_percentage)) { 255c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) settings.max_unused_resource_memory_percentage = 256c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) max_unused_resource_memory_percentage; 257c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) } 258c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) } 259c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 260c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) settings.strict_layer_property_change_checking = 261c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) cmd->HasSwitch(cc::switches::kStrictLayerPropertyChangeChecking); 262c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 26390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) settings.use_map_image = cmd->HasSwitch(cc::switches::kUseMapImage); 26490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 2652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#if defined(OS_ANDROID) 2662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // TODO(danakj): Move these to the android code. 2672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.can_use_lcd_text = false; 2682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.max_partial_texture_updates = 0; 2692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.use_linear_fade_scrollbar_animator = true; 2702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.solid_color_scrollbars = true; 2717dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch settings.solid_color_scrollbar_color = 2727dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch cmd->HasSwitch(switches::kHideScrollbars) 2737dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch ? SK_ColorTRANSPARENT 2747dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch : SkColorSetARGB(128, 128, 128, 128); 2752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings.solid_color_scrollbar_thickness_dip = 3; 276c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) settings.highp_threshold_min = 2048; 277a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) // Android WebView handles root layer flings itself. 278a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) settings.ignore_root_layer_flings = 279a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) widget->UsingSynchronousRendererCompositor(); 280c2db58bd994c04d98e4ee2cd7565b71548655fe3Ben Murdoch#elif !defined(OS_MACOSX) 281c2db58bd994c04d98e4ee2cd7565b71548655fe3Ben Murdoch if (cmd->HasSwitch(switches::kEnableOverlayScrollbars)) { 282c2db58bd994c04d98e4ee2cd7565b71548655fe3Ben Murdoch settings.use_linear_fade_scrollbar_animator = true; 283c2db58bd994c04d98e4ee2cd7565b71548655fe3Ben Murdoch settings.solid_color_scrollbars = true; 284c2db58bd994c04d98e4ee2cd7565b71548655fe3Ben Murdoch settings.solid_color_scrollbar_color = SkColorSetARGB(128, 128, 128, 128); 285c2db58bd994c04d98e4ee2cd7565b71548655fe3Ben Murdoch settings.solid_color_scrollbar_thickness_dip = 3; 286c2db58bd994c04d98e4ee2cd7565b71548655fe3Ben Murdoch } 2872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif 2882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (!compositor->initialize(settings)) 2902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return scoped_ptr<RenderWidgetCompositor>(); 2912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return compositor.Pass(); 2932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 2942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 295ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben MurdochRenderWidgetCompositor::RenderWidgetCompositor(RenderWidget* widget, 296ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch bool threaded) 297ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch : threaded_(threaded), 298ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch suppress_schedule_composite_(false), 299ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch widget_(widget) { 3002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 3012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)RenderWidgetCompositor::~RenderWidgetCompositor() {} 3032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 30490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)const base::WeakPtr<cc::InputHandler>& 30590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)RenderWidgetCompositor::GetInputHandler() { 30690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) return layer_tree_host_->GetInputHandler(); 30790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 30890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 3092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::SetSuppressScheduleComposite(bool suppress) { 3102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (suppress_schedule_composite_ == suppress) 3112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return; 3122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (suppress) 3142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) TRACE_EVENT_ASYNC_BEGIN0("gpu", 3152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) "RenderWidgetCompositor::SetSuppressScheduleComposite", this); 3162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) else 3172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) TRACE_EVENT_ASYNC_END0("gpu", 3182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) "RenderWidgetCompositor::SetSuppressScheduleComposite", this); 3192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) suppress_schedule_composite_ = suppress; 3202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 3212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::Animate(base::TimeTicks time) { 323b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) layer_tree_host_->UpdateClientAnimations(time); 3242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 3252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::Composite(base::TimeTicks frame_begin_time) { 3272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->Composite(frame_begin_time); 3282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 3292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 330c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)void RenderWidgetCompositor::SetNeedsDisplayOnAllLayers() { 331c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) layer_tree_host_->SetNeedsDisplayOnAllLayers(); 332c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)} 333c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 33490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)void RenderWidgetCompositor::SetRasterizeOnlyVisibleContent() { 33590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) cc::LayerTreeDebugState current = layer_tree_host_->debug_state(); 33690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) current.rasterize_only_visible_content = true; 33790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) layer_tree_host_->SetDebugState(current); 33890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)} 33990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 3402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::GetRenderingStats(cc::RenderingStats* stats) { 3412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->CollectRenderingStats(stats); 3422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 3432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 34490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)void RenderWidgetCompositor::UpdateTopControlsState( 34590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) cc::TopControlsState constraints, 34690dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) cc::TopControlsState current, 34790dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) bool animate) { 34890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) layer_tree_host_->UpdateTopControlsState(constraints, 34990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) current, 350c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) animate); 3512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 3522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::SetOverdrawBottomHeight( 3542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) float overdraw_bottom_height) { 3552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->SetOverdrawBottomHeight(overdraw_bottom_height); 3562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 3572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 358c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)void RenderWidgetCompositor::SetNeedsRedrawRect(gfx::Rect damage_rect) { 359c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) layer_tree_host_->SetNeedsRedrawRect(damage_rect); 360c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)} 361c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 362b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)void RenderWidgetCompositor::SetLatencyInfo( 36390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) const ui::LatencyInfo& latency_info) { 364b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) layer_tree_host_->SetLatencyInfo(latency_info); 365b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)} 366b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 367a3f7b4e666c476898878fa745f637129375cd889Ben Murdochint RenderWidgetCompositor::GetLayerTreeId() const { 368a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch return layer_tree_host_->id(); 369a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch} 370a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch 371a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)void RenderWidgetCompositor::NotifyInputThrottledUntilCommit() { 372a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) layer_tree_host_->NotifyInputThrottledUntilCommit(); 373a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)} 374a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) 3753551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)const cc::Layer* RenderWidgetCompositor::GetRootLayer() const { 3763551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) return layer_tree_host_->root_layer(); 3773551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)} 3783551c9c881056c480085172ff9840cab31610854Torne (Richard Coles) 3792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)bool RenderWidgetCompositor::initialize(cc::LayerTreeSettings settings) { 3802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) scoped_refptr<base::MessageLoopProxy> compositor_message_loop_proxy = 3812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) RenderThreadImpl::current()->compositor_message_loop_proxy(); 3822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_ = cc::LayerTreeHost::Create(this, 3832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) settings, 384eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch compositor_message_loop_proxy); 3852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return layer_tree_host_; 3862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 3872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::setSurfaceReady() { 389b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) layer_tree_host_->SetLayerTreeHostClientReady(); 3902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 3912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::setRootLayer(const WebKit::WebLayer& layer) { 3932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->SetRootLayer( 3942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) static_cast<const webkit::WebLayerImpl*>(&layer)->layer()); 3952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 3962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::clearRootLayer() { 3982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); 3992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::setViewportSize( 402c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) const WebSize&, 4032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const WebSize& device_viewport_size) { 404c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) layer_tree_host_->SetViewportSize(device_viewport_size); 4052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)WebSize RenderWidgetCompositor::layoutViewportSize() const { 408c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) return layer_tree_host_->device_viewport_size(); 4092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)WebSize RenderWidgetCompositor::deviceViewportSize() const { 4122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return layer_tree_host_->device_viewport_size(); 4132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)WebFloatPoint RenderWidgetCompositor::adjustEventPointForPinchZoom( 4162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const WebFloatPoint& point) const { 4172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return point; 4182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::setDeviceScaleFactor(float device_scale) { 4212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->SetDeviceScaleFactor(device_scale); 4222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)float RenderWidgetCompositor::deviceScaleFactor() const { 4252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return layer_tree_host_->device_scale_factor(); 4262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::setBackgroundColor(WebKit::WebColor color) { 4292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->set_background_color(color); 4302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::setHasTransparentBackground(bool transparent) { 4332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->set_has_transparent_background(transparent); 4342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::setVisible(bool visible) { 4372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->SetVisible(visible); 4382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::setPageScaleFactorAndLimits( 4412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) float page_scale_factor, float minimum, float maximum) { 4422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->SetPageScaleFactorAndLimits( 4432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) page_scale_factor, minimum, maximum); 4442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::startPageScaleAnimation( 4472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const WebKit::WebPoint& destination, 4482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool use_anchor, 4492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) float new_page_scale, 4502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) double duration_sec) { 4512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) base::TimeDelta duration = base::TimeDelta::FromMicroseconds( 4522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) duration_sec * base::Time::kMicrosecondsPerSecond); 4532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->StartPageScaleAnimation( 4542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) gfx::Vector2d(destination.x, destination.y), 4552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) use_anchor, 4562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) new_page_scale, 4572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) duration); 4582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::setNeedsAnimate() { 4612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->SetNeedsAnimate(); 4622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::setNeedsRedraw() { 4652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (threaded_) 4662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->SetNeedsAnimate(); 4672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) else 4682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) widget_->scheduleAnimation(); 4692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)bool RenderWidgetCompositor::commitRequested() const { 4722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return layer_tree_host_->CommitRequested(); 4732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::didStopFlinging() { 4762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->DidStopFlinging(); 4772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::registerForAnimations(WebKit::WebLayer* layer) { 4802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cc::Layer* cc_layer = static_cast<webkit::WebLayerImpl*>(layer)->layer(); 4812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cc_layer->layer_animation_controller()->SetAnimationRegistrar( 4822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->animation_registrar()); 4832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)bool RenderWidgetCompositor::compositeAndReadback( 4862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void *pixels, const WebRect& rect_in_device_viewport) { 4872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return layer_tree_host_->CompositeAndReadback(pixels, 4882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) rect_in_device_viewport); 4892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::finishAllRendering() { 4922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->FinishAllRendering(); 4932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::setDeferCommits(bool defer_commits) { 4962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->SetDeferCommits(defer_commits); 4972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 4982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 4992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::setShowFPSCounter(bool show) { 5002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cc::LayerTreeDebugState debug_state = layer_tree_host_->debug_state(); 5012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) debug_state.show_fps_counter = show; 5022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->SetDebugState(debug_state); 5032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::setShowPaintRects(bool show) { 5062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cc::LayerTreeDebugState debug_state = layer_tree_host_->debug_state(); 5072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) debug_state.show_paint_rects = show; 5082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->SetDebugState(debug_state); 5092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::setShowDebugBorders(bool show) { 5122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cc::LayerTreeDebugState debug_state = layer_tree_host_->debug_state(); 5132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) debug_state.show_debug_borders = show; 5142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->SetDebugState(debug_state); 5152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::setContinuousPaintingEnabled(bool enabled) { 5182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) cc::LayerTreeDebugState debug_state = layer_tree_host_->debug_state(); 5192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) debug_state.continuous_painting = enabled; 5202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) layer_tree_host_->SetDebugState(debug_state); 5212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5237dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochvoid RenderWidgetCompositor::setShowScrollBottleneckRects(bool show) { 5247dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch cc::LayerTreeDebugState debug_state = layer_tree_host_->debug_state(); 5257dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch debug_state.show_touch_event_handler_rects = show; 5267dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch debug_state.show_wheel_event_handler_rects = show; 5277dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch debug_state.show_non_fast_scrollable_rects = show; 5287dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch layer_tree_host_->SetDebugState(debug_state); 5297dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch} 5307dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 5312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::WillBeginFrame() { 5322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) widget_->InstrumentWillBeginFrame(); 5332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) widget_->willBeginCompositorFrame(); 5342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::DidBeginFrame() { 5372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) widget_->InstrumentDidBeginFrame(); 5382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::Animate(double frame_begin_time) { 5412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) widget_->webwidget()->animate(frame_begin_time); 5422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::Layout() { 5452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) widget_->webwidget()->layout(); 5462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::ApplyScrollAndScale(gfx::Vector2d scroll_delta, 5492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) float page_scale) { 5502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) widget_->webwidget()->applyScrollAndScale(scroll_delta, page_scale); 5512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 553a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)scoped_ptr<cc::OutputSurface> RenderWidgetCompositor::CreateOutputSurface( 554a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) bool fallback) { 555a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles) return widget_->CreateOutputSurface(fallback); 5562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 558b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)void RenderWidgetCompositor::DidInitializeOutputSurface(bool success) { 5592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (!success) 5602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) widget_->webwidget()->didExitCompositingMode(); 5612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::WillCommit() { 5642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) widget_->InstrumentWillComposite(); 5652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::DidCommit() { 5682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) widget_->DidCommitCompositorFrame(); 5692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) widget_->didBecomeReadyForAdditionalInput(); 5702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5722a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::DidCommitAndDrawFrame() { 5732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) widget_->didCommitAndDrawCompositorFrame(); 5742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5752a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::DidCompleteSwapBuffers() { 5772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) widget_->didCompleteSwapBuffers(); 5782a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)void RenderWidgetCompositor::ScheduleComposite() { 5812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) if (!suppress_schedule_composite_) 5822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) widget_->scheduleComposite(); 5832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)scoped_refptr<cc::ContextProvider> 5862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)RenderWidgetCompositor::OffscreenContextProviderForMainThread() { 5872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return RenderThreadImpl::current()->OffscreenContextProviderForMainThread(); 5882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)scoped_refptr<cc::ContextProvider> 5912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)RenderWidgetCompositor::OffscreenContextProviderForCompositorThread() { 5922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) return RenderThreadImpl::current()-> 5932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) OffscreenContextProviderForCompositorThread(); 5942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} 5952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 5962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)} // namespace content 597