diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-13 16:32:21 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-13 16:32:21 +0000 |
commit | 804c89867062a9583fc80424e10d6603baf6a0a6 (patch) | |
tree | 966a15b3c1c7ce7b1af524aacb8906a25133789c | |
parent | 8b89d6e1ad002eecdee1f19094d1aa76371edb4e (diff) | |
download | chromium_src-804c89867062a9583fc80424e10d6603baf6a0a6.zip chromium_src-804c89867062a9583fc80424e10d6603baf6a0a6.tar.gz chromium_src-804c89867062a9583fc80424e10d6603baf6a0a6.tar.bz2 |
cc: Chromify the LayerTreeHost class.
Style-only change. Make the LayerTreeHost class use chromium style.
Depends on: https://codereview.chromium.org/12774006/
TBR=piman
Review URL: https://codereview.chromium.org/12440033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187871 0039d316-1c4b-4281-b951-d872f2087c98
49 files changed, 1730 insertions, 1671 deletions
diff --git a/cc/content_layer.cc b/cc/content_layer.cc index 8c03c9c..1249f96 100644 --- a/cc/content_layer.cc +++ b/cc/content_layer.cc @@ -101,7 +101,7 @@ void ContentLayer::createUpdaterIfNeeded() m_updater = BitmapContentLayerUpdater::create(painter.Pass()); m_updater->setOpaque(contents_opaque()); - unsigned textureFormat = layer_tree_host()->rendererCapabilities().bestTextureFormat; + unsigned textureFormat = layer_tree_host()->GetRendererCapabilities().best_texture_format; setTextureFormat(textureFormat); } diff --git a/cc/delegating_renderer.cc b/cc/delegating_renderer.cc index a6eeb58..9792974 100644 --- a/cc/delegating_renderer.cc +++ b/cc/delegating_renderer.cc @@ -51,14 +51,14 @@ DelegatingRenderer::DelegatingRenderer( } bool DelegatingRenderer::Initialize() { - capabilities_.usingPartialSwap = false; + capabilities_.using_partial_swap = false; // TODO(danakj): Throttling - we may want to only allow 1 outstanding frame, // but the parent compositor may pipeline for us. // TODO(danakj): Can we use this in single-thread mode? - capabilities_.usingSwapCompleteCallback = true; - capabilities_.maxTextureSize = resource_provider_->max_texture_size(); - capabilities_.bestTextureFormat = resource_provider_->best_texture_format(); - capabilities_.allowPartialTextureUpdates = false; + capabilities_.using_swap_complete_callback = true; + capabilities_.max_texture_size = resource_provider_->max_texture_size(); + capabilities_.best_texture_format = resource_provider_->best_texture_format(); + capabilities_.allow_partial_texture_updates = false; WebGraphicsContext3D* context3d = resource_provider_->GraphicsContext3D(); @@ -105,18 +105,18 @@ bool DelegatingRenderer::Initialize() { if (hasIOSurface) DCHECK(hasARBTextureRect); - capabilities_.usingAcceleratedPainting = + capabilities_.using_accelerated_painting = Settings().acceleratePainting && - capabilities_.bestTextureFormat == GL_BGRA_EXT && + capabilities_.best_texture_format == GL_BGRA_EXT && hasReadBGRA; // TODO(piman): loop visibility to GPU process? - capabilities_.usingSetVisibility = hasSetVisibility; + capabilities_.using_set_visibility = hasSetVisibility; // TODO(danakj): Support GpuMemoryManager. - capabilities_.usingGpuMemoryManager = false; + capabilities_.using_gpu_memory_manager = false; - capabilities_.usingEglImage = hasEGLImage; + capabilities_.using_egl_image = hasEGLImage; return true; } diff --git a/cc/delegating_renderer_unittest.cc b/cc/delegating_renderer_unittest.cc index 2084c79..59d633f 100644 --- a/cc/delegating_renderer_unittest.cc +++ b/cc/delegating_renderer_unittest.cc @@ -37,7 +37,7 @@ class DelegatingRendererTest : public ThreadedTest { class DelegatingRendererTestDraw : public DelegatingRendererTest { public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->setPageScaleFactorAndLimits(1.f, 0.5f, 4.f); + m_layerTreeHost->SetPageScaleFactorAndLimits(1.f, 0.5f, 4.f); postSetNeedsCommitToMainThread(); } diff --git a/cc/direct_renderer.cc b/cc/direct_renderer.cc index a807f7a..aebbece 100644 --- a/cc/direct_renderer.cc +++ b/cc/direct_renderer.cc @@ -187,7 +187,7 @@ void DirectRenderer::DrawFrame(RenderPassList& render_passes_in_draw_order) { DrawingFrame frame; frame.root_render_pass = root_render_pass; frame.root_damage_rect = - Capabilities().usingPartialSwap ? + Capabilities().using_partial_swap ? root_render_pass->damage_rect : root_render_pass->output_rect; frame.root_damage_rect.Intersect(gfx::Rect(gfx::Point(), ViewportSize())); @@ -255,7 +255,7 @@ void DirectRenderer::DrawRenderPass(DrawingFrame& frame, if (!UseRenderPass(frame, render_pass)) return; - bool using_scissor_as_optimization = Capabilities().usingPartialSwap; + bool using_scissor_as_optimization = Capabilities().using_partial_swap; gfx::RectF render_pass_scissor; if (using_scissor_as_optimization) { diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc index dcb1758..b5d7ec8 100644 --- a/cc/gl_renderer.cc +++ b/cc/gl_renderer.cc @@ -123,47 +123,47 @@ bool GLRenderer::Initialize() { if (Settings().acceleratePainting && extensions.count("GL_EXT_texture_format_BGRA8888") && extensions.count("GL_EXT_read_format_bgra")) - capabilities_.usingAcceleratedPainting = true; + capabilities_.using_accelerated_painting = true; else - capabilities_.usingAcceleratedPainting = false; + capabilities_.using_accelerated_painting = false; - capabilities_.usingPartialSwap = + capabilities_.using_partial_swap = Settings().partialSwapEnabled && extensions.count("GL_CHROMIUM_post_sub_buffer"); // Use the swapBuffers callback only with the threaded proxy. if (client_->HasImplThread()) - capabilities_.usingSwapCompleteCallback = + capabilities_.using_swap_complete_callback = extensions.count("GL_CHROMIUM_swapbuffers_complete_callback"); - if (capabilities_.usingSwapCompleteCallback) + if (capabilities_.using_swap_complete_callback) context_->setSwapBuffersCompleteCallbackCHROMIUM(this); - capabilities_.usingSetVisibility = + capabilities_.using_set_visibility = extensions.count("GL_CHROMIUM_set_visibility"); if (extensions.count("GL_CHROMIUM_iosurface")) DCHECK(extensions.count("GL_ARB_texture_rectangle")); - capabilities_.usingGpuMemoryManager = + capabilities_.using_gpu_memory_manager = extensions.count("GL_CHROMIUM_gpu_memory_manager") && Settings().useMemoryManagement; - if (capabilities_.usingGpuMemoryManager) + if (capabilities_.using_gpu_memory_manager) context_->setMemoryAllocationChangedCallbackCHROMIUM(this); - capabilities_.usingEglImage = extensions.count("GL_OES_EGL_image_external"); + capabilities_.using_egl_image = extensions.count("GL_OES_EGL_image_external"); - capabilities_.maxTextureSize = resource_provider_->max_texture_size(); - capabilities_.bestTextureFormat = resource_provider_->best_texture_format(); + capabilities_.max_texture_size = resource_provider_->max_texture_size(); + capabilities_.best_texture_format = resource_provider_->best_texture_format(); // The updater can access textures while the GLRenderer is using them. - capabilities_.allowPartialTextureUpdates = true; + capabilities_.allow_partial_texture_updates = true; // Check for texture fast paths. Currently we always use MO8 textures, // so we only need to avoid POT textures if we have an NPOT fast-path. - capabilities_.avoidPow2Textures = + capabilities_.avoid_pow2_textures = extensions.count("GL_CHROMIUM_fast_NPOT_MO8_textures"); - capabilities_.usingOffscreenContext3d = true; + capabilities_.using_offscreen_context3d = true; is_using_bind_uniform_ = extensions.count("GL_CHROMIUM_bind_uniform_location"); @@ -214,7 +214,7 @@ void GLRenderer::SetVisible(bool visible) { // TODO: Replace setVisibilityCHROMIUM with an extension to explicitly manage // front/backbuffers // crbug.com/116049 - if (capabilities_.usingSetVisibility) + if (capabilities_.using_set_visibility) context_->setVisibilityCHROMIUM(visible); } @@ -1182,7 +1182,7 @@ void GLRenderer::DrawStreamVideoQuad(const DrawingFrame& frame, static float gl_matrix[16]; - DCHECK(capabilities_.usingEglImage); + DCHECK(capabilities_.using_egl_image); const VideoStreamTextureProgram* program = GetVideoStreamTextureProgram(); SetUseProgram(program->program()); @@ -1575,7 +1575,7 @@ bool GLRenderer::SwapBuffers() { TRACE_EVENT0("cc", "GLRenderer::swapBuffers"); // We're done! Time to swapbuffers! - if (capabilities_.usingPartialSwap) { + if (capabilities_.using_partial_swap) { // If supported, we can save significant bandwidth by only swapping the // damaged/scissored region (clamped to the viewport) swap_buffer_rect_.Intersect(gfx::Rect(gfx::Point(), ViewportSize())); diff --git a/cc/gl_renderer_unittest.cc b/cc/gl_renderer_unittest.cc index 6313e7d..b844690 100644 --- a/cc/gl_renderer_unittest.cc +++ b/cc/gl_renderer_unittest.cc @@ -669,7 +669,7 @@ TEST(GLRendererTest2, scissorTestWhenClearing) { scoped_ptr<ResourceProvider> resourceProvider(ResourceProvider::Create(outputSurface.get())); FakeRendererGL renderer(&mockClient, outputSurface.get(), resourceProvider.get()); EXPECT_TRUE(renderer.Initialize()); - EXPECT_FALSE(renderer.Capabilities().usingPartialSwap); + EXPECT_FALSE(renderer.Capabilities().using_partial_swap); gfx::Rect viewportRect(mockClient.DeviceViewportSize()); ScopedPtrVector<RenderPass>& renderPasses = mockClient.renderPassesInDrawOrder(); diff --git a/cc/heads_up_display_layer.cc b/cc/heads_up_display_layer.cc index 46e78af..9c9c0ab 100644 --- a/cc/heads_up_display_layer.cc +++ b/cc/heads_up_display_layer.cc @@ -27,11 +27,11 @@ HeadsUpDisplayLayer::~HeadsUpDisplayLayer() void HeadsUpDisplayLayer::Update(ResourceUpdateQueue*, const OcclusionTracker*, RenderingStats*) { - const LayerTreeDebugState& debugState = layer_tree_host()->debugState(); - int maxTextureSize = layer_tree_host()->rendererCapabilities().maxTextureSize; + const LayerTreeDebugState& debugState = layer_tree_host()->debug_state(); + int maxTextureSize = layer_tree_host()->GetRendererCapabilities().max_texture_size; - int deviceViewportInLayoutPixelsWidth = layer_tree_host()->deviceViewportSize().width() / layer_tree_host()->deviceScaleFactor(); - int deviceViewportInLayoutPixelsHeight = layer_tree_host()->deviceViewportSize().height() / layer_tree_host()->deviceScaleFactor(); + int deviceViewportInLayoutPixelsWidth = layer_tree_host()->device_viewport_size().width() / layer_tree_host()->device_scale_factor(); + int deviceViewportInLayoutPixelsHeight = layer_tree_host()->device_viewport_size().height() / layer_tree_host()->device_scale_factor(); gfx::Size bounds; gfx::Transform matrix; diff --git a/cc/heads_up_display_unittest.cc b/cc/heads_up_display_unittest.cc index 6d31ea8..4174871 100644 --- a/cc/heads_up_display_unittest.cc +++ b/cc/heads_up_display_unittest.cc @@ -52,40 +52,40 @@ public: { ++m_numCommits; - ASSERT_TRUE(m_layerTreeHost->hudLayer()); + ASSERT_TRUE(m_layerTreeHost->hud_layer()); switch (m_numCommits) { case 1: // Change directly to a new root layer. - m_layerTreeHost->setRootLayer(m_rootLayer1); + m_layerTreeHost->SetRootLayer(m_rootLayer1); break; case 2: - EXPECT_EQ(m_rootLayer1.get(), m_layerTreeHost->hudLayer()->parent()); + EXPECT_EQ(m_rootLayer1.get(), m_layerTreeHost->hud_layer()->parent()); // Unset the root layer. - m_layerTreeHost->setRootLayer(0); + m_layerTreeHost->SetRootLayer(NULL); break; case 3: - EXPECT_EQ(0, m_layerTreeHost->hudLayer()->parent()); + EXPECT_EQ(0, m_layerTreeHost->hud_layer()->parent()); // Change back to the previous root layer. - m_layerTreeHost->setRootLayer(m_rootLayer1); + m_layerTreeHost->SetRootLayer(m_rootLayer1); break; case 4: - EXPECT_EQ(m_rootLayer1.get(), m_layerTreeHost->hudLayer()->parent()); + EXPECT_EQ(m_rootLayer1.get(), m_layerTreeHost->hud_layer()->parent()); // Unset the root layer. - m_layerTreeHost->setRootLayer(0); + m_layerTreeHost->SetRootLayer(NULL); break; case 5: - EXPECT_EQ(0, m_layerTreeHost->hudLayer()->parent()); + EXPECT_EQ(0, m_layerTreeHost->hud_layer()->parent()); // Change to a new root layer from a null root. - m_layerTreeHost->setRootLayer(m_rootLayer2); + m_layerTreeHost->SetRootLayer(m_rootLayer2); break; case 6: - EXPECT_EQ(m_rootLayer2.get(), m_layerTreeHost->hudLayer()->parent()); + EXPECT_EQ(m_rootLayer2.get(), m_layerTreeHost->hud_layer()->parent()); // Change directly back to the last root layer/ - m_layerTreeHost->setRootLayer(m_rootLayer1); + m_layerTreeHost->SetRootLayer(m_rootLayer1); break; case 7: - EXPECT_EQ(m_rootLayer1.get(), m_layerTreeHost->hudLayer()->parent()); + EXPECT_EQ(m_rootLayer1.get(), m_layerTreeHost->hud_layer()->parent()); endTest(); break; } diff --git a/cc/image_layer.cc b/cc/image_layer.cc index b232828..a9630dd 100644 --- a/cc/image_layer.cc +++ b/cc/image_layer.cc @@ -59,7 +59,7 @@ void ImageLayer::createUpdaterIfNeeded() { updater_ = ImageLayerUpdater::create(); GLenum texture_format = - layer_tree_host()->rendererCapabilities().bestTextureFormat; + layer_tree_host()->GetRendererCapabilities().best_texture_format; setTextureFormat(texture_format); } diff --git a/cc/layer.cc b/cc/layer.cc index bc02803..53ad044 100644 --- a/cc/layer.cc +++ b/cc/layer.cc @@ -98,13 +98,13 @@ void Layer::SetLayerTreeHost(LayerTreeHost* host) { replica_layer_->SetLayerTreeHost(host); layer_animation_controller_->SetAnimationRegistrar( - host ? host->animationRegistrar() : NULL); + host ? host->animation_registrar() : NULL); if (host && layer_animation_controller_->has_any_animation()) - host->setNeedsCommit(); + host->SetNeedsCommit(); if (host && (!filters_.isEmpty() || !background_filters_.isEmpty() || filter_)) - layer_tree_host_->setNeedsFilterContext(); + layer_tree_host_->set_needs_filter_context(); } @@ -112,12 +112,12 @@ void Layer::SetNeedsCommit() { if (ignore_set_needs_commit_) return; if (layer_tree_host_) - layer_tree_host_->setNeedsCommit(); + layer_tree_host_->SetNeedsCommit(); } void Layer::SetNeedsFullTreeSync() { if (layer_tree_host_) - layer_tree_host_->setNeedsFullTreeSync(); + layer_tree_host_->SetNeedsFullTreeSync(); } gfx::Rect Layer::LayerRectToContentRect(const gfx::RectF& layer_rect) const { @@ -363,7 +363,7 @@ void Layer::SetFilters(const WebKit::WebFilterOperations& filters) { filters_ = filters; SetNeedsCommit(); if (!filters.isEmpty() && layer_tree_host_) - layer_tree_host_->setNeedsFilterContext(); + layer_tree_host_->set_needs_filter_context(); } void Layer::SetFilter(const skia::RefPtr<SkImageFilter>& filter) { @@ -373,7 +373,7 @@ void Layer::SetFilter(const skia::RefPtr<SkImageFilter>& filter) { filter_ = filter; SetNeedsCommit(); if (filter && layer_tree_host_) - layer_tree_host_->setNeedsFilterContext(); + layer_tree_host_->set_needs_filter_context(); } void Layer::SetBackgroundFilters(const WebKit::WebFilterOperations& filters) { @@ -382,7 +382,7 @@ void Layer::SetBackgroundFilters(const WebKit::WebFilterOperations& filters) { background_filters_ = filters; SetNeedsCommit(); if (!filters.isEmpty() && layer_tree_host_) - layer_tree_host_->setNeedsFilterContext(); + layer_tree_host_->set_needs_filter_context(); } void Layer::SetOpacity(float opacity) { @@ -519,8 +519,8 @@ void Layer::SetNeedsDisplayRect(const gfx::RectF& dirty_rect) { needs_display_ = true; // Simply mark the contents as dirty. For non-root layers, the call to - // setNeedsCommit will schedule a fresh compositing pass. - // For the root layer, setNeedsCommit has no effect. + // SetNeedsCommit will schedule a fresh compositing pass. + // For the root layer, SetNeedsCommit has no effect. if (DrawsContent() && !update_rect_.IsEmpty()) SetNeedsCommit(); } @@ -539,7 +539,7 @@ void Layer::SetIsContainerForFixedPositionLayers(bool container) { return; is_container_for_fixed_position_layers_ = container; - if (layer_tree_host_ && layer_tree_host_->commitRequested()) + if (layer_tree_host_ && layer_tree_host_->CommitRequested()) return; // Only request a commit if we have a fixed positioned descendant. diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc index eb12ad9..8bee454 100644 --- a/cc/layer_tree_host.cc +++ b/cc/layer_tree_host.cc @@ -32,888 +32,917 @@ #include "cc/tree_synchronizer.h" namespace { -static int numLayerTreeInstances; +static int s_num_layer_tree_instances; } namespace cc { RendererCapabilities::RendererCapabilities() - : bestTextureFormat(0) - , usingPartialSwap(false) - , usingAcceleratedPainting(false) - , usingSetVisibility(false) - , usingSwapCompleteCallback(false) - , usingGpuMemoryManager(false) - , usingEglImage(false) - , allowPartialTextureUpdates(false) - , usingOffscreenContext3d(false) - , maxTextureSize(0) - , avoidPow2Textures(false) -{ -} - -RendererCapabilities::~RendererCapabilities() -{ -} - -bool LayerTreeHost::anyLayerTreeHostInstanceExists() -{ - return numLayerTreeInstances > 0; -} - -scoped_ptr<LayerTreeHost> LayerTreeHost::create(LayerTreeHostClient* client, const LayerTreeSettings& settings, scoped_ptr<Thread> implThread) -{ - scoped_ptr<LayerTreeHost> layerTreeHost(new LayerTreeHost(client, settings)); - if (!layerTreeHost->initialize(implThread.Pass())) - return scoped_ptr<LayerTreeHost>(); - return layerTreeHost.Pass(); -} - -LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings) - : m_animating(false) - , m_needsFullTreeSync(true) - , m_needsFilterContext(false) - , m_client(client) - , m_commitNumber(0) - , m_renderingStats() - , m_rendererInitialized(false) - , m_outputSurfaceLost(false) - , m_numFailedRecreateAttempts(0) - , m_settings(settings) - , m_debugState(settings.initialDebugState) - , m_deviceScaleFactor(1) - , m_visible(true) - , m_pageScaleFactor(1) - , m_minPageScaleFactor(1) - , m_maxPageScaleFactor(1) - , m_triggerIdleUpdates(true) - , m_backgroundColor(SK_ColorWHITE) - , m_hasTransparentBackground(false) - , m_partialTextureUpdateRequests(0) -{ - if (m_settings.acceleratedAnimationEnabled) - m_animationRegistrar = AnimationRegistrar::create(); - numLayerTreeInstances++; -} - -bool LayerTreeHost::initialize(scoped_ptr<Thread> implThread) -{ - if (implThread) - return initializeProxy(ThreadProxy::create(this, implThread.Pass())); - else - return initializeProxy(SingleThreadProxy::Create(this)); -} - -bool LayerTreeHost::initializeForTesting(scoped_ptr<Proxy> proxyForTesting) -{ - return initializeProxy(proxyForTesting.Pass()); -} - -bool LayerTreeHost::initializeProxy(scoped_ptr<Proxy> proxy) -{ - TRACE_EVENT0("cc", "LayerTreeHost::initializeForReal"); + : best_texture_format(0), + using_partial_swap(false), + using_accelerated_painting(false), + using_set_visibility(false), + using_swap_complete_callback(false), + using_gpu_memory_manager(false), + using_egl_image(false), + allow_partial_texture_updates(false), + using_offscreen_context3d(false), + max_texture_size(0), + avoid_pow2_textures(false) {} + +RendererCapabilities::~RendererCapabilities() {} + +bool LayerTreeHost::AnyLayerTreeHostInstanceExists() { + return s_num_layer_tree_instances > 0; +} + +scoped_ptr<LayerTreeHost> LayerTreeHost::Create( + LayerTreeHostClient* client, + const LayerTreeSettings& settings, + scoped_ptr<Thread> impl_thread) { + scoped_ptr<LayerTreeHost> layer_tree_host(new LayerTreeHost(client, + settings)); + if (!layer_tree_host->Initialize(impl_thread.Pass())) + return scoped_ptr<LayerTreeHost>(); + return layer_tree_host.Pass(); +} + +LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, + const LayerTreeSettings& settings) + : animating_(false), + needs_full_tree_sync_(true), + needs_filter_context_(false), + client_(client), + commit_number_(0), + rendering_stats_(), + renderer_initialized_(false), + output_surface_lost_(false), + num_failed_recreate_attempts_(0), + settings_(settings), + debug_state_(settings.initialDebugState), + device_scale_factor_(1.f), + visible_(true), + page_scale_factor_(1.f), + min_page_scale_factor_(1.f), + max_page_scale_factor_(1.f), + trigger_idle_updates_(true), + background_color_(SK_ColorWHITE), + has_transparent_background_(false), + partial_texture_update_requests_(0) { + if (settings_.acceleratedAnimationEnabled) + animation_registrar_ = AnimationRegistrar::create(); + s_num_layer_tree_instances++; +} + +bool LayerTreeHost::Initialize(scoped_ptr<Thread> impl_thread) { + if (impl_thread) + return InitializeProxy(ThreadProxy::create(this, impl_thread.Pass())); + else + return InitializeProxy(SingleThreadProxy::Create(this)); +} + +bool LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) { + return InitializeProxy(proxy_for_testing.Pass()); +} + +bool LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { + TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); + + proxy_ = proxy.Pass(); + proxy_->Start(); + return proxy_->InitializeOutputSurface(); +} + +LayerTreeHost::~LayerTreeHost() { + if (root_layer_) + root_layer_->SetLayerTreeHost(NULL); + DCHECK(proxy_); + DCHECK(proxy_->IsMainThread()); + TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); + proxy_->Stop(); + s_num_layer_tree_instances--; + RateLimiterMap::iterator it = rate_limiters_.begin(); + if (it != rate_limiters_.end()) + it->second->stop(); + + if (root_layer_) { + // The layer tree must be destroyed before the layer tree host. We've + // made a contract with our animation controllers that the registrar + // will outlive them, and we must make good. + root_layer_ = NULL; + } +} + +void LayerTreeHost::SetSurfaceReady() { + proxy_->SetSurfaceReady(); +} + +void LayerTreeHost::InitializeRenderer() { + TRACE_EVENT0("cc", "LayerTreeHost::InitializeRenderer"); + if (!proxy_->InitializeRenderer()) { + // Uh oh, better tell the client that we can't do anything with this output + // surface. + client_->didRecreateOutputSurface(false); + return; + } + + // Update settings_ based on capabilities that we got back from the renderer. + settings_.acceleratePainting = + proxy_->GetRendererCapabilities().using_accelerated_painting; - m_proxy = proxy.Pass(); - m_proxy->Start(); - return m_proxy->InitializeOutputSurface(); -} - -LayerTreeHost::~LayerTreeHost() -{ - if (m_rootLayer) - m_rootLayer->SetLayerTreeHost(0); - DCHECK(m_proxy); - DCHECK(m_proxy->IsMainThread()); - TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); - m_proxy->Stop(); - numLayerTreeInstances--; - RateLimiterMap::iterator it = m_rateLimiters.begin(); - if (it != m_rateLimiters.end()) - it->second->stop(); - - if (m_rootLayer) { - // The layer tree must be destroyed before the layer tree host. We've - // made a contract with our animation controllers that the registrar - // will outlive them, and we must make good. - m_rootLayer = NULL; - } -} + // Update settings_ based on partial update capability. + size_t max_partial_texture_updates = 0; + if (proxy_->GetRendererCapabilities().allow_partial_texture_updates && + !settings_.implSidePainting) { + max_partial_texture_updates = std::min( + settings_.maxPartialTextureUpdates, + proxy_->MaxPartialTextureUpdates()); + } + settings_.maxPartialTextureUpdates = max_partial_texture_updates; + + contents_texture_manager_ = PrioritizedResourceManager::create(proxy_.get()); + surface_memory_placeholder_ = + contents_texture_manager_->createTexture(gfx::Size(), GL_RGBA); + + renderer_initialized_ = true; -void LayerTreeHost::setSurfaceReady() -{ - m_proxy->SetSurfaceReady(); + int max_texture_size = proxy_->GetRendererCapabilities().max_texture_size; + settings_.defaultTileSize = gfx::Size( + std::min(settings_.defaultTileSize.width(), max_texture_size), + std::min(settings_.defaultTileSize.height(), max_texture_size)); + settings_.maxUntiledLayerSize = gfx::Size( + std::min(settings_.maxUntiledLayerSize.width(), max_texture_size), + std::min(settings_.maxUntiledLayerSize.height(), max_texture_size)); } -void LayerTreeHost::initializeRenderer() -{ - TRACE_EVENT0("cc", "LayerTreeHost::initializeRenderer"); - if (!m_proxy->InitializeRenderer()) { - // Uh oh, better tell the client that we can't do anything with this output surface. - m_client->didRecreateOutputSurface(false); - return; - } - - // Update m_settings based on capabilities that we got back from the renderer. - m_settings.acceleratePainting = m_proxy->GetRendererCapabilities().usingAcceleratedPainting; - - // Update m_settings based on partial update capability. - size_t maxPartialTextureUpdates = 0; - if (m_proxy->GetRendererCapabilities().allowPartialTextureUpdates && !m_settings.implSidePainting) - maxPartialTextureUpdates = std::min(m_settings.maxPartialTextureUpdates, m_proxy->MaxPartialTextureUpdates()); - m_settings.maxPartialTextureUpdates = maxPartialTextureUpdates; - - m_contentsTextureManager = PrioritizedResourceManager::create(m_proxy.get()); - m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(gfx::Size(), GL_RGBA); - - m_rendererInitialized = true; +LayerTreeHost::RecreateResult LayerTreeHost::RecreateOutputSurface() { + TRACE_EVENT0("cc", "LayerTreeHost::RecreateOutputSurface"); + DCHECK(output_surface_lost_); - m_settings.defaultTileSize = gfx::Size(std::min(m_settings.defaultTileSize.width(), m_proxy->GetRendererCapabilities().maxTextureSize), - std::min(m_settings.defaultTileSize.height(), m_proxy->GetRendererCapabilities().maxTextureSize)); - m_settings.maxUntiledLayerSize = gfx::Size(std::min(m_settings.maxUntiledLayerSize.width(), m_proxy->GetRendererCapabilities().maxTextureSize), - std::min(m_settings.maxUntiledLayerSize.height(), m_proxy->GetRendererCapabilities().maxTextureSize)); -} + if (proxy_->RecreateOutputSurface()) { + client_->didRecreateOutputSurface(true); + output_surface_lost_ = false; + return RecreateSucceeded; + } -LayerTreeHost::RecreateResult LayerTreeHost::recreateOutputSurface() -{ - TRACE_EVENT0("cc", "LayerTreeHost::recreateOutputSurface"); - DCHECK(m_outputSurfaceLost); + client_->willRetryRecreateOutputSurface(); - if (m_proxy->RecreateOutputSurface()) { - m_client->didRecreateOutputSurface(true); - m_outputSurfaceLost = false; - return RecreateSucceeded; - } + // Tolerate a certain number of recreation failures to work around races + // in the output-surface-lost machinery. + num_failed_recreate_attempts_++; + if (num_failed_recreate_attempts_ < 5) { + // FIXME: The single thread does not self-schedule output surface + // recreation. So force another recreation attempt to happen by requesting + // another commit. + if (!proxy_->HasImplThread()) + SetNeedsCommit(); + return RecreateFailedButTryAgain; + } - m_client->willRetryRecreateOutputSurface(); - - // Tolerate a certain number of recreation failures to work around races - // in the output-surface-lost machinery. - m_numFailedRecreateAttempts++; - if (m_numFailedRecreateAttempts < 5) { - // FIXME: The single thread does not self-schedule output surface - // recreation. So force another recreation attempt to happen by requesting - // another commit. - if (!m_proxy->HasImplThread()) - setNeedsCommit(); - return RecreateFailedButTryAgain; - } - - // We have tried too many times to recreate the output surface. Tell the - // host to fall back to software rendering. - m_client->didRecreateOutputSurface(false); - return RecreateFailedAndGaveUp; + // We have tried too many times to recreate the output surface. Tell the + // host to fall back to software rendering. + client_->didRecreateOutputSurface(false); + return RecreateFailedAndGaveUp; } -void LayerTreeHost::deleteContentsTexturesOnImplThread(ResourceProvider* resourceProvider) -{ - DCHECK(m_proxy->IsImplThread()); - if (m_rendererInitialized) - m_contentsTextureManager->clearAllMemory(resourceProvider); +void LayerTreeHost::DeleteContentsTexturesOnImplThread( + ResourceProvider* resource_provider) { + DCHECK(proxy_->IsImplThread()); + if (renderer_initialized_) + contents_texture_manager_->clearAllMemory(resource_provider); } -void LayerTreeHost::acquireLayerTextures() -{ - DCHECK(m_proxy->IsMainThread()); - m_proxy->AcquireLayerTextures(); +void LayerTreeHost::AcquireLayerTextures() { + DCHECK(proxy_->IsMainThread()); + proxy_->AcquireLayerTextures(); } -void LayerTreeHost::didBeginFrame() -{ - m_client->didBeginFrame(); +void LayerTreeHost::DidBeginFrame() { + client_->didBeginFrame(); } -void LayerTreeHost::updateAnimations(base::TimeTicks frameBeginTime) -{ - m_animating = true; - m_client->animate((frameBeginTime - base::TimeTicks()).InSecondsF()); - animateLayers(frameBeginTime); - m_animating = false; +void LayerTreeHost::UpdateAnimations(base::TimeTicks frame_begin_time) { + animating_ = true; + client_->animate((frame_begin_time - base::TimeTicks()).InSecondsF()); + AnimateLayers(frame_begin_time); + animating_ = false; - m_renderingStats.numAnimationFrames++; + rendering_stats_.numAnimationFrames++; } -void LayerTreeHost::didStopFlinging() -{ - m_proxy->MainThreadHasStoppedFlinging(); +void LayerTreeHost::DidStopFlinging() { + proxy_->MainThreadHasStoppedFlinging(); } -void LayerTreeHost::layout() -{ - m_client->layout(); +void LayerTreeHost::Layout() { + client_->layout(); } -void LayerTreeHost::beginCommitOnImplThread(LayerTreeHostImpl* hostImpl) -{ - DCHECK(m_proxy->IsImplThread()); - TRACE_EVENT0("cc", "LayerTreeHost::commitTo"); +void LayerTreeHost::BeginCommitOnImplThread(LayerTreeHostImpl* host_impl) { + DCHECK(proxy_->IsImplThread()); + TRACE_EVENT0("cc", "LayerTreeHost::CommitTo"); } // This function commits the LayerTreeHost to an impl tree. When modifying // this function, keep in mind that the function *runs* on the impl thread! Any // code that is logically a main thread operation, e.g. deletion of a Layer, -// should be delayed until the LayerTreeHost::commitComplete, which will run +// should be delayed until the LayerTreeHost::CommitComplete, which will run // after the commit, but on the main thread. -void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl) -{ - DCHECK(m_proxy->IsImplThread()); - - // If there are linked evicted backings, these backings' resources may be put into the - // impl tree, so we can't draw yet. Determine this before clearing all evicted backings. - bool newImplTreeHasNoEvictedResources = !m_contentsTextureManager->linkedEvictedBackingsExist(); - - m_contentsTextureManager->updateBackingsInDrawingImplTree(); - - // In impl-side painting, synchronize to the pending tree so that it has - // time to raster before being displayed. If no pending tree is needed, - // synchronization can happen directly to the active tree and - // unlinked contents resources can be reclaimed immediately. - LayerTreeImpl* syncTree; - if (m_settings.implSidePainting) { - // Commits should not occur while there is already a pending tree. - DCHECK(!hostImpl->pendingTree()); - hostImpl->createPendingTree(); - syncTree = hostImpl->pendingTree(); - } else { - m_contentsTextureManager->reduceMemory(hostImpl->resourceProvider()); - syncTree = hostImpl->activeTree(); - } +void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) { + DCHECK(proxy_->IsImplThread()); + + // If there are linked evicted backings, these backings' resources may be put + // into the impl tree, so we can't draw yet. Determine this before clearing + // all evicted backings. + bool new_impl_tree_has_no_evicted_resources = + !contents_texture_manager_->linkedEvictedBackingsExist(); + + contents_texture_manager_->updateBackingsInDrawingImplTree(); + + // In impl-side painting, synchronize to the pending tree so that it has + // time to raster before being displayed. If no pending tree is needed, + // synchronization can happen directly to the active tree and + // unlinked contents resources can be reclaimed immediately. + LayerTreeImpl* sync_tree; + if (settings_.implSidePainting) { + // Commits should not occur while there is already a pending tree. + DCHECK(!host_impl->pendingTree()); + host_impl->createPendingTree(); + sync_tree = host_impl->pendingTree(); + } else { + contents_texture_manager_->reduceMemory(host_impl->resourceProvider()); + sync_tree = host_impl->activeTree(); + } + + if (needs_full_tree_sync_) + sync_tree->SetRootLayer(TreeSynchronizer::synchronizeTrees( + root_layer(), sync_tree->DetachLayerTree(), sync_tree)); { + TRACE_EVENT0("cc", "LayerTreeHost::PushProperties"); + TreeSynchronizer::pushProperties(root_layer(), sync_tree->RootLayer()); + } + + sync_tree->set_needs_full_tree_sync(needs_full_tree_sync_); + needs_full_tree_sync_ = false; + + if (root_layer_ && hud_layer_) { + LayerImpl* hud_impl = LayerTreeHostCommon::findLayerInSubtree( + sync_tree->RootLayer(), hud_layer_->id()); + sync_tree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>(hud_impl)); + } else { + sync_tree->set_hud_layer(NULL); + } + + sync_tree->set_source_frame_number(commit_number()); + sync_tree->set_background_color(background_color_); + sync_tree->set_has_transparent_background(has_transparent_background_); + + sync_tree->FindRootScrollLayer(); + + float page_scale_delta, sent_page_scale_delta; + if (settings_.implSidePainting) { + // Update the delta from the active tree, which may have + // adjusted its delta prior to the pending tree being created. + // This code is equivalent to that in LayerTreeImpl::SetPageScaleDelta. + DCHECK_EQ(1.f, sync_tree->sent_page_scale_delta()); + page_scale_delta = host_impl->activeTree()->page_scale_delta(); + sent_page_scale_delta = host_impl->activeTree()->sent_page_scale_delta(); + } else { + page_scale_delta = sync_tree->page_scale_delta(); + sent_page_scale_delta = sync_tree->sent_page_scale_delta(); + sync_tree->set_sent_page_scale_delta(1.f); + } + + sync_tree->SetPageScaleFactorAndLimits(page_scale_factor_, + min_page_scale_factor_, + max_page_scale_factor_); + sync_tree->SetPageScaleDelta(page_scale_delta / sent_page_scale_delta); - if (m_needsFullTreeSync) - syncTree->SetRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), syncTree->DetachLayerTree(), syncTree)); - { - TRACE_EVENT0("cc", "LayerTreeHost::pushProperties"); - TreeSynchronizer::pushProperties(rootLayer(), syncTree->RootLayer()); - } - - syncTree->set_needs_full_tree_sync(m_needsFullTreeSync); - m_needsFullTreeSync = false; - - if (m_rootLayer && m_hudLayer) - syncTree->set_hud_layer(static_cast<HeadsUpDisplayLayerImpl*>(LayerTreeHostCommon::findLayerInSubtree(syncTree->RootLayer(), m_hudLayer->id()))); - else - syncTree->set_hud_layer(0); - - syncTree->set_source_frame_number(commitNumber()); - syncTree->set_background_color(m_backgroundColor); - syncTree->set_has_transparent_background(m_hasTransparentBackground); - - syncTree->FindRootScrollLayer(); - - float page_scale_delta, sent_page_scale_delta; - if (m_settings.implSidePainting) { - // Update the delta from the active tree, which may have - // adjusted its delta prior to the pending tree being created. - // This code is equivalent to that in LayerTreeImpl::SetPageScaleDelta. - DCHECK_EQ(1, syncTree->sent_page_scale_delta()); - page_scale_delta = hostImpl->activeTree()->page_scale_delta(); - sent_page_scale_delta = hostImpl->activeTree()->sent_page_scale_delta(); - } else { - page_scale_delta = syncTree->page_scale_delta(); - sent_page_scale_delta = syncTree->sent_page_scale_delta(); - syncTree->set_sent_page_scale_delta(1); - } + host_impl->setViewportSize(layout_viewport_size_, device_viewport_size_); + host_impl->setDeviceScaleFactor(device_scale_factor_); + host_impl->setDebugState(debug_state_); - syncTree->SetPageScaleFactorAndLimits(m_pageScaleFactor, m_minPageScaleFactor, m_maxPageScaleFactor); - syncTree->SetPageScaleDelta(page_scale_delta / sent_page_scale_delta); + DCHECK(!sync_tree->ViewportSizeInvalid()); - hostImpl->setViewportSize(layoutViewportSize(), deviceViewportSize()); - hostImpl->setDeviceScaleFactor(deviceScaleFactor()); - hostImpl->setDebugState(m_debugState); + if (new_impl_tree_has_no_evicted_resources) { + if (sync_tree->ContentsTexturesPurged()) + sync_tree->ResetContentsTexturesPurged(); + } - DCHECK(!syncTree->ViewportSizeInvalid()); + if (!settings_.implSidePainting) { + // If we're not in impl-side painting, the tree is immediately + // considered active. + sync_tree->DidBecomeActive(); + } - if (newImplTreeHasNoEvictedResources) { - if (syncTree->ContentsTexturesPurged()) - syncTree->ResetContentsTexturesPurged(); - } - - if (!m_settings.implSidePainting) { - // If we're not in impl-side painting, the tree is immediately - // considered active. - syncTree->DidBecomeActive(); - } + if (debug_state_.continuousPainting) + host_impl->savePaintTime(rendering_stats_.totalPaintTime, commit_number()); - if (m_debugState.continuousPainting) - hostImpl->savePaintTime(m_renderingStats.totalPaintTime, commitNumber()); - - m_commitNumber++; + commit_number_++; } -void LayerTreeHost::willCommit() -{ - m_client->willCommit(); +void LayerTreeHost::WillCommit() { + client_->willCommit(); } -void LayerTreeHost::updateHudLayer() -{ - if (m_debugState.showHudInfo()) { - if (!m_hudLayer) - m_hudLayer = HeadsUpDisplayLayer::Create(); +void LayerTreeHost::UpdateHudLayer() { + if (debug_state_.showHudInfo()) { + if (!hud_layer_) + hud_layer_ = HeadsUpDisplayLayer::Create(); - if (m_rootLayer && !m_hudLayer->parent()) - m_rootLayer->AddChild(m_hudLayer); - } else if (m_hudLayer) { - m_hudLayer->RemoveFromParent(); - m_hudLayer = 0; - } + if (root_layer_ && !hud_layer_->parent()) + root_layer_->AddChild(hud_layer_); + } else if (hud_layer_) { + hud_layer_->RemoveFromParent(); + hud_layer_ = NULL; + } } -void LayerTreeHost::commitComplete() -{ - m_client->didCommit(); +void LayerTreeHost::CommitComplete() { + client_->didCommit(); } -scoped_ptr<OutputSurface> LayerTreeHost::createOutputSurface() -{ - return m_client->createOutputSurface(); +scoped_ptr<OutputSurface> LayerTreeHost::CreateOutputSurface() { + return client_->createOutputSurface(); } -scoped_ptr<InputHandler> LayerTreeHost::createInputHandler() -{ - return m_client->createInputHandler(); +scoped_ptr<InputHandler> LayerTreeHost::CreateInputHandler() { + return client_->createInputHandler(); } -scoped_ptr<LayerTreeHostImpl> LayerTreeHost::createLayerTreeHostImpl(LayerTreeHostImplClient* client) -{ - DCHECK(m_proxy->IsImplThread()); - scoped_ptr<LayerTreeHostImpl> hostImpl(LayerTreeHostImpl::create(m_settings, client, m_proxy.get())); - if (m_settings.calculateTopControlsPosition && hostImpl->topControlsManager()) - m_topControlsManagerWeakPtr = hostImpl->topControlsManager()->AsWeakPtr(); - return hostImpl.Pass(); +scoped_ptr<LayerTreeHostImpl> LayerTreeHost::CreateLayerTreeHostImpl( + LayerTreeHostImplClient* client) { + DCHECK(proxy_->IsImplThread()); + scoped_ptr<LayerTreeHostImpl> host_impl = + LayerTreeHostImpl::create(settings_, client, proxy_.get()); + if (settings_.calculateTopControlsPosition && + host_impl->topControlsManager()) { + top_controls_manager_weak_ptr_ = + host_impl->topControlsManager()->AsWeakPtr(); + } + return host_impl.Pass(); } -void LayerTreeHost::didLoseOutputSurface() -{ - TRACE_EVENT0("cc", "LayerTreeHost::didLoseOutputSurface"); - DCHECK(m_proxy->IsMainThread()); - m_outputSurfaceLost = true; - m_numFailedRecreateAttempts = 0; - setNeedsCommit(); +void LayerTreeHost::DidLoseOutputSurface() { + TRACE_EVENT0("cc", "LayerTreeHost::DidLoseOutputSurface"); + DCHECK(proxy_->IsMainThread()); + output_surface_lost_ = true; + num_failed_recreate_attempts_ = 0; + SetNeedsCommit(); } -bool LayerTreeHost::compositeAndReadback(void *pixels, const gfx::Rect& rect) -{ - m_triggerIdleUpdates = false; - bool ret = m_proxy->CompositeAndReadback(pixels, rect); - m_triggerIdleUpdates = true; - return ret; +bool LayerTreeHost::CompositeAndReadback(void* pixels, + gfx::Rect rect_in_device_viewport) { + trigger_idle_updates_ = false; + bool ret = proxy_->CompositeAndReadback(pixels, rect_in_device_viewport); + trigger_idle_updates_ = true; + return ret; } -void LayerTreeHost::finishAllRendering() -{ - if (!m_rendererInitialized) - return; - m_proxy->FinishAllRendering(); +void LayerTreeHost::FinishAllRendering() { + if (!renderer_initialized_) + return; + proxy_->FinishAllRendering(); } -void LayerTreeHost::setDeferCommits(bool deferCommits) -{ - m_proxy->SetDeferCommits(deferCommits); +void LayerTreeHost::SetDeferCommits(bool defer_commits) { + proxy_->SetDeferCommits(defer_commits); } -void LayerTreeHost::didDeferCommit() -{ -} +void LayerTreeHost::DidDeferCommit() {} -void LayerTreeHost::renderingStats(RenderingStats* stats) const -{ - CHECK(m_debugState.recordRenderingStats()); - *stats = m_renderingStats; - m_proxy->GetRenderingStats(stats); +void LayerTreeHost::CollectRenderingStats(RenderingStats* stats) const { + CHECK(debug_state_.recordRenderingStats()); + *stats = rendering_stats_; + proxy_->CollectRenderingStats(stats); } -const RendererCapabilities& LayerTreeHost::rendererCapabilities() const -{ - return m_proxy->GetRendererCapabilities(); +const RendererCapabilities& LayerTreeHost::GetRendererCapabilities() const { + return proxy_->GetRendererCapabilities(); } -void LayerTreeHost::setNeedsAnimate() -{ - DCHECK(m_proxy->HasImplThread()); - m_proxy->SetNeedsAnimate(); +void LayerTreeHost::SetNeedsAnimate() { + DCHECK(proxy_->HasImplThread()); + proxy_->SetNeedsAnimate(); } -void LayerTreeHost::setNeedsCommit() -{ - if (!m_prepaintCallback.IsCancelled()) { - TRACE_EVENT_INSTANT0("cc", "LayerTreeHost::setNeedsCommit::cancel prepaint"); - m_prepaintCallback.Cancel(); - } - m_proxy->SetNeedsCommit(); +void LayerTreeHost::SetNeedsCommit() { + if (!prepaint_callback_.IsCancelled()) { + TRACE_EVENT_INSTANT0("cc", + "LayerTreeHost::SetNeedsCommit::cancel prepaint"); + prepaint_callback_.Cancel(); + } + proxy_->SetNeedsCommit(); } -void LayerTreeHost::setNeedsFullTreeSync() -{ - m_needsFullTreeSync = true; - setNeedsCommit(); +void LayerTreeHost::SetNeedsFullTreeSync() { + needs_full_tree_sync_ = true; + SetNeedsCommit(); } -void LayerTreeHost::setNeedsRedraw() -{ - m_proxy->SetNeedsRedraw(); - if (!m_proxy->ImplThread()) - m_client->scheduleComposite(); +void LayerTreeHost::SetNeedsRedraw() { + proxy_->SetNeedsRedraw(); + if (!proxy_->ImplThread()) + client_->scheduleComposite(); } -bool LayerTreeHost::commitRequested() const -{ - return m_proxy->CommitRequested(); +bool LayerTreeHost::CommitRequested() const { + return proxy_->CommitRequested(); } -void LayerTreeHost::setAnimationEvents(scoped_ptr<AnimationEventsVector> events, base::Time wallClockTime) -{ - DCHECK(m_proxy->IsMainThread()); - setAnimationEventsRecursive(*events.get(), m_rootLayer.get(), wallClockTime); +void LayerTreeHost::SetAnimationEvents(scoped_ptr<AnimationEventsVector> events, + base::Time wall_clock_time) { + DCHECK(proxy_->IsMainThread()); + SetAnimationEventsRecursive(*events, + root_layer_.get(), + wall_clock_time); } -void LayerTreeHost::setRootLayer(scoped_refptr<Layer> rootLayer) -{ - if (m_rootLayer == rootLayer) - return; +void LayerTreeHost::SetRootLayer(scoped_refptr<Layer> root_layer) { + if (root_layer_ == root_layer) + return; - if (m_rootLayer) - m_rootLayer->SetLayerTreeHost(0); - m_rootLayer = rootLayer; - if (m_rootLayer) - m_rootLayer->SetLayerTreeHost(this); + if (root_layer_) + root_layer_->SetLayerTreeHost(NULL); + root_layer_ = root_layer; + if (root_layer_) + root_layer_->SetLayerTreeHost(this); - if (m_hudLayer) - m_hudLayer->RemoveFromParent(); + if (hud_layer_) + hud_layer_->RemoveFromParent(); - setNeedsFullTreeSync(); + SetNeedsFullTreeSync(); } -void LayerTreeHost::setDebugState(const LayerTreeDebugState& debugState) -{ - LayerTreeDebugState newDebugState = LayerTreeDebugState::unite(m_settings.initialDebugState, debugState); +void LayerTreeHost::SetDebugState(const LayerTreeDebugState& debug_state) { + LayerTreeDebugState new_debug_state = + LayerTreeDebugState::unite(settings_.initialDebugState, debug_state); - if (LayerTreeDebugState::equal(m_debugState, newDebugState)) - return; + if (LayerTreeDebugState::equal(debug_state_, new_debug_state)) + return; - m_debugState = newDebugState; - setNeedsCommit(); + debug_state_ = new_debug_state; + SetNeedsCommit(); } -void LayerTreeHost::setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize) -{ - if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_deviceViewportSize) - return; +void LayerTreeHost::SetViewportSize(gfx::Size layout_viewport_size, + gfx::Size device_viewport_size) { + if (layout_viewport_size == layout_viewport_size_ && + device_viewport_size == device_viewport_size_) + return; - m_layoutViewportSize = layoutViewportSize; - m_deviceViewportSize = deviceViewportSize; + layout_viewport_size_ = layout_viewport_size; + device_viewport_size_ = device_viewport_size; - setNeedsCommit(); + SetNeedsCommit(); } -void LayerTreeHost::setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor) -{ - if (pageScaleFactor == m_pageScaleFactor && minPageScaleFactor == m_minPageScaleFactor && maxPageScaleFactor == m_maxPageScaleFactor) - return; +void LayerTreeHost::SetPageScaleFactorAndLimits(float page_scale_factor, + float min_page_scale_factor, + float max_page_scale_factor) { + if (page_scale_factor == page_scale_factor_ && + min_page_scale_factor == min_page_scale_factor_ && + max_page_scale_factor == max_page_scale_factor_) + return; - m_pageScaleFactor = pageScaleFactor; - m_minPageScaleFactor = minPageScaleFactor; - m_maxPageScaleFactor = maxPageScaleFactor; - setNeedsCommit(); + page_scale_factor_ = page_scale_factor; + min_page_scale_factor_ = min_page_scale_factor; + max_page_scale_factor_ = max_page_scale_factor; + SetNeedsCommit(); } -void LayerTreeHost::setVisible(bool visible) -{ - if (m_visible == visible) - return; - m_visible = visible; - m_proxy->SetVisible(visible); +void LayerTreeHost::SetVisible(bool visible) { + if (visible_ == visible) + return; + visible_ = visible; + proxy_->SetVisible(visible); } -void LayerTreeHost::startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, float scale, base::TimeDelta duration) -{ - m_proxy->StartPageScaleAnimation(targetOffset, useAnchor, scale, duration); +void LayerTreeHost::StartPageScaleAnimation(gfx::Vector2d target_offset, + bool use_anchor, + float scale, + base::TimeDelta duration) { + proxy_->StartPageScaleAnimation(target_offset, use_anchor, scale, duration); } -PrioritizedResourceManager* LayerTreeHost::contentsTextureManager() const -{ - return m_contentsTextureManager.get(); -} - -void LayerTreeHost::composite() -{ - if (!m_proxy->HasImplThread()) - static_cast<SingleThreadProxy*>(m_proxy.get())->CompositeImmediately(); - else - setNeedsCommit(); +void LayerTreeHost::Composite() { + if (!proxy_->HasImplThread()) + static_cast<SingleThreadProxy*>(proxy_.get())->CompositeImmediately(); + else + SetNeedsCommit(); } -void LayerTreeHost::scheduleComposite() -{ - m_client->scheduleComposite(); +void LayerTreeHost::ScheduleComposite() { + client_->scheduleComposite(); } -bool LayerTreeHost::initializeRendererIfNeeded() -{ - if (!m_rendererInitialized) { - initializeRenderer(); - // If we couldn't initialize, then bail since we're returning to software mode. - if (!m_rendererInitialized) - return false; - } - if (m_outputSurfaceLost) { - if (recreateOutputSurface() != RecreateSucceeded) - return false; - } - return true; +bool LayerTreeHost::InitializeRendererIfNeeded() { + if (!renderer_initialized_) { + InitializeRenderer(); + // If we couldn't initialize, then bail since we're returning to software + // mode. + if (!renderer_initialized_) + return false; + } + if (output_surface_lost_) { + if (RecreateOutputSurface() != RecreateSucceeded) + return false; + } + return true; } -void LayerTreeHost::updateLayers(ResourceUpdateQueue& queue, size_t memoryAllocationLimitBytes) -{ - DCHECK(m_rendererInitialized); +void LayerTreeHost::UpdateLayers(ResourceUpdateQueue* queue, + size_t memory_allocation_limit_bytes) { + DCHECK(renderer_initialized_); - if (!rootLayer()) - return; + if (!root_layer()) + return; - if (layoutViewportSize().IsEmpty()) - return; + if (layout_viewport_size().IsEmpty()) + return; - if (memoryAllocationLimitBytes) - m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBytes); + if (memory_allocation_limit_bytes) { + contents_texture_manager_->setMaxMemoryLimitBytes( + memory_allocation_limit_bytes); + } - updateLayers(rootLayer(), queue); + UpdateLayers(root_layer(), queue); } -static Layer* findFirstScrollableLayer(Layer* layer) -{ - if (!layer) - return 0; +static Layer* FindFirstScrollableLayer(Layer* layer) { + if (!layer) + return NULL; - if (layer->scrollable()) - return layer; - - for (size_t i = 0; i < layer->children().size(); ++i) { - Layer* found = findFirstScrollableLayer(layer->children()[i].get()); - if (found) - return found; + if (layer->scrollable()) + return layer; + + for (size_t i = 0; i < layer->children().size(); ++i) { + Layer* found = FindFirstScrollableLayer(layer->children()[i].get()); + if (found) + return found; + } + + return NULL; +} + +void LayerTreeHost::UpdateLayers(Layer* root_layer, + ResourceUpdateQueue* queue) { + TRACE_EVENT0("cc", "LayerTreeHost::UpdateLayers"); + + LayerList update_list; { + Layer* root_scroll = FindFirstScrollableLayer(root_layer); + if (root_scroll) + root_scroll->SetImplTransform(impl_transform_); + + UpdateHudLayer(); + + TRACE_EVENT0("cc", "LayerTreeHost::UpdateLayers::calcDrawProps"); + LayerTreeHostCommon::calculateDrawProperties( + root_layer, + device_viewport_size(), + device_scale_factor_, + page_scale_factor_, + GetRendererCapabilities().max_texture_size, + settings_.canUseLCDText, + update_list); + } + + // Reset partial texture update requests. + partial_texture_update_requests_ = 0; + + bool need_more_updates = PaintLayerContents(update_list, queue); + if (trigger_idle_updates_ && need_more_updates) { + TRACE_EVENT0("cc", "LayerTreeHost::UpdateLayers::posting prepaint task"); + prepaint_callback_.Reset(base::Bind(&LayerTreeHost::TriggerPrepaint, + base::Unretained(this))); + static base::TimeDelta prepaint_delay = + base::TimeDelta::FromMilliseconds(100); + MessageLoop::current()->PostDelayedTask(FROM_HERE, + prepaint_callback_.callback(), + prepaint_delay); + } + + for (size_t i = 0; i < update_list.size(); ++i) + update_list[i]->ClearRenderSurface(); +} + +void LayerTreeHost::TriggerPrepaint() { + prepaint_callback_.Cancel(); + TRACE_EVENT0("cc", "LayerTreeHost::TriggerPrepaint"); + SetNeedsCommit(); +} + +void LayerTreeHost::SetPrioritiesForSurfaces(size_t surface_memory_bytes) { + // Surfaces have a place holder for their memory since they are managed + // independantly but should still be tracked and reduce other memory usage. + surface_memory_placeholder_->setTextureManager( + contents_texture_manager_.get()); + surface_memory_placeholder_->setRequestPriority( + PriorityCalculator::renderSurfacePriority()); + surface_memory_placeholder_->setToSelfManagedMemoryPlaceholder( + surface_memory_bytes); +} + +void LayerTreeHost::SetPrioritiesForLayers(const LayerList& update_list) { + // Use BackToFront since it's cheap and this isn't order-dependent. + typedef LayerIterator<Layer, + LayerList, + RenderSurface, + LayerIteratorActions::BackToFront> LayerIteratorType; + + PriorityCalculator calculator; + LayerIteratorType end = LayerIteratorType::end(&update_list); + for (LayerIteratorType it = LayerIteratorType::begin(&update_list); + it != end; + ++it) { + if (it.representsItself()) { + it->SetTexturePriorities(calculator); + } else if (it.representsTargetRenderSurface()) { + if (it->mask_layer()) + it->mask_layer()->SetTexturePriorities(calculator); + if (it->replica_layer() && it->replica_layer()->mask_layer()) + it->replica_layer()->mask_layer()->SetTexturePriorities(calculator); } - - return 0; + } } -void LayerTreeHost::updateLayers(Layer* rootLayer, ResourceUpdateQueue& queue) -{ - TRACE_EVENT0("cc", "LayerTreeHost::updateLayers"); +void LayerTreeHost::PrioritizeTextures( + const LayerList& render_surface_layer_list, OverdrawMetrics* metrics) { + contents_texture_manager_->clearPriorities(); - LayerList updateList; + size_t memory_for_render_surfaces_metric = + CalculateMemoryForRenderSurfaces(render_surface_layer_list); - { - Layer* rootScroll = findFirstScrollableLayer(rootLayer); - if (rootScroll) - rootScroll->SetImplTransform(m_implTransform); + SetPrioritiesForLayers(render_surface_layer_list); + SetPrioritiesForSurfaces(memory_for_render_surfaces_metric); - updateHudLayer(); + metrics->DidUseContentsTextureMemoryBytes( + contents_texture_manager_->memoryAboveCutoffBytes()); + metrics->DidUseRenderSurfaceTextureMemoryBytes( + memory_for_render_surfaces_metric); - TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::calcDrawEtc"); - LayerTreeHostCommon::calculateDrawProperties(rootLayer, deviceViewportSize(), m_deviceScaleFactor, m_pageScaleFactor, rendererCapabilities().maxTextureSize, m_settings.canUseLCDText, updateList); - } - - // Reset partial texture update requests. - m_partialTextureUpdateRequests = 0; - - bool needMoreUpdates = paintLayerContents(updateList, queue); - if (m_triggerIdleUpdates && needMoreUpdates) { - TRACE_EVENT0("cc", "LayerTreeHost::updateLayers::posting prepaint task"); - m_prepaintCallback.Reset(base::Bind(&LayerTreeHost::triggerPrepaint, base::Unretained(this))); - static base::TimeDelta prepaintDelay = base::TimeDelta::FromMilliseconds(100); - MessageLoop::current()->PostDelayedTask(FROM_HERE, m_prepaintCallback.callback(), prepaintDelay); - } - - for (size_t i = 0; i < updateList.size(); ++i) - updateList[i]->ClearRenderSurface(); -} - -void LayerTreeHost::triggerPrepaint() -{ - m_prepaintCallback.Cancel(); - TRACE_EVENT0("cc", "LayerTreeHost::triggerPrepaint"); - setNeedsCommit(); -} - -void LayerTreeHost::setPrioritiesForSurfaces(size_t surfaceMemoryBytes) -{ - // Surfaces have a place holder for their memory since they are managed - // independantly but should still be tracked and reduce other memory usage. - m_surfaceMemoryPlaceholder->setTextureManager(m_contentsTextureManager.get()); - m_surfaceMemoryPlaceholder->setRequestPriority(PriorityCalculator::renderSurfacePriority()); - m_surfaceMemoryPlaceholder->setToSelfManagedMemoryPlaceholder(surfaceMemoryBytes); -} - -void LayerTreeHost::setPrioritiesForLayers(const LayerList& updateList) -{ - // Use BackToFront since it's cheap and this isn't order-dependent. - typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions::BackToFront> LayerIteratorType; - - PriorityCalculator calculator; - LayerIteratorType end = LayerIteratorType::end(&updateList); - for (LayerIteratorType it = LayerIteratorType::begin(&updateList); it != end; ++it) { - if (it.representsItself()) - it->SetTexturePriorities(calculator); - else if (it.representsTargetRenderSurface()) { - if (it->mask_layer()) - it->mask_layer()->SetTexturePriorities(calculator); - if (it->replica_layer() && it->replica_layer()->mask_layer()) - it->replica_layer()->mask_layer()->SetTexturePriorities(calculator); - } - } -} - -void LayerTreeHost::prioritizeTextures(const LayerList& renderSurfaceLayerList, OverdrawMetrics& metrics) -{ - m_contentsTextureManager->clearPriorities(); - - size_t memoryForRenderSurfacesMetric = calculateMemoryForRenderSurfaces(renderSurfaceLayerList); - - setPrioritiesForLayers(renderSurfaceLayerList); - setPrioritiesForSurfaces(memoryForRenderSurfacesMetric); - - metrics.DidUseContentsTextureMemoryBytes(m_contentsTextureManager->memoryAboveCutoffBytes()); - metrics.DidUseRenderSurfaceTextureMemoryBytes(memoryForRenderSurfacesMetric); - - m_contentsTextureManager->prioritizeTextures(); + contents_texture_manager_->prioritizeTextures(); } -size_t LayerTreeHost::calculateMemoryForRenderSurfaces(const LayerList& updateList) -{ - size_t readbackBytes = 0; - size_t maxBackgroundTextureBytes = 0; - size_t contentsTextureBytes = 0; - - // Start iteration at 1 to skip the root surface as it does not have a texture cost. - for (size_t i = 1; i < updateList.size(); ++i) { - Layer* renderSurfaceLayer = updateList[i].get(); - RenderSurface* renderSurface = renderSurfaceLayer->render_surface(); - - size_t bytes = Resource::MemorySizeBytes(renderSurface->content_rect().size(), GL_RGBA); - contentsTextureBytes += bytes; - - if (renderSurfaceLayer->background_filters().isEmpty()) - continue; +size_t LayerTreeHost::CalculateMemoryForRenderSurfaces( + const LayerList& update_list) { + size_t readback_bytes = 0; + size_t max_background_texture_bytes = 0; + size_t contents_texture_bytes = 0; - if (bytes > maxBackgroundTextureBytes) - maxBackgroundTextureBytes = bytes; - if (!readbackBytes) - readbackBytes = Resource::MemorySizeBytes(m_deviceViewportSize, GL_RGBA); - } - return readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes; -} + // Start iteration at 1 to skip the root surface as it does not have a texture + // cost. + for (size_t i = 1; i < update_list.size(); ++i) { + Layer* render_surface_layer = update_list[i].get(); + RenderSurface* render_surface = render_surface_layer->render_surface(); -bool LayerTreeHost::paintMasksForRenderSurface(Layer* renderSurfaceLayer, ResourceUpdateQueue& queue) -{ - // Note: Masks and replicas only exist for layers that own render surfaces. If we reach this point - // in code, we already know that at least something will be drawn into this render surface, so the - // mask and replica should be painted. + size_t bytes = + Resource::MemorySizeBytes(render_surface->content_rect().size(), + GL_RGBA); + contents_texture_bytes += bytes; - RenderingStats* stats = m_debugState.recordRenderingStats() ? &m_renderingStats : NULL; + if (render_surface_layer->background_filters().isEmpty()) + continue; - bool needMoreUpdates = false; - Layer* maskLayer = renderSurfaceLayer->mask_layer(); - if (maskLayer) { - maskLayer->Update(&queue, 0, stats); - needMoreUpdates |= maskLayer->NeedMoreUpdates(); + if (bytes > max_background_texture_bytes) + max_background_texture_bytes = bytes; + if (!readback_bytes) { + readback_bytes = Resource::MemorySizeBytes(device_viewport_size_, + GL_RGBA); } - - Layer* replicaMaskLayer = renderSurfaceLayer->replica_layer() ? renderSurfaceLayer->replica_layer()->mask_layer() : 0; - if (replicaMaskLayer) { - replicaMaskLayer->Update(&queue, 0, stats); - needMoreUpdates |= replicaMaskLayer->NeedMoreUpdates(); + } + return readback_bytes + max_background_texture_bytes + contents_texture_bytes; +} + +bool LayerTreeHost::PaintMasksForRenderSurface(Layer* render_surface_layer, + ResourceUpdateQueue* queue) { + // Note: Masks and replicas only exist for layers that own render surfaces. If + // we reach this point in code, we already know that at least something will + // be drawn into this render surface, so the mask and replica should be + // painted. + + RenderingStats* stats = + debug_state_.recordRenderingStats() ? &rendering_stats_ : NULL; + + bool need_more_updates = false; + Layer* mask_layer = render_surface_layer->mask_layer(); + if (mask_layer) { + mask_layer->Update(queue, NULL, stats); + need_more_updates |= mask_layer->NeedMoreUpdates(); + } + + Layer* replica_mask_layer = + render_surface_layer->replica_layer() ? + render_surface_layer->replica_layer()->mask_layer() : NULL; + if (replica_mask_layer) { + replica_mask_layer->Update(queue, NULL, stats); + need_more_updates |= replica_mask_layer->NeedMoreUpdates(); + } + return need_more_updates; +} + +bool LayerTreeHost::PaintLayerContents( + const LayerList& render_surface_layer_list, ResourceUpdateQueue* queue) { + // Use FrontToBack to allow for testing occlusion and performing culling + // during the tree walk. + typedef LayerIterator<Layer, + LayerList, + RenderSurface, + LayerIteratorActions::FrontToBack> LayerIteratorType; + + bool need_more_updates = false; + bool record_metrics_for_frame = + settings_.showOverdrawInTracing && + base::debug::TraceLog::GetInstance() && + base::debug::TraceLog::GetInstance()->IsEnabled(); + OcclusionTracker occlusion_tracker( + root_layer_->render_surface()->content_rect(), record_metrics_for_frame); + occlusion_tracker.set_minimum_tracking_size( + settings_.minimumOcclusionTrackingSize); + + PrioritizeTextures(render_surface_layer_list, + occlusion_tracker.overdraw_metrics()); + + RenderingStats* stats = debug_state_.recordRenderingStats() ? + &rendering_stats_ : NULL; + + LayerIteratorType end = LayerIteratorType::end(&render_surface_layer_list); + for (LayerIteratorType it = + LayerIteratorType::begin(&render_surface_layer_list); + it != end; + ++it) { + occlusion_tracker.EnterLayer(it); + + if (it.representsTargetRenderSurface()) { + DCHECK(it->render_surface()->draw_opacity() || + it->render_surface()->draw_opacity_is_animating()); + need_more_updates |= PaintMasksForRenderSurface(*it, queue); + } else if (it.representsItself()) { + DCHECK(!it->bounds().IsEmpty()); + it->Update(queue, &occlusion_tracker, stats); + need_more_updates |= it->NeedMoreUpdates(); } - return needMoreUpdates; -} - -bool LayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList, ResourceUpdateQueue& queue) -{ - // Use FrontToBack to allow for testing occlusion and performing culling during the tree walk. - typedef LayerIterator<Layer, LayerList, RenderSurface, LayerIteratorActions::FrontToBack> LayerIteratorType; - bool needMoreUpdates = false; - bool recordMetricsForFrame = m_settings.showOverdrawInTracing && base::debug::TraceLog::GetInstance() && base::debug::TraceLog::GetInstance()->IsEnabled(); - OcclusionTracker occlusionTracker(m_rootLayer->render_surface()->content_rect(), recordMetricsForFrame); - occlusionTracker.set_minimum_tracking_size(m_settings.minimumOcclusionTrackingSize); + occlusion_tracker.LeaveLayer(it); + } - prioritizeTextures(renderSurfaceLayerList, occlusionTracker.OverdrawMetrics()); + occlusion_tracker.overdraw_metrics()->RecordMetrics(this); - RenderingStats* stats = m_debugState.recordRenderingStats() ? &m_renderingStats : NULL; - - LayerIteratorType end = LayerIteratorType::end(&renderSurfaceLayerList); - for (LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) { - occlusionTracker.EnterLayer(it); - - if (it.representsTargetRenderSurface()) { - DCHECK(it->render_surface()->draw_opacity() || it->render_surface()->draw_opacity_is_animating()); - needMoreUpdates |= paintMasksForRenderSurface(*it, queue); - } else if (it.representsItself()) { - DCHECK(!it->bounds().IsEmpty()); - it->Update(&queue, &occlusionTracker, stats); - needMoreUpdates |= it->NeedMoreUpdates(); - } - - occlusionTracker.LeaveLayer(it); - } - - occlusionTracker.OverdrawMetrics().RecordMetrics(this); - - return needMoreUpdates; + return need_more_updates; } -void LayerTreeHost::applyScrollAndScale(const ScrollAndScaleSet& info) -{ - if (!m_rootLayer) - return; +void LayerTreeHost::ApplyScrollAndScale(const ScrollAndScaleSet& info) { + if (!root_layer_) + return; - Layer* rootScrollLayer = findFirstScrollableLayer(m_rootLayer.get()); - gfx::Vector2d rootScrollDelta; + Layer* root_scroll_layer = FindFirstScrollableLayer(root_layer_.get()); + gfx::Vector2d root_scroll_delta; - for (size_t i = 0; i < info.scrolls.size(); ++i) { - Layer* layer = LayerTreeHostCommon::findLayerInSubtree(m_rootLayer.get(), info.scrolls[i].layerId); - if (!layer) - continue; - if (layer == rootScrollLayer) - rootScrollDelta += info.scrolls[i].scrollDelta; - else - layer->SetScrollOffset(layer->scroll_offset() + info.scrolls[i].scrollDelta); - } - if (!rootScrollDelta.IsZero() || info.pageScaleDelta != 1) - m_client->applyScrollAndScale(rootScrollDelta, info.pageScaleDelta); + for (size_t i = 0; i < info.scrolls.size(); ++i) { + Layer* layer = + LayerTreeHostCommon::findLayerInSubtree(root_layer_.get(), + info.scrolls[i].layerId); + if (!layer) + continue; + if (layer == root_scroll_layer) + root_scroll_delta += info.scrolls[i].scrollDelta; + else + layer->SetScrollOffset(layer->scroll_offset() + + info.scrolls[i].scrollDelta); + } + if (!root_scroll_delta.IsZero() || info.pageScaleDelta != 1.f) + client_->applyScrollAndScale(root_scroll_delta, info.pageScaleDelta); } -void LayerTreeHost::setImplTransform(const gfx::Transform& transform) -{ - m_implTransform = transform; +void LayerTreeHost::SetImplTransform(const gfx::Transform& transform) { + impl_transform_ = transform; } -void LayerTreeHost::startRateLimiter(WebKit::WebGraphicsContext3D* context) -{ - if (m_animating) - return; +void LayerTreeHost::StartRateLimiter(WebKit::WebGraphicsContext3D* context3d) { + if (animating_) + return; - DCHECK(context); - RateLimiterMap::iterator it = m_rateLimiters.find(context); - if (it != m_rateLimiters.end()) - it->second->start(); - else { - scoped_refptr<RateLimiter> rateLimiter = RateLimiter::create(context, this, m_proxy->MainThread()); - m_rateLimiters[context] = rateLimiter; - rateLimiter->start(); - } + DCHECK(context3d); + RateLimiterMap::iterator it = rate_limiters_.find(context3d); + if (it != rate_limiters_.end()) { + it->second->start(); + } else { + scoped_refptr<RateLimiter> rate_limiter = + RateLimiter::create(context3d, this, proxy_->MainThread()); + rate_limiters_[context3d] = rate_limiter; + rate_limiter->start(); + } } -void LayerTreeHost::stopRateLimiter(WebKit::WebGraphicsContext3D* context) -{ - RateLimiterMap::iterator it = m_rateLimiters.find(context); - if (it != m_rateLimiters.end()) { - it->second->stop(); - m_rateLimiters.erase(it); - } -} - -void LayerTreeHost::rateLimit() -{ - // Force a no-op command on the compositor context, so that any ratelimiting commands will wait for the compositing - // context, and therefore for the SwapBuffers. - m_proxy->ForceSerializeOnSwapBuffers(); +void LayerTreeHost::StopRateLimiter(WebKit::WebGraphicsContext3D* context3d) { + RateLimiterMap::iterator it = rate_limiters_.find(context3d); + if (it != rate_limiters_.end()) { + it->second->stop(); + rate_limiters_.erase(it); + } } -bool LayerTreeHost::bufferedUpdates() -{ - return m_settings.maxPartialTextureUpdates != std::numeric_limits<size_t>::max(); +void LayerTreeHost::rateLimit() { + // Force a no-op command on the compositor context, so that any ratelimiting + // commands will wait for the compositing context, and therefore for the + // SwapBuffers. + proxy_->ForceSerializeOnSwapBuffers(); } -bool LayerTreeHost::requestPartialTextureUpdate() -{ - if (m_partialTextureUpdateRequests >= m_settings.maxPartialTextureUpdates) - return false; +bool LayerTreeHost::RequestPartialTextureUpdate() { + if (partial_texture_update_requests_ >= settings_.maxPartialTextureUpdates) + return false; - m_partialTextureUpdateRequests++; - return true; + partial_texture_update_requests_++; + return true; } -void LayerTreeHost::setDeviceScaleFactor(float deviceScaleFactor) -{ - if (deviceScaleFactor == m_deviceScaleFactor) - return; - m_deviceScaleFactor = deviceScaleFactor; +void LayerTreeHost::SetDeviceScaleFactor(float device_scale_factor) { + if (device_scale_factor == device_scale_factor_) + return; + device_scale_factor_ = device_scale_factor; - setNeedsCommit(); + SetNeedsCommit(); } -void LayerTreeHost::enableHidingTopControls(bool enable) -{ - if (!m_settings.calculateTopControlsPosition) - return; +void LayerTreeHost::EnableHidingTopControls(bool enable) { + if (!settings_.calculateTopControlsPosition) + return; - m_proxy->ImplThread()->postTask( - base::Bind(&TopControlsManager::EnableHidingTopControls, - m_topControlsManagerWeakPtr, enable)); + proxy_->ImplThread()->postTask( + base::Bind(&TopControlsManager::EnableHidingTopControls, + top_controls_manager_weak_ptr_, enable)); } -bool LayerTreeHost::blocksPendingCommit() const -{ - if (!m_rootLayer) - return false; - return m_rootLayer->BlocksPendingCommitRecursive(); +bool LayerTreeHost::BlocksPendingCommit() const { + if (!root_layer_) + return false; + return root_layer_->BlocksPendingCommitRecursive(); } -scoped_ptr<base::Value> LayerTreeHost::asValue() const -{ - scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); - state->Set("proxy", m_proxy->AsValue().release()); - return state.PassAs<base::Value>(); +scoped_ptr<base::Value> LayerTreeHost::AsValue() const { + scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); + state->Set("proxy", proxy_->AsValue().release()); + return state.PassAs<base::Value>(); } -void LayerTreeHost::animateLayers(base::TimeTicks time) -{ - if (!m_settings.acceleratedAnimationEnabled || m_animationRegistrar->active_animation_controllers().empty()) - return; +void LayerTreeHost::AnimateLayers(base::TimeTicks time) { + if (!settings_.acceleratedAnimationEnabled || + animation_registrar_->active_animation_controllers().empty()) + return; - TRACE_EVENT0("cc", "LayerTreeHostImpl::animateLayers"); + TRACE_EVENT0("cc", "LayerTreeHostImpl::AnimateLayers"); - double monotonicTime = (time - base::TimeTicks()).InSecondsF(); + double monotonic_time = (time - base::TimeTicks()).InSecondsF(); - AnimationRegistrar::AnimationControllerMap copy = m_animationRegistrar->active_animation_controllers(); - for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); iter != copy.end(); ++iter) { - (*iter).second->Animate(monotonicTime); - (*iter).second->UpdateState(NULL); - } + AnimationRegistrar::AnimationControllerMap copy = + animation_registrar_->active_animation_controllers(); + for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); + iter != copy.end(); + ++iter) { + (*iter).second->Animate(monotonic_time); + (*iter).second->UpdateState(NULL); + } } -void LayerTreeHost::setAnimationEventsRecursive(const AnimationEventsVector& events, Layer* layer, base::Time wallClockTime) -{ - if (!layer) - return; - - for (size_t eventIndex = 0; eventIndex < events.size(); ++eventIndex) { - if (layer->id() == events[eventIndex].layer_id) { - switch (events[eventIndex].type) { - case AnimationEvent::Started: - layer->NotifyAnimationStarted(events[eventIndex], wallClockTime.ToDoubleT()); - break; - - case AnimationEvent::Finished: - layer->NotifyAnimationFinished(wallClockTime.ToDoubleT()); - break; - - case AnimationEvent::PropertyUpdate: - layer->NotifyAnimationPropertyUpdate(events[eventIndex]); - break; - - default: - NOTREACHED(); - } - } +void LayerTreeHost::SetAnimationEventsRecursive( + const AnimationEventsVector& events, + Layer* layer, + base::Time wall_clock_time) { + if (!layer) + return; + + for (size_t event_index = 0; event_index < events.size(); ++event_index) { + if (layer->id() == events[event_index].layer_id) { + switch (events[event_index].type) { + case AnimationEvent::Started: + layer->NotifyAnimationStarted(events[event_index], + wall_clock_time.ToDoubleT()); + break; + + case AnimationEvent::Finished: + layer->NotifyAnimationFinished(wall_clock_time.ToDoubleT()); + break; + + case AnimationEvent::PropertyUpdate: + layer->NotifyAnimationPropertyUpdate(events[event_index]); + break; + + default: + NOTREACHED(); + } } + } - for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIndex) - setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); + for (size_t child_index = 0; + child_index < layer->children().size(); + ++child_index) + SetAnimationEventsRecursive(events, + layer->children()[child_index].get(), + wall_clock_time); } -skia::RefPtr<SkPicture> LayerTreeHost::capturePicture() -{ - return m_proxy->CapturePicture(); +skia::RefPtr<SkPicture> LayerTreeHost::CapturePicture() { + return proxy_->CapturePicture(); } } // namespace cc diff --git a/cc/layer_tree_host.h b/cc/layer_tree_host.h index e5719ec..9a45ecc 100644 --- a/cc/layer_tree_host.h +++ b/cc/layer_tree_host.h @@ -32,14 +32,14 @@ #if defined(COMPILER_GCC) namespace BASE_HASH_NAMESPACE { -template<> +template <> struct hash<WebKit::WebGraphicsContext3D*> { size_t operator()(WebKit::WebGraphicsContext3D* ptr) const { return hash<size_t>()(reinterpret_cast<size_t>(ptr)); } }; -} // namespace BASE_HASH_NAMESPACE -#endif // COMPILER +} // namespace BASE_HASH_NAMESPACE +#endif // COMPILER namespace cc { @@ -56,235 +56,262 @@ class ResourceUpdateQueue; class TopControlsManager; struct ScrollAndScaleSet; - -// Provides information on an Impl's rendering capabilities back to the LayerTreeHost +// Provides information on an Impl's rendering capabilities back to the +// LayerTreeHost. struct CC_EXPORT RendererCapabilities { - RendererCapabilities(); - ~RendererCapabilities(); - - unsigned bestTextureFormat; - bool usingPartialSwap; - bool usingAcceleratedPainting; - bool usingSetVisibility; - bool usingSwapCompleteCallback; - bool usingGpuMemoryManager; - bool usingEglImage; - bool allowPartialTextureUpdates; - bool usingOffscreenContext3d; - int maxTextureSize; - bool avoidPow2Textures; + RendererCapabilities(); + ~RendererCapabilities(); + + unsigned best_texture_format; + bool using_partial_swap; + bool using_accelerated_painting; + bool using_set_visibility; + bool using_swap_complete_callback; + bool using_gpu_memory_manager; + bool using_egl_image; + bool allow_partial_texture_updates; + bool using_offscreen_context3d; + int max_texture_size; + bool avoid_pow2_textures; }; class CC_EXPORT LayerTreeHost : public RateLimiterClient { -public: - static scoped_ptr<LayerTreeHost> create(LayerTreeHostClient*, const LayerTreeSettings&, scoped_ptr<Thread> implThread); - virtual ~LayerTreeHost(); - - void setSurfaceReady(); - - // Returns true if any LayerTreeHost is alive. - static bool anyLayerTreeHostInstanceExists(); - - void setNeedsFilterContext() { m_needsFilterContext = true; } - bool needsOffscreenContext() const { return m_needsFilterContext || settings().acceleratePainting; } - - // LayerTreeHost interface to Proxy. - void willBeginFrame() { m_client->willBeginFrame(); } - void didBeginFrame(); - void updateAnimations(base::TimeTicks monotonicFrameBeginTime); - void didStopFlinging(); - void layout(); - void beginCommitOnImplThread(LayerTreeHostImpl*); - void finishCommitOnImplThread(LayerTreeHostImpl*); - void willCommit(); - void commitComplete(); - scoped_ptr<OutputSurface> createOutputSurface(); - scoped_ptr<InputHandler> createInputHandler(); - virtual scoped_ptr<LayerTreeHostImpl> createLayerTreeHostImpl(LayerTreeHostImplClient*); - void didLoseOutputSurface(); - enum RecreateResult { - RecreateSucceeded, - RecreateFailedButTryAgain, - RecreateFailedAndGaveUp, - }; - RecreateResult recreateOutputSurface(); - void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); } - void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); } - void deleteContentsTexturesOnImplThread(ResourceProvider*); - virtual void acquireLayerTextures(); - // Returns false if we should abort this frame due to initialization failure. - bool initializeRendererIfNeeded(); - void updateLayers(ResourceUpdateQueue&, size_t contentsMemoryLimitBytes); - - LayerTreeHostClient* client() { return m_client; } - - void composite(); - - // Only used when compositing on the main thread. - void scheduleComposite(); - - // Composites and attempts to read back the result into the provided - // buffer. If it wasn't possible, e.g. due to context lost, will return - // false. - bool compositeAndReadback(void *pixels, const gfx::Rect&); - - void finishAllRendering(); - - void setDeferCommits(bool deferCommits); - - // Test only hook - virtual void didDeferCommit(); - - int commitNumber() const { return m_commitNumber; } + public: + static scoped_ptr<LayerTreeHost> Create(LayerTreeHostClient* client, + const LayerTreeSettings& settings, + scoped_ptr<Thread> impl_thread); + virtual ~LayerTreeHost(); - void renderingStats(RenderingStats*) const; + void SetSurfaceReady(); - const RendererCapabilities& rendererCapabilities() const; + // Returns true if any LayerTreeHost is alive. + static bool AnyLayerTreeHostInstanceExists(); - void setNeedsAnimate(); - // virtual for testing - virtual void setNeedsCommit(); - virtual void setNeedsFullTreeSync(); - void setNeedsRedraw(); - bool commitRequested() const; - - void setAnimationEvents(scoped_ptr<AnimationEventsVector>, base::Time wallClockTime); - - Layer* rootLayer() { return m_rootLayer.get(); } - const Layer* rootLayer() const { return m_rootLayer.get(); } - void setRootLayer(scoped_refptr<Layer>); - - const LayerTreeSettings& settings() const { return m_settings; } - - void setDebugState(const LayerTreeDebugState& debugState); - const LayerTreeDebugState& debugState() const { return m_debugState; } - - void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize); - - const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; } - const gfx::Size& deviceViewportSize() const { return m_deviceViewportSize; } - - void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor); + void set_needs_filter_context() { needs_filter_context_ = true; } + bool needs_offscreen_context() const { + return needs_filter_context_ || settings_.acceleratePainting; + } - void setBackgroundColor(SkColor color) { m_backgroundColor = color; } + // LayerTreeHost interface to Proxy. + void WillBeginFrame() { client_->willBeginFrame(); } + void DidBeginFrame(); + void UpdateAnimations(base::TimeTicks monotonic_frame_begin_time); + void DidStopFlinging(); + void Layout(); + void BeginCommitOnImplThread(LayerTreeHostImpl* host_impl); + void FinishCommitOnImplThread(LayerTreeHostImpl* host_impl); + void WillCommit(); + void CommitComplete(); + scoped_ptr<OutputSurface> CreateOutputSurface(); + scoped_ptr<InputHandler> CreateInputHandler(); + virtual scoped_ptr<LayerTreeHostImpl> CreateLayerTreeHostImpl( + LayerTreeHostImplClient* client); + void DidLoseOutputSurface(); + enum RecreateResult { + RecreateSucceeded, + RecreateFailedButTryAgain, + RecreateFailedAndGaveUp, + }; + RecreateResult RecreateOutputSurface(); + void DidCommitAndDrawFrame() { client_->didCommitAndDrawFrame(); } + void DidCompleteSwapBuffers() { client_->didCompleteSwapBuffers(); } + void DeleteContentsTexturesOnImplThread(ResourceProvider* resource_provider); + virtual void AcquireLayerTextures(); + // Returns false if we should abort this frame due to initialization failure. + bool InitializeRendererIfNeeded(); + void UpdateLayers(ResourceUpdateQueue* queue, + size_t contents_memory_limit_bytes); + + LayerTreeHostClient* client() { return client_; } + + void Composite(); + + // Only used when compositing on the main thread. + void ScheduleComposite(); + + // Composites and attempts to read back the result into the provided + // buffer. If it wasn't possible, e.g. due to context lost, will return + // false. + bool CompositeAndReadback(void* pixels, gfx::Rect rect_in_device_viewport); + + void FinishAllRendering(); + + void SetDeferCommits(bool defer_commits); + + // Test only hook + virtual void DidDeferCommit(); + + int commit_number() const { return commit_number_; } + + void CollectRenderingStats(RenderingStats* stats) const; + + const RendererCapabilities& GetRendererCapabilities() const; + + void SetNeedsAnimate(); + virtual void SetNeedsCommit(); + virtual void SetNeedsFullTreeSync(); + void SetNeedsRedraw(); + bool CommitRequested() const; + + void SetAnimationEvents(scoped_ptr<AnimationEventsVector> events, + base::Time wall_clock_time); + + void SetRootLayer(scoped_refptr<Layer> root_layer); + Layer* root_layer() { return root_layer_.get(); } + const Layer* root_layer() const { return root_layer_.get(); } + + const LayerTreeSettings& settings() const { return settings_; } + + void SetDebugState(const LayerTreeDebugState& debug_state); + const LayerTreeDebugState& debug_state() const { return debug_state_; } + + void SetViewportSize(gfx::Size layout_viewport_size, + gfx::Size device_viewport_size); + + gfx::Size layout_viewport_size() const { return layout_viewport_size_; } + gfx::Size device_viewport_size() const { return device_viewport_size_; } + + void SetPageScaleFactorAndLimits(float page_scale_factor, + float min_page_scale_factor, + float max_page_scale_factor); + + void set_background_color(SkColor color) { background_color_ = color; } + + void set_has_transparent_background(bool transparent) { + has_transparent_background_ = transparent; + } - void setHasTransparentBackground(bool transparent) { m_hasTransparentBackground = transparent; } + PrioritizedResourceManager* contents_texture_manager() const { + return contents_texture_manager_.get(); + } - PrioritizedResourceManager* contentsTextureManager() const; + void SetVisible(bool visible); + bool visible() const { return visible_; } - bool visible() const { return m_visible; } - void setVisible(bool); + void StartPageScaleAnimation(gfx::Vector2d target_offset, + bool use_anchor, + float scale, + base::TimeDelta duration); - void startPageScaleAnimation(gfx::Vector2d targetOffset, bool useAnchor, float scale, base::TimeDelta duration); + void ApplyScrollAndScale(const ScrollAndScaleSet& info); - void applyScrollAndScale(const ScrollAndScaleSet&); - void setImplTransform(const gfx::Transform&); + void SetImplTransform(const gfx::Transform& transform); - void startRateLimiter(WebKit::WebGraphicsContext3D*); - void stopRateLimiter(WebKit::WebGraphicsContext3D*); + void StartRateLimiter(WebKit::WebGraphicsContext3D* context3d); + void StopRateLimiter(WebKit::WebGraphicsContext3D* context3d); - // RateLimitClient implementation - virtual void rateLimit() OVERRIDE; + // RateLimitClient implementation + virtual void rateLimit() OVERRIDE; - bool bufferedUpdates(); - bool requestPartialTextureUpdate(); + bool buffered_updates() const { + return settings_.maxPartialTextureUpdates != + std::numeric_limits<size_t>::max(); + } + bool RequestPartialTextureUpdate(); - void setDeviceScaleFactor(float); - float deviceScaleFactor() const { return m_deviceScaleFactor; } + void SetDeviceScaleFactor(float device_scale_factor); + float device_scale_factor() const { return device_scale_factor_; } - void enableHidingTopControls(bool enable); + void EnableHidingTopControls(bool enable); - HeadsUpDisplayLayer* hudLayer() const { return m_hudLayer.get(); } + HeadsUpDisplayLayer* hud_layer() const { return hud_layer_.get(); } - Proxy* proxy() const { return m_proxy.get(); } + Proxy* proxy() const { return proxy_.get(); } - AnimationRegistrar* animationRegistrar() const { return m_animationRegistrar.get(); } + AnimationRegistrar* animation_registrar() const { + return animation_registrar_.get(); + } - skia::RefPtr<SkPicture> capturePicture(); + skia::RefPtr<SkPicture> CapturePicture(); - bool blocksPendingCommit() const; + bool BlocksPendingCommit() const; - // Obtains a thorough dump of the LayerTreeHost as a value. - scoped_ptr<base::Value> asValue() const; + // Obtains a thorough dump of the LayerTreeHost as a value. + scoped_ptr<base::Value> AsValue() const; -protected: - LayerTreeHost(LayerTreeHostClient*, const LayerTreeSettings&); - bool initialize(scoped_ptr<Thread> implThread); - bool initializeForTesting(scoped_ptr<Proxy> proxyForTesting); + protected: + LayerTreeHost(LayerTreeHostClient* client, const LayerTreeSettings& settings); + bool Initialize(scoped_ptr<Thread> impl_thread); + bool InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing); -private: - typedef std::vector<scoped_refptr<Layer> > LayerList; + private: + typedef std::vector<scoped_refptr<Layer> > LayerList; - bool initializeProxy(scoped_ptr<Proxy> proxy); - void initializeRenderer(); + bool InitializeProxy(scoped_ptr<Proxy> proxy); + void InitializeRenderer(); - void update(Layer*, ResourceUpdateQueue&, const OcclusionTracker*); - bool paintLayerContents(const LayerList&, ResourceUpdateQueue&); - bool paintMasksForRenderSurface(Layer*, ResourceUpdateQueue&); + bool PaintLayerContents(const LayerList& render_surface_layer_list, + ResourceUpdateQueue* quue); + bool PaintMasksForRenderSurface(Layer* render_surface_layer, + ResourceUpdateQueue* queue); - void updateLayers(Layer*, ResourceUpdateQueue&); - void updateHudLayer(); - void triggerPrepaint(); + void UpdateLayers(Layer* root_layer, ResourceUpdateQueue* queue); + void UpdateHudLayer(); + void TriggerPrepaint(); - void prioritizeTextures(const LayerList&, OverdrawMetrics&); - void setPrioritiesForSurfaces(size_t surfaceMemoryBytes); - void setPrioritiesForLayers(const LayerList&); - size_t calculateMemoryForRenderSurfaces(const LayerList& updateList); + void PrioritizeTextures(const LayerList& render_surface_layer_list, + OverdrawMetrics* metrics); + void SetPrioritiesForSurfaces(size_t surface_memory_bytes); + void SetPrioritiesForLayers(const LayerList& update_list); + size_t CalculateMemoryForRenderSurfaces(const LayerList& update_list); - void animateLayers(base::TimeTicks monotonicTime); - bool animateLayersRecursive(Layer* current, base::TimeTicks time); - void setAnimationEventsRecursive(const AnimationEventsVector&, Layer*, base::Time wallClockTime); + void AnimateLayers(base::TimeTicks monotonic_time); + bool AnimateLayersRecursive(Layer* current, base::TimeTicks time); + void SetAnimationEventsRecursive(const AnimationEventsVector& events, + Layer* layer, + base::Time wall_clock_time); - bool m_animating; - bool m_needsFullTreeSync; - bool m_needsFilterContext; + bool animating_; + bool needs_full_tree_sync_; + bool needs_filter_context_; - base::CancelableClosure m_prepaintCallback; + base::CancelableClosure prepaint_callback_; - LayerTreeHostClient* m_client; - scoped_ptr<Proxy> m_proxy; + LayerTreeHostClient* client_; + scoped_ptr<Proxy> proxy_; - int m_commitNumber; - RenderingStats m_renderingStats; + int commit_number_; + RenderingStats rendering_stats_; - bool m_rendererInitialized; - bool m_outputSurfaceLost; - int m_numFailedRecreateAttempts; + bool renderer_initialized_; + bool output_surface_lost_; + int num_failed_recreate_attempts_; - scoped_refptr<Layer> m_rootLayer; - scoped_refptr<HeadsUpDisplayLayer> m_hudLayer; + scoped_refptr<Layer> root_layer_; + scoped_refptr<HeadsUpDisplayLayer> hud_layer_; - scoped_ptr<PrioritizedResourceManager> m_contentsTextureManager; - scoped_ptr<PrioritizedResource> m_surfaceMemoryPlaceholder; + scoped_ptr<PrioritizedResourceManager> contents_texture_manager_; + scoped_ptr<PrioritizedResource> surface_memory_placeholder_; - base::WeakPtr<TopControlsManager> m_topControlsManagerWeakPtr; + base::WeakPtr<TopControlsManager> top_controls_manager_weak_ptr_; - LayerTreeSettings m_settings; - LayerTreeDebugState m_debugState; + LayerTreeSettings settings_; + LayerTreeDebugState debug_state_; - gfx::Size m_layoutViewportSize; - gfx::Size m_deviceViewportSize; - float m_deviceScaleFactor; + gfx::Size layout_viewport_size_; + gfx::Size device_viewport_size_; + float device_scale_factor_; - bool m_visible; + bool visible_; - typedef base::hash_map<WebKit::WebGraphicsContext3D*, scoped_refptr<RateLimiter> > RateLimiterMap; - RateLimiterMap m_rateLimiters; + typedef base::hash_map<WebKit::WebGraphicsContext3D*, + scoped_refptr<RateLimiter> > RateLimiterMap; + RateLimiterMap rate_limiters_; - float m_pageScaleFactor; - float m_minPageScaleFactor, m_maxPageScaleFactor; - gfx::Transform m_implTransform; - bool m_triggerIdleUpdates; + float page_scale_factor_; + float min_page_scale_factor_, max_page_scale_factor_; + gfx::Transform impl_transform_; + bool trigger_idle_updates_; - SkColor m_backgroundColor; - bool m_hasTransparentBackground; + SkColor background_color_; + bool has_transparent_background_; - typedef ScopedPtrVector<PrioritizedResource> TextureList; - size_t m_partialTextureUpdateRequests; + typedef ScopedPtrVector<PrioritizedResource> TextureList; + size_t partial_texture_update_requests_; - scoped_ptr<AnimationRegistrar> m_animationRegistrar; + scoped_ptr<AnimationRegistrar> animation_registrar_; - DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); + DISALLOW_COPY_AND_ASSIGN(LayerTreeHost); }; } // namespace cc diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc index cc928ce..3e20336 100644 --- a/cc/layer_tree_host_impl.cc +++ b/cc/layer_tree_host_impl.cc @@ -524,7 +524,7 @@ bool LayerTreeHostImpl::calculateRenderPasses(FrameData& frame) drawFrame = false; } - if (appendQuadsData.hadIncompleteTile) + if (appendQuadsData.hadIncompleteTile) frame.containsIncompleteTile = true; occlusionTracker.LeaveLayer(it); @@ -546,7 +546,7 @@ bool LayerTreeHostImpl::calculateRenderPasses(FrameData& frame) } if (drawFrame) - occlusionTracker.OverdrawMetrics().RecordMetrics(this); + occlusionTracker.overdraw_metrics()->RecordMetrics(this); removeRenderPasses(CullRenderPassesWithNoQuads(), frame); m_renderer->DecideRenderPassAllocationsForFrame(frame.renderPasses); @@ -889,10 +889,11 @@ void LayerTreeHostImpl::OnSwapBuffersComplete() m_client->onSwapBuffersCompleteOnImplThread(); } -void LayerTreeHostImpl::readback(void* pixels, const gfx::Rect& rect) +void LayerTreeHostImpl::readback(void* pixels, + gfx::Rect rect_in_device_viewport) { DCHECK(m_renderer); - m_renderer->GetFramebufferPixels(pixels, rect); + m_renderer->GetFramebufferPixels(pixels, rect_in_device_viewport); } bool LayerTreeHostImpl::haveRootScrollLayer() const { diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h index 81097e3..23bf1ad 100644 --- a/cc/layer_tree_host_impl.h +++ b/cc/layer_tree_host_impl.h @@ -165,7 +165,7 @@ public: bool swapBuffers(); - void readback(void* pixels, const gfx::Rect&); + void readback(void* pixels, gfx::Rect rect_in_device_viewport); LayerTreeImpl* activeTree() { return m_activeTree.get(); } const LayerTreeImpl* activeTree() const { return m_activeTree.get(); } diff --git a/cc/layer_tree_host_perftest.cc b/cc/layer_tree_host_perftest.cc index 8e9da6c..a526cf2 100644 --- a/cc/layer_tree_host_perftest.cc +++ b/cc/layer_tree_host_perftest.cc @@ -85,11 +85,11 @@ class LayerTreeHostPerfTestJsonReader : public LayerTreeHostPerfTest { virtual void buildTree() OVERRIDE { gfx::Size viewport = gfx::Size(720, 1038); - m_layerTreeHost->setViewportSize(viewport, viewport); + m_layerTreeHost->SetViewportSize(viewport, viewport); scoped_refptr<Layer> root = ParseTreeFromJson(json_, &fake_content_layer_client_); ASSERT_TRUE(root.get()); - m_layerTreeHost->setRootLayer(root); + m_layerTreeHost->SetRootLayer(root); } private: @@ -111,7 +111,7 @@ class ScrollingLayerTreePerfTest : public LayerTreeHostPerfTestJsonReader { virtual void buildTree() OVERRIDE { LayerTreeHostPerfTestJsonReader::buildTree(); - scrollable_ = m_layerTreeHost->rootLayer()->children()[1]; + scrollable_ = m_layerTreeHost->root_layer()->children()[1]; ASSERT_TRUE(scrollable_); } diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc index 7450def..ed6c727 100644 --- a/cc/layer_tree_host_unittest.cc +++ b/cc/layer_tree_host_unittest.cc @@ -51,7 +51,7 @@ public: virtual void beginTest() OVERRIDE { // Kill the layerTreeHost immediately. - m_layerTreeHost->setRootLayer(0); + m_layerTreeHost->SetRootLayer(NULL); m_layerTreeHost.reset(); endTest(); @@ -72,7 +72,7 @@ public: postSetNeedsCommitToMainThread(); // Kill the layerTreeHost immediately. - m_layerTreeHost->setRootLayer(0); + m_layerTreeHost->SetRootLayer(NULL); m_layerTreeHost.reset(); endTest(); @@ -95,7 +95,7 @@ public: postSetNeedsRedrawToMainThread(); // Kill the layerTreeHost immediately. - m_layerTreeHost->setRootLayer(0); + m_layerTreeHost->SetRootLayer(NULL); m_layerTreeHost.reset(); endTest(); @@ -298,20 +298,20 @@ public: m_rootLayer->SetAutomaticallyComputeRasterScale(false); m_rootLayer->SetIsDrawable(true); m_rootLayer->SetBounds(gfx::Size(1, 1)); - m_layerTreeHost->setRootLayer(m_rootLayer); + m_layerTreeHost->SetRootLayer(m_rootLayer); postSetNeedsCommitToMainThread(); } virtual void didCommit() OVERRIDE { - switch (m_layerTreeHost->commitNumber()) { + switch (m_layerTreeHost->commit_number()) { case 1: // Changing the content bounds will cause a single commit! m_rootLayer->SetRasterScale(4.0f); break; default: // No extra commits. - EXPECT_EQ(2, m_layerTreeHost->commitNumber()); + EXPECT_EQ(2, m_layerTreeHost->commit_number()); endTest(); } } @@ -344,7 +344,7 @@ public: m_numCommits++; if (m_numCommits == 1) { char pixels[4]; - m_layerTreeHost->compositeAndReadback(static_cast<void*>(&pixels), gfx::Rect(0, 0, 1, 1)); + m_layerTreeHost->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); } else if (m_numCommits == 2) { // This is inside the readback. We should get another commit after it. } else if (m_numCommits == 3) { @@ -383,10 +383,10 @@ public: { m_numCommits++; if (m_numCommits == 1) { - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); } else if (m_numCommits == 2) { char pixels[4]; - m_layerTreeHost->compositeAndReadback(static_cast<void*>(&pixels), gfx::Rect(0, 0, 1, 1)); + m_layerTreeHost->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); } else if (m_numCommits == 3) { // This is inside the readback. We should get another commit after it. } else if (m_numCommits == 4) { @@ -447,13 +447,13 @@ public: m_numCommits++; if (m_numCommits == 1) { // Make the viewport empty so the host says it can't draw. - m_layerTreeHost->setViewportSize(gfx::Size(0, 0), gfx::Size(0, 0)); + m_layerTreeHost->SetViewportSize(gfx::Size(0, 0), gfx::Size(0, 0)); } else if (m_numCommits == 2) { char pixels[4]; - m_layerTreeHost->compositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); + m_layerTreeHost->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); } else if (m_numCommits == 3) { // Let it draw so we go idle and end the test. - m_layerTreeHost->setViewportSize(gfx::Size(1, 1), gfx::Size(1, 1)); + m_layerTreeHost->SetViewportSize(gfx::Size(1, 1), gfx::Size(1, 1)); m_done = true; endTest(); } @@ -573,11 +573,11 @@ public: { m_numCommits++; if (m_numCommits == 1) { - m_layerTreeHost->setVisible(false); - m_layerTreeHost->setNeedsCommit(); - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetVisible(false); + m_layerTreeHost->SetNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); char pixels[4]; - m_layerTreeHost->compositeAndReadback(static_cast<void*>(&pixels), gfx::Rect(0, 0, 1, 1)); + m_layerTreeHost->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); } else endTest(); @@ -605,9 +605,9 @@ public: virtual void beginTest() OVERRIDE { // Request a commit (from the main thread), which will trigger the commit flow from the impl side. - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); // Then mark ourselves as not visible before processing any more messages on the main thread. - m_layerTreeHost->setVisible(false); + m_layerTreeHost->SetVisible(false); // If we make it without kicking a frame, we pass! endTestAfterDelay(1); } @@ -638,9 +638,9 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->setViewportSize(gfx::Size(20, 20), gfx::Size(20, 20)); - m_layerTreeHost->setBackgroundColor(SK_ColorGRAY); - m_layerTreeHost->setPageScaleFactorAndLimits(5, 5, 5); + m_layerTreeHost->SetViewportSize(gfx::Size(20, 20), gfx::Size(20, 20)); + m_layerTreeHost->set_background_color(SK_ColorGRAY); + m_layerTreeHost->SetPageScaleFactorAndLimits(5, 5, 5); postSetNeedsCommitToMainThread(); } @@ -674,15 +674,15 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->rootLayer()->SetScrollable(true); - m_layerTreeHost->rootLayer()->SetScrollOffset(gfx::Vector2d()); + m_layerTreeHost->root_layer()->SetScrollable(true); + m_layerTreeHost->root_layer()->SetScrollOffset(gfx::Vector2d()); postSetNeedsCommitToMainThread(); postSetNeedsRedrawToMainThread(); } void requestStartPageScaleAnimation() { - m_layerTreeHost->startPageScaleAnimation(gfx::Vector2d(), false, 1.25, base::TimeDelta()); + m_layerTreeHost->StartPageScaleAnimation(gfx::Vector2d(), false, 1.25, base::TimeDelta()); } virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE @@ -700,9 +700,9 @@ public: virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float scale) OVERRIDE { - gfx::Vector2d offset = m_layerTreeHost->rootLayer()->scroll_offset(); - m_layerTreeHost->rootLayer()->SetScrollOffset(offset + scrollDelta); - m_layerTreeHost->setPageScaleFactorAndLimits(scale, 0.5, 2); + gfx::Vector2d offset = m_layerTreeHost->root_layer()->scroll_offset(); + m_layerTreeHost->root_layer()->SetScrollOffset(offset + scrollDelta); + m_layerTreeHost->SetPageScaleFactorAndLimits(scale, 0.5, 2); } virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE @@ -831,8 +831,8 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); - m_layerTreeHost->rootLayer()->AddChild(m_updateCheckLayer); + m_layerTreeHost->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); + m_layerTreeHost->root_layer()->AddChild(m_updateCheckLayer); postSetNeedsCommitToMainThread(); } @@ -898,10 +898,10 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->setViewportSize(gfx::Size(40, 40), gfx::Size(60, 60)); - m_layerTreeHost->setDeviceScaleFactor(1.5); - EXPECT_EQ(gfx::Size(40, 40), m_layerTreeHost->layoutViewportSize()); - EXPECT_EQ(gfx::Size(60, 60), m_layerTreeHost->deviceViewportSize()); + m_layerTreeHost->SetViewportSize(gfx::Size(40, 40), gfx::Size(60, 60)); + m_layerTreeHost->SetDeviceScaleFactor(1.5); + EXPECT_EQ(gfx::Size(40, 40), m_layerTreeHost->layout_viewport_size()); + EXPECT_EQ(gfx::Size(60, 60), m_layerTreeHost->device_viewport_size()); m_rootLayer->AddChild(m_childLayer); @@ -914,11 +914,11 @@ public: m_childLayer->SetBounds(gfx::Size(10, 10)); m_childLayer->SetAnchorPoint(gfx::PointF(0, 0)); - m_layerTreeHost->setRootLayer(m_rootLayer); + m_layerTreeHost->SetRootLayer(m_rootLayer); - ASSERT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); + ASSERT_TRUE(m_layerTreeHost->InitializeRendererIfNeeded()); ResourceUpdateQueue queue; - m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max()); + m_layerTreeHost->UpdateLayers(&queue, std::numeric_limits<size_t>::max()); postSetNeedsCommitToMainThread(); } @@ -1029,7 +1029,7 @@ public: m_layer->AddChild(m_scrollbar); - m_layerTreeHost->setRootLayer(m_layer); + m_layerTreeHost->SetRootLayer(m_layer); LayerTreeHostTest::setupTree(); } @@ -1161,7 +1161,7 @@ public: parent_->AddChild(m_scrollbarWithPaints); parent_->AddChild(m_scrollbarWithoutPaints); - m_layerTreeHost->setRootLayer(parent_); + m_layerTreeHost->SetRootLayer(parent_); LayerTreeHostTest::setupTree(); } @@ -1292,10 +1292,10 @@ public: m_child->SetNeedsDisplay(); m_scrollbarWithPaints->SetNeedsDisplay(); m_scrollbarWithoutPaints->SetNeedsDisplay(); - m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); + m_layerTreeHost->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); break; case 4: - m_layerTreeHost->setViewportSize(gfx::Size(10, 20), gfx::Size(10, 20)); + m_layerTreeHost->SetViewportSize(gfx::Size(10, 20), gfx::Size(10, 20)); break; case 5: break; @@ -1333,7 +1333,7 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->setNeedsRedraw(); + m_layerTreeHost->SetNeedsRedraw(); postSetNeedsCommitToMainThread(); } @@ -1342,13 +1342,13 @@ public: if (m_once) return; m_once = true; - m_layerTreeHost->setNeedsRedraw(); - m_layerTreeHost->acquireLayerTextures(); + m_layerTreeHost->SetNeedsRedraw(); + m_layerTreeHost->AcquireLayerTextures(); { base::AutoLock lock(m_lock); m_drawCount = 0; } - m_layerTreeHost->finishAllRendering(); + m_layerTreeHost->FinishAllRendering(); { base::AutoLock lock(m_lock); EXPECT_EQ(0, m_drawCount); @@ -1380,10 +1380,10 @@ public: virtual void beginTest() OVERRIDE { - Layer* rootLayer = m_layerTreeHost->rootLayer(); + Layer* rootLayer = m_layerTreeHost->root_layer(); char pixels[4]; - m_layerTreeHost->compositeAndReadback(static_cast<void*>(&pixels), gfx::Rect(0, 0, 1, 1)); + m_layerTreeHost->CompositeAndReadback(static_cast<void*>(&pixels), gfx::Rect(0, 0, 1, 1)); EXPECT_FALSE(rootLayer->render_surface()); endTest(); @@ -1414,7 +1414,7 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); + m_layerTreeHost->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); m_rootLayer->SetBounds(gfx::Size(100, 100)); m_surfaceLayer1->SetBounds(gfx::Size(100, 100)); @@ -1429,7 +1429,7 @@ public: m_rootLayer->AddChild(m_surfaceLayer1); m_surfaceLayer1->AddChild(m_surfaceLayer2); - m_layerTreeHost->setRootLayer(m_rootLayer); + m_layerTreeHost->SetRootLayer(m_rootLayer); postSetNeedsCommitToMainThread(); } @@ -1504,7 +1504,7 @@ private: { if (m_texture.get()) return; - m_texture = PrioritizedResource::create(layer_tree_host()->contentsTextureManager()); + m_texture = PrioritizedResource::create(layer_tree_host()->contents_texture_manager()); m_texture->setDimensions(gfx::Size(10, 10), GL_RGBA); m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 10, 10); } @@ -1582,8 +1582,8 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->setRootLayer(m_layer); - m_layerTreeHost->setViewportSize(gfx::Size(10, 20), gfx::Size(10, 20)); + m_layerTreeHost->SetRootLayer(m_layer); + m_layerTreeHost->SetViewportSize(gfx::Size(10, 20), gfx::Size(10, 20)); gfx::Transform identityMatrix; setLayerPropertiesForTesting(m_layer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 20), true); @@ -1635,13 +1635,13 @@ public: break; case 2: EXPECT_TRUE(m_layer->haveBackingTexture()); - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); break; case 3: break; case 4: EXPECT_TRUE(m_layer->haveBackingTexture()); - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); break; case 5: break; @@ -1714,8 +1714,8 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); - m_layerTreeHost->rootLayer()->SetBounds(gfx::Size(10, 10)); + m_layerTreeHost->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); + m_layerTreeHost->root_layer()->SetBounds(gfx::Size(10, 10)); postSetNeedsCommitToMainThread(); } @@ -1766,15 +1766,15 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); - m_layerTreeHost->rootLayer()->SetBounds(gfx::Size(10, 10)); + m_layerTreeHost->SetViewportSize(gfx::Size(10, 10), gfx::Size(10, 10)); + m_layerTreeHost->root_layer()->SetBounds(gfx::Size(10, 10)); m_contentLayer = ContentLayer::Create(&m_fakeDelegate); m_contentLayer->SetBounds(gfx::Size(10, 10)); m_contentLayer->SetPosition(gfx::PointF(0, 0)); m_contentLayer->SetAnchorPoint(gfx::PointF(0, 0)); m_contentLayer->SetIsDrawable(true); - m_layerTreeHost->rootLayer()->AddChild(m_contentLayer); + m_layerTreeHost->root_layer()->AddChild(m_contentLayer); postSetNeedsCommitToMainThread(); } @@ -1836,7 +1836,7 @@ public: virtual void didDeferCommit() OVERRIDE { m_numCommitsDeferred++; - m_layerTreeHost->setDeferCommits(false); + m_layerTreeHost->SetDeferCommits(false); } virtual void didCommit() OVERRIDE @@ -1845,7 +1845,7 @@ public: switch (m_numCompleteCommits) { case 1: EXPECT_EQ(0, m_numCommitsDeferred); - m_layerTreeHost->setDeferCommits(true); + m_layerTreeHost->SetDeferCommits(true); postSetNeedsCommitToMainThread(); break; case 2: @@ -1878,7 +1878,7 @@ public: LayerTreeHostWithProxy(FakeLayerImplTreeHostClient* client, const LayerTreeSettings& settings, scoped_ptr<Proxy> proxy) : LayerTreeHost(client, settings) { - EXPECT_TRUE(initializeForTesting(proxy.Pass())); + EXPECT_TRUE(InitializeForTesting(proxy.Pass())); } private: @@ -1892,14 +1892,14 @@ TEST(LayerTreeHostTest, LimitPartialUpdates) FakeLayerImplTreeHostClient client; scoped_ptr<FakeProxy> proxy = make_scoped_ptr(new FakeProxy(scoped_ptr<Thread>())); - proxy->GetRendererCapabilities().allowPartialTextureUpdates = false; + proxy->GetRendererCapabilities().allow_partial_texture_updates = false; proxy->SetMaxPartialTextureUpdates(5); LayerTreeSettings settings; settings.maxPartialTextureUpdates = 10; LayerTreeHostWithProxy host(&client, settings, proxy.PassAs<Proxy>()); - EXPECT_TRUE(host.initializeRendererIfNeeded()); + EXPECT_TRUE(host.InitializeRendererIfNeeded()); EXPECT_EQ(0u, host.settings().maxPartialTextureUpdates); } @@ -1909,14 +1909,14 @@ TEST(LayerTreeHostTest, LimitPartialUpdates) FakeLayerImplTreeHostClient client; scoped_ptr<FakeProxy> proxy = make_scoped_ptr(new FakeProxy(scoped_ptr<Thread>())); - proxy->GetRendererCapabilities().allowPartialTextureUpdates = true; + proxy->GetRendererCapabilities().allow_partial_texture_updates = true; proxy->SetMaxPartialTextureUpdates(5); LayerTreeSettings settings; settings.maxPartialTextureUpdates = 10; LayerTreeHostWithProxy host(&client, settings, proxy.PassAs<Proxy>()); - EXPECT_TRUE(host.initializeRendererIfNeeded()); + EXPECT_TRUE(host.InitializeRendererIfNeeded()); EXPECT_EQ(5u, host.settings().maxPartialTextureUpdates); } @@ -1926,14 +1926,14 @@ TEST(LayerTreeHostTest, LimitPartialUpdates) FakeLayerImplTreeHostClient client; scoped_ptr<FakeProxy> proxy = make_scoped_ptr(new FakeProxy(scoped_ptr<Thread>())); - proxy->GetRendererCapabilities().allowPartialTextureUpdates = true; + proxy->GetRendererCapabilities().allow_partial_texture_updates = true; proxy->SetMaxPartialTextureUpdates(20); LayerTreeSettings settings; settings.maxPartialTextureUpdates = 10; LayerTreeHostWithProxy host(&client, settings, proxy.PassAs<Proxy>()); - EXPECT_TRUE(host.initializeRendererIfNeeded()); + EXPECT_TRUE(host.InitializeRendererIfNeeded()); EXPECT_EQ(10u, host.settings().maxPartialTextureUpdates); } @@ -1948,8 +1948,8 @@ TEST(LayerTreeHostTest, PartialUpdatesWithGLRenderer) LayerTreeSettings settings; settings.maxPartialTextureUpdates = 4; - scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, scoped_ptr<Thread>()); - EXPECT_TRUE(host->initializeRendererIfNeeded()); + scoped_ptr<LayerTreeHost> host = LayerTreeHost::Create(&client, settings, scoped_ptr<Thread>()); + EXPECT_TRUE(host->InitializeRendererIfNeeded()); EXPECT_EQ(4u, host->settings().maxPartialTextureUpdates); } @@ -1962,8 +1962,8 @@ TEST(LayerTreeHostTest, PartialUpdatesWithSoftwareRenderer) LayerTreeSettings settings; settings.maxPartialTextureUpdates = 4; - scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, scoped_ptr<Thread>()); - EXPECT_TRUE(host->initializeRendererIfNeeded()); + scoped_ptr<LayerTreeHost> host = LayerTreeHost::Create(&client, settings, scoped_ptr<Thread>()); + EXPECT_TRUE(host->InitializeRendererIfNeeded()); EXPECT_EQ(4u, host->settings().maxPartialTextureUpdates); } @@ -1976,8 +1976,8 @@ TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndGLContent) LayerTreeSettings settings; settings.maxPartialTextureUpdates = 4; - scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, scoped_ptr<Thread>()); - EXPECT_TRUE(host->initializeRendererIfNeeded()); + scoped_ptr<LayerTreeHost> host = LayerTreeHost::Create(&client, settings, scoped_ptr<Thread>()); + EXPECT_TRUE(host->InitializeRendererIfNeeded()); EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); } @@ -1990,8 +1990,8 @@ TEST(LayerTreeHostTest, PartialUpdatesWithDelegatingRendererAndSoftwareContent) LayerTreeSettings settings; settings.maxPartialTextureUpdates = 4; - scoped_ptr<LayerTreeHost> host = LayerTreeHost::create(&client, settings, scoped_ptr<Thread>()); - EXPECT_TRUE(host->initializeRendererIfNeeded()); + scoped_ptr<LayerTreeHost> host = LayerTreeHost::Create(&client, settings, scoped_ptr<Thread>()); + EXPECT_TRUE(host->InitializeRendererIfNeeded()); EXPECT_EQ(0u, host->settings().maxPartialTextureUpdates); } @@ -2021,16 +2021,16 @@ public: { m_layer->SetIsDrawable(true); m_layer->SetBounds(bounds_); - m_layerTreeHost->setViewportSize(bounds_, bounds_); - m_layerTreeHost->setRootLayer(m_layer); + m_layerTreeHost->SetViewportSize(bounds_, bounds_); + m_layerTreeHost->SetRootLayer(m_layer); - EXPECT_TRUE(m_layerTreeHost->initializeRendererIfNeeded()); + EXPECT_TRUE(m_layerTreeHost->InitializeRendererIfNeeded()); postSetNeedsCommitToMainThread(); } virtual void didCommitAndDrawFrame() OVERRIDE { - m_picture = m_layerTreeHost->capturePicture(); + m_picture = m_layerTreeHost->CapturePicture(); endTest(); } @@ -2124,13 +2124,13 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); + m_layerTreeHost->SetViewportSize(gfx::Size(100, 100), gfx::Size(100, 100)); m_rootLayer->SetBounds(gfx::Size(100, 100)); m_childLayer1->SetBounds(gfx::Size(100, 100)); m_childLayer2->SetBounds(gfx::Size(100, 100)); m_rootLayer->AddChild(m_childLayer1); m_rootLayer->AddChild(m_childLayer2); - m_layerTreeHost->setRootLayer(m_rootLayer); + m_layerTreeHost->SetRootLayer(m_rootLayer); postSetNeedsCommitToMainThread(); } @@ -2139,7 +2139,7 @@ public: // One backing should remain unevicted. EXPECT_EQ( 100 * 100 * 4 * 1, - m_layerTreeHost->contentsTextureManager()->memoryUseBytes()); + m_layerTreeHost->contents_texture_manager()->memoryUseBytes()); // Make sure that contents textures are marked as having been // purged. EXPECT_TRUE(hostImpl->activeTree()->ContentsTexturesPurged()); @@ -2155,7 +2155,7 @@ public: // All three backings should have memory. EXPECT_EQ( 100 * 100 * 4 * 3, - m_layerTreeHost->contentsTextureManager()->memoryUseBytes()); + m_layerTreeHost->contents_texture_manager()->memoryUseBytes()); // Set a new policy that will kick out 1 of the 3 resources. // Because a resource was evicted, a commit will be kicked off. hostImpl->SetManagedMemoryPolicy(ManagedMemoryPolicy( @@ -2168,7 +2168,7 @@ public: // Only two backings should have memory. EXPECT_EQ( 100 * 100 * 4 * 2, - m_layerTreeHost->contentsTextureManager()->memoryUseBytes()); + m_layerTreeHost->contents_texture_manager()->memoryUseBytes()); // Become backgrounded, which will cause 1 more resource to be // evicted. postSetVisibleToMainThread(false); diff --git a/cc/layer_tree_host_unittest_animation.cc b/cc/layer_tree_host_unittest_animation.cc index e06bc58..6bfa36e 100644 --- a/cc/layer_tree_host_unittest_animation.cc +++ b/cc/layer_tree_host_unittest_animation.cc @@ -20,7 +20,7 @@ class LayerTreeHostAnimationTest : public ThreadedTest { public: virtual void setupTree() OVERRIDE { ThreadedTest::setupTree(); - m_layerTreeHost->rootLayer()->set_layer_animation_delegate(this); + m_layerTreeHost->root_layer()->set_layer_animation_delegate(this); } }; @@ -43,7 +43,7 @@ class LayerTreeHostAnimationTestSetNeedsAnimateShouldNotSetCommitRequested : if (num_commits_ != 1) return; - m_layerTreeHost->setNeedsAnimate(); + m_layerTreeHost->SetNeedsAnimate(); // Right now, commitRequested is going to be true, because during // beginFrame, we force commitRequested to true to prevent requests from // hitting the impl thread. But, when the next didCommit happens, we should @@ -52,14 +52,14 @@ class LayerTreeHostAnimationTestSetNeedsAnimateShouldNotSetCommitRequested : virtual void didCommit() OVERRIDE { if (!num_commits_) { - EXPECT_FALSE(m_layerTreeHost->commitRequested()); - m_layerTreeHost->setNeedsAnimate(); - EXPECT_FALSE(m_layerTreeHost->commitRequested()); + EXPECT_FALSE(m_layerTreeHost->CommitRequested()); + m_layerTreeHost->SetNeedsAnimate(); + EXPECT_FALSE(m_layerTreeHost->CommitRequested()); } // Verifies that the setNeedsAnimate we made in ::animate did not // trigger commitRequested. - EXPECT_FALSE(m_layerTreeHost->commitRequested()); + EXPECT_FALSE(m_layerTreeHost->CommitRequested()); endTest(); num_commits_++; } @@ -91,7 +91,7 @@ class LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback : virtual void animate(base::TimeTicks) OVERRIDE { if (!num_animates_) { - m_layerTreeHost->setNeedsAnimate(); + m_layerTreeHost->SetNeedsAnimate(); num_animates_++; return; } @@ -169,7 +169,7 @@ class LayerTreeHostAnimationTestCheckerboardDoesNotStarveDraws : } virtual void beginTest() OVERRIDE { - postAddAnimationToMainThread(m_layerTreeHost->rootLayer()); + postAddAnimationToMainThread(m_layerTreeHost->root_layer()); } virtual void animateLayers( @@ -208,7 +208,7 @@ class LayerTreeHostAnimationTestTickAnimationWhileBackgrounded : } virtual void beginTest() OVERRIDE { - postAddAnimationToMainThread(m_layerTreeHost->rootLayer()); + postAddAnimationToMainThread(m_layerTreeHost->root_layer()); } // Use willAnimateLayers to set visible false before the animation runs and @@ -245,14 +245,14 @@ public: LayerTreeHostAnimationTestAddAnimationWithTimingFunction() {} virtual void beginTest() OVERRIDE { - postAddAnimationToMainThread(m_layerTreeHost->rootLayer()); + postAddAnimationToMainThread(m_layerTreeHost->root_layer()); } virtual void animateLayers( LayerTreeHostImpl* host_impl, base::TimeTicks monotonicTime) OVERRIDE { LayerAnimationController* controller = - m_layerTreeHost->rootLayer()->layer_animation_controller(); + m_layerTreeHost->root_layer()->layer_animation_controller(); Animation* animation = controller->GetAnimation(0, Animation::Opacity); if (!animation) @@ -297,12 +297,12 @@ class LayerTreeHostAnimationTestSynchronizeAnimationStartTimes : } virtual void beginTest() OVERRIDE { - postAddAnimationToMainThread(m_layerTreeHost->rootLayer()); + postAddAnimationToMainThread(m_layerTreeHost->root_layer()); } virtual void notifyAnimationStarted(double time) OVERRIDE { LayerAnimationController* controller = - m_layerTreeHost->rootLayer()->layer_animation_controller(); + m_layerTreeHost->root_layer()->layer_animation_controller(); Animation* animation = controller->GetAnimation(0, Animation::Opacity); main_start_time_ = animation->start_time(); @@ -352,7 +352,7 @@ class LayerTreeHostAnimationTestAnimationFinishedEvents : virtual void notifyAnimationFinished(double time) OVERRIDE { LayerAnimationController* controller = - m_layerTreeHost->rootLayer()->layer_animation_controller(); + m_layerTreeHost->root_layer()->layer_animation_controller(); Animation* animation = controller->GetAnimation(0, Animation::Opacity); if (animation) @@ -376,8 +376,8 @@ class LayerTreeHostAnimationTestDoNotSkipLayersWithAnimatedOpacity : } virtual void setupTree() OVERRIDE { - update_check_layer_->SetOpacity(0); - m_layerTreeHost->setRootLayer(update_check_layer_); + update_check_layer_->SetOpacity(0.f); + m_layerTreeHost->SetRootLayer(update_check_layer_); LayerTreeHostAnimationTest::setupTree(); } @@ -418,7 +418,7 @@ class LayerTreeHostAnimationTestLayerAddedWithAnimation : } virtual void didCommit() OVERRIDE { - if (m_layerTreeHost->commitNumber() == 1) { + if (m_layerTreeHost->commit_number() == 1) { scoped_refptr<Layer> layer = Layer::Create(); layer->set_layer_animation_delegate(this); @@ -430,7 +430,7 @@ class LayerTreeHostAnimationTestLayerAddedWithAnimation : layer->layer_animation_controller()->AddAnimation(animation.Pass()); // We add the animation *before* attaching the layer to the tree. - m_layerTreeHost->rootLayer()->AddChild(layer); + m_layerTreeHost->root_layer()->AddChild(layer); } } @@ -456,7 +456,7 @@ class LayerTreeHostAnimationTestCompositeAndReadbackAnimateCount : virtual void animate(base::TimeTicks) OVERRIDE { // We shouldn't animate on the compositeAndReadback-forced commit, but we // should for the setNeedsCommit-triggered commit. - animated_commit_ = m_layerTreeHost->commitNumber(); + animated_commit_ = m_layerTreeHost->commit_number(); EXPECT_NE(2, animated_commit_); } @@ -465,13 +465,13 @@ class LayerTreeHostAnimationTestCompositeAndReadbackAnimateCount : } virtual void didCommit() OVERRIDE { - switch (m_layerTreeHost->commitNumber()) { + switch (m_layerTreeHost->commit_number()) { case 1: - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); break; case 2: { char pixels[4]; - m_layerTreeHost->compositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); + m_layerTreeHost->CompositeAndReadback(&pixels, gfx::Rect(0, 0, 1, 1)); break; } case 3: @@ -511,11 +511,11 @@ class LayerTreeHostAnimationTestContinuousAnimate : virtual void animate(base::TimeTicks) OVERRIDE { if (num_draw_layers_ == 2) return; - m_layerTreeHost->setNeedsAnimate(); + m_layerTreeHost->SetNeedsAnimate(); } virtual void layout() OVERRIDE { - m_layerTreeHost->rootLayer()->SetNeedsDisplay(); + m_layerTreeHost->root_layer()->SetNeedsDisplay(); } virtual void commitCompleteOnThread(LayerTreeHostImpl*) OVERRIDE { diff --git a/cc/layer_tree_host_unittest_context.cc b/cc/layer_tree_host_unittest_context.cc index d13074a..cdb4b58 100644 --- a/cc/layer_tree_host_unittest_context.cc +++ b/cc/layer_tree_host_unittest_context.cc @@ -266,7 +266,7 @@ class LayerTreeHostContextTestLostContextSucceeds : } virtual void InvalidateAndSetNeedsCommit() { - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); } bool NextTestCase() { @@ -409,7 +409,7 @@ class LayerTreeHostContextTestLostContextSucceedsWithContent : root_->AddChild(content_); - m_layerTreeHost->setRootLayer(root_); + m_layerTreeHost->SetRootLayer(root_); LayerTreeHostContextTest::setupTree(); } @@ -508,7 +508,7 @@ class LayerTreeHostContextTestOffscreenContextFails root_->AddChild(content_); - m_layerTreeHost->setRootLayer(root_); + m_layerTreeHost->SetRootLayer(root_); LayerTreeHostContextTest::setupTree(); } @@ -630,7 +630,7 @@ class LayerTreeHostContextTestFinishAllRenderingAfterLoss : virtual void didRecreateOutputSurface(bool succeeded) OVERRIDE { EXPECT_FALSE(succeeded); - m_layerTreeHost->finishAllRendering(); + m_layerTreeHost->FinishAllRendering(); endTest(); } @@ -652,7 +652,7 @@ class LayerTreeHostContextTestLostContextAndEvictTextures : virtual void setupTree() OVERRIDE { layer_->SetBounds(gfx::Size(10, 20)); - m_layerTreeHost->setRootLayer(layer_); + m_layerTreeHost->SetRootLayer(layer_); LayerTreeHostContextTest::setupTree(); } @@ -765,7 +765,7 @@ class LayerTreeHostContextTestLostContextWhileUpdatingResources : parent_->AddChild(child); } - m_layerTreeHost->setRootLayer(parent_); + m_layerTreeHost->SetRootLayer(parent_); LayerTreeHostContextTest::setupTree(); } @@ -812,7 +812,7 @@ class LayerTreeHostContextTestLayersNotified : root_->AddChild(child_); child_->AddChild(grandchild_); - m_layerTreeHost->setRootLayer(root_); + m_layerTreeHost->SetRootLayer(root_); LayerTreeHostContextTest::setupTree(); } @@ -955,7 +955,7 @@ class LayerTreeHostContextTestDontUseLostResources : // Enable the hud. LayerTreeDebugState debug_state; debug_state.showPropertyChangedRects = true; - m_layerTreeHost->setDebugState(debug_state); + m_layerTreeHost->SetDebugState(debug_state); bool paint_scrollbar = true; bool has_thumb = true; @@ -971,7 +971,7 @@ class LayerTreeHostContextTestDontUseLostResources : scrollbar_->SetIsDrawable(true); root_->AddChild(scrollbar_); - m_layerTreeHost->setRootLayer(root_); + m_layerTreeHost->SetRootLayer(root_); LayerTreeHostContextTest::setupTree(); } @@ -1060,12 +1060,12 @@ class LayerTreeHostContextTestDontUseLostResources : } virtual void didCommitAndDrawFrame() OVERRIDE { - ASSERT_TRUE(m_layerTreeHost->hudLayer()); + ASSERT_TRUE(m_layerTreeHost->hud_layer()); // End the test once we know the 3nd frame drew. - if (m_layerTreeHost->commitNumber() == 4) + if (m_layerTreeHost->commit_number() == 4) endTest(); else - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); } virtual void afterTest() OVERRIDE {} @@ -1152,7 +1152,7 @@ class LayerTreeHostContextTestImplSidePainting : picture->SetIsDrawable(true); root->AddChild(picture); - m_layerTreeHost->setRootLayer(root); + m_layerTreeHost->SetRootLayer(root); LayerTreeHostContextTest::setupTree(); } @@ -1183,8 +1183,8 @@ class ScrollbarLayerLostContext : public LayerTreeHostContextTest { scrollbar_layer_ = FakeScrollbarLayer::Create( false, true, scroll_layer->id()); scrollbar_layer_->SetBounds(gfx::Size(10, 100)); - m_layerTreeHost->rootLayer()->AddChild(scrollbar_layer_); - m_layerTreeHost->rootLayer()->AddChild(scroll_layer); + m_layerTreeHost->root_layer()->AddChild(scrollbar_layer_); + m_layerTreeHost->root_layer()->AddChild(scroll_layer); postSetNeedsCommitToMainThread(); } diff --git a/cc/layer_tree_host_unittest_delegated.cc b/cc/layer_tree_host_unittest_delegated.cc index 3fb48a0..e856e6d 100644 --- a/cc/layer_tree_host_unittest_delegated.cc +++ b/cc/layer_tree_host_unittest_delegated.cc @@ -79,7 +79,7 @@ class LayerTreeHostDelegatedTestCaseSingleDelegatedLayer delegated_->SetIsDrawable(true); root_->AddChild(delegated_); - m_layerTreeHost->setRootLayer(root_); + m_layerTreeHost->SetRootLayer(root_); LayerTreeHostDelegatedTest::setupTree(); } @@ -164,7 +164,7 @@ class LayerTreeHostDelegatedTestLayerUsesFrameDamage first_draw_for_source_frame_(true) {} virtual void didCommit() OVERRIDE { - int next_source_frame_number = m_layerTreeHost->commitNumber(); + int next_source_frame_number = m_layerTreeHost->commit_number(); switch (next_source_frame_number) { case 1: // The first time the layer gets a frame the whole layer should be @@ -183,7 +183,7 @@ class LayerTreeHostDelegatedTestLayerUsesFrameDamage break; case 3: // Should create zero damage. - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); break; case 4: // Should damage the full viewport. @@ -191,7 +191,7 @@ class LayerTreeHostDelegatedTestLayerUsesFrameDamage break; case 5: // Should create zero damage. - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); break; case 6: // Should damage the full layer. @@ -201,7 +201,7 @@ class LayerTreeHostDelegatedTestLayerUsesFrameDamage break; case 7: // Should create zero damage. - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); break; case 8: // Should damage the full layer. @@ -209,7 +209,7 @@ class LayerTreeHostDelegatedTestLayerUsesFrameDamage break; case 9: // Should create zero damage. - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); break; case 10: // Setting an empty frame should damage the whole layer the @@ -235,7 +235,7 @@ class LayerTreeHostDelegatedTestLayerUsesFrameDamage break; case 14: // Should create zero damage. - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); break; } first_draw_for_source_frame_ = true; @@ -438,7 +438,7 @@ class LayerTreeHostDelegatedTestReturnUnusedResources scoped_ptr<DelegatedFrameData> frame; TransferableResourceArray resources; - int next_source_frame_number = m_layerTreeHost->commitNumber(); + int next_source_frame_number = m_layerTreeHost->commit_number(); switch (next_source_frame_number) { case 1: // Generate a frame with two resources in it. @@ -508,7 +508,7 @@ class LayerTreeHostDelegatedTestReusedResources scoped_ptr<DelegatedFrameData> frame; TransferableResourceArray resources; - int next_source_frame_number = m_layerTreeHost->commitNumber(); + int next_source_frame_number = m_layerTreeHost->commit_number(); switch (next_source_frame_number) { case 1: // Generate a frame with some resources in it. @@ -567,7 +567,7 @@ class LayerTreeHostDelegatedTestFrameBeforeAck scoped_ptr<DelegatedFrameData> frame; TransferableResourceArray resources; - int next_source_frame_number = m_layerTreeHost->commitNumber(); + int next_source_frame_number = m_layerTreeHost->commit_number(); switch (next_source_frame_number) { case 1: // Generate a frame with some resources in it. @@ -664,7 +664,7 @@ class LayerTreeHostDelegatedTestFrameBeforeTakeResources scoped_ptr<DelegatedFrameData> frame; TransferableResourceArray resources; - int next_source_frame_number = m_layerTreeHost->commitNumber(); + int next_source_frame_number = m_layerTreeHost->commit_number(); switch (next_source_frame_number) { case 1: // Generate a frame with some resources in it. @@ -769,7 +769,7 @@ class LayerTreeHostDelegatedTestBadFrame scoped_ptr<DelegatedFrameData> frame; TransferableResourceArray resources; - int next_source_frame_number = m_layerTreeHost->commitNumber(); + int next_source_frame_number = m_layerTreeHost->commit_number(); switch (next_source_frame_number) { case 1: // Generate a frame with some resources in it. @@ -911,7 +911,7 @@ class LayerTreeHostDelegatedTestUnnamedResource scoped_ptr<DelegatedFrameData> frame; TransferableResourceArray resources; - int next_source_frame_number = m_layerTreeHost->commitNumber(); + int next_source_frame_number = m_layerTreeHost->commit_number(); switch (next_source_frame_number) { case 1: // This frame includes two resources in it, but only uses one. @@ -968,7 +968,7 @@ class LayerTreeHostDelegatedTestDontLeakResource scoped_ptr<DelegatedFrameData> frame; TransferableResourceArray resources; - int next_source_frame_number = m_layerTreeHost->commitNumber(); + int next_source_frame_number = m_layerTreeHost->commit_number(); switch (next_source_frame_number) { case 1: // This frame includes two resources in it. @@ -1025,7 +1025,7 @@ class LayerTreeHostDelegatedTestResourceSentToParent public: virtual void beginTest() OVERRIDE { // Prevent drawing with resources that are sent to the grandparent. - m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size()); + m_layerTreeHost->SetViewportSize(gfx::Size(10, 10), gfx::Size()); postSetNeedsCommitToMainThread(); } @@ -1033,7 +1033,7 @@ class LayerTreeHostDelegatedTestResourceSentToParent scoped_ptr<DelegatedFrameData> frame; TransferableResourceArray resources; - int next_source_frame_number = m_layerTreeHost->commitNumber(); + int next_source_frame_number = m_layerTreeHost->commit_number(); switch (next_source_frame_number) { case 1: // This frame includes two resources in it. @@ -1059,7 +1059,7 @@ class LayerTreeHostDelegatedTestResourceSentToParent delegated_->TakeUnusedResourcesForChildCompositor(&resources); EXPECT_EQ(0u, resources.size()); - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); break; case 4: // 999 was returned from the grandparent and could be released. @@ -1140,7 +1140,7 @@ class LayerTreeHostDelegatedTestCommitWithoutTake public: virtual void beginTest() OVERRIDE { // Prevent drawing with resources that are sent to the grandparent. - m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size()); + m_layerTreeHost->SetViewportSize(gfx::Size(10, 10), gfx::Size()); postSetNeedsCommitToMainThread(); } @@ -1148,7 +1148,7 @@ class LayerTreeHostDelegatedTestCommitWithoutTake scoped_ptr<DelegatedFrameData> frame; TransferableResourceArray resources; - int next_source_frame_number = m_layerTreeHost->commitNumber(); + int next_source_frame_number = m_layerTreeHost->commit_number(); switch (next_source_frame_number) { case 1: frame = CreateFrameData(gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1)); diff --git a/cc/layer_tree_host_unittest_occlusion.cc b/cc/layer_tree_host_unittest_occlusion.cc index 19fd89e..66f963e 100644 --- a/cc/layer_tree_host_unittest_occlusion.cc +++ b/cc/layer_tree_host_unittest_occlusion.cc @@ -64,7 +64,7 @@ class LayerTreeHostOcclusionTest : public ThreadedTest { } virtual void didCommit() OVERRIDE { - TestLayer* root = static_cast<TestLayer*>(m_layerTreeHost->rootLayer()); + TestLayer* root = static_cast<TestLayer*>(m_layerTreeHost->root_layer()); VerifyOcclusion(root); endTest(); @@ -129,7 +129,7 @@ class LayerTreeHostOcclusionTestOcclusionSurfaceClipping : child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); root_->set_expected_occlusion(gfx::Rect(10, 10, 10, 190)); - m_layerTreeHost->setRootLayer(root_); + m_layerTreeHost->SetRootLayer(root_); ThreadedTest::setupTree(); } }; @@ -159,7 +159,7 @@ class LayerTreeHostOcclusionTestOcclusionSurfaceClippingOpaque : child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); root_->set_expected_occlusion(gfx::Rect(10, 10, 190, 190)); - m_layerTreeHost->setRootLayer(root_); + m_layerTreeHost->SetRootLayer(root_); ThreadedTest::setupTree(); } }; @@ -192,7 +192,7 @@ class LayerTreeHostOcclusionTestOcclusionTwoChildren : child_->set_expected_occlusion(gfx::Rect(0, 0, 20, 190)); root_->set_expected_occlusion(gfx::Rect(10, 10, 20, 190)); - m_layerTreeHost->setRootLayer(root_); + m_layerTreeHost->SetRootLayer(root_); ThreadedTest::setupTree(); } }; @@ -226,7 +226,7 @@ class LayerTreeHostOcclusionTestOcclusionMask : child_->set_expected_occlusion(gfx::Rect(0, 0, 180, 180)); root_->set_expected_occlusion(gfx::Rect(10, 10, 190, 190)); - m_layerTreeHost->setRootLayer(root_); + m_layerTreeHost->SetRootLayer(root_); ThreadedTest::setupTree(); } }; @@ -261,7 +261,7 @@ class LayerTreeHostOcclusionTestOcclusionMaskBelowOcclusion : child_->set_expected_occlusion(gfx::Rect(0, 0, 20, 190)); root_->set_expected_occlusion(gfx::Rect(20, 10, 10, 190)); - m_layerTreeHost->setRootLayer(root_); + m_layerTreeHost->SetRootLayer(root_); ThreadedTest::setupTree(); } }; @@ -295,7 +295,7 @@ class LayerTreeHostOcclusionTestOcclusionOpacity : child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); root_->set_expected_occlusion(gfx::Rect(20, 10, 10, 190)); - m_layerTreeHost->setRootLayer(root_); + m_layerTreeHost->SetRootLayer(root_); ThreadedTest::setupTree(); } }; @@ -330,7 +330,7 @@ class LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion : child_->set_expected_occlusion(gfx::Rect(0, 0, 20, 190)); root_->set_expected_occlusion(gfx::Rect(20, 10, 10, 190)); - m_layerTreeHost->setRootLayer(root_); + m_layerTreeHost->SetRootLayer(root_); ThreadedTest::setupTree(); } }; @@ -374,7 +374,7 @@ class LayerTreeHostOcclusionTestOcclusionOpacityFilter : gfx::Rect(10, 330, 160, 170), gfx::Rect(40, 500, 130, 20))); root_->set_expected_occlusion(gfx::Rect(10, 70, 190, 130)); - m_layerTreeHost->setRootLayer(root_); + m_layerTreeHost->SetRootLayer(root_); ThreadedTest::setupTree(); } }; @@ -416,7 +416,7 @@ class LayerTreeHostOcclusionTestOcclusionBlurFilter : child_->set_expected_occlusion(gfx::Rect(10, 330, 160, 170)); root_->set_expected_occlusion(gfx::Rect(10, 70, 190, 130)); - m_layerTreeHost->setRootLayer(root_); + m_layerTreeHost->SetRootLayer(root_); ThreadedTest::setupTree(); } }; @@ -465,7 +465,7 @@ class LayerTreeHostOcclusionTestManySurfaces : layers[i]->set_expected_occlusion(expected_occlusion); } - m_layerTreeHost->setRootLayer(layers[0].get()); + m_layerTreeHost->SetRootLayer(layers[0]); ThreadedTest::setupTree(); } }; diff --git a/cc/layer_tree_host_unittest_scroll.cc b/cc/layer_tree_host_unittest_scroll.cc index f52b41e..28fd4fb 100644 --- a/cc/layer_tree_host_unittest_scroll.cc +++ b/cc/layer_tree_host_unittest_scroll.cc @@ -31,14 +31,14 @@ class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest { } virtual void beginTest() OVERRIDE { - m_layerTreeHost->rootLayer()->SetScrollable(true); - m_layerTreeHost->rootLayer()->SetScrollOffset(initial_scroll_); + m_layerTreeHost->root_layer()->SetScrollable(true); + m_layerTreeHost->root_layer()->SetScrollOffset(initial_scroll_); postSetNeedsCommitToMainThread(); } virtual void layout() OVERRIDE { - Layer* root = m_layerTreeHost->rootLayer(); - if (!m_layerTreeHost->commitNumber()) + Layer* root = m_layerTreeHost->root_layer(); + if (!m_layerTreeHost->commit_number()) EXPECT_VECTOR_EQ(initial_scroll_, root->scroll_offset()); else { EXPECT_VECTOR_EQ(initial_scroll_ + scroll_amount_, root->scroll_offset()); @@ -72,8 +72,8 @@ class LayerTreeHostScrollTestScrollSimple : public LayerTreeHostScrollTest { virtual void applyScrollAndScale( gfx::Vector2d scroll_delta, float scale) OVERRIDE { - gfx::Vector2d offset = m_layerTreeHost->rootLayer()->scroll_offset(); - m_layerTreeHost->rootLayer()->SetScrollOffset(offset + scroll_delta); + gfx::Vector2d offset = m_layerTreeHost->root_layer()->scroll_offset(); + m_layerTreeHost->root_layer()->SetScrollOffset(offset + scroll_delta); num_scrolls_++; } @@ -100,14 +100,14 @@ class LayerTreeHostScrollTestScrollMultipleRedraw : } virtual void beginTest() OVERRIDE { - m_layerTreeHost->rootLayer()->SetScrollable(true); - m_layerTreeHost->rootLayer()->SetScrollOffset(initial_scroll_); + m_layerTreeHost->root_layer()->SetScrollable(true); + m_layerTreeHost->root_layer()->SetScrollOffset(initial_scroll_); postSetNeedsCommitToMainThread(); } virtual void beginCommitOnThread(LayerTreeHostImpl* impl) OVERRIDE { - Layer* root = m_layerTreeHost->rootLayer(); - switch (m_layerTreeHost->commitNumber()) { + Layer* root = m_layerTreeHost->root_layer(); + switch (m_layerTreeHost->commit_number()) { case 0: EXPECT_VECTOR_EQ(root->scroll_offset(), initial_scroll_); break; @@ -159,8 +159,8 @@ class LayerTreeHostScrollTestScrollMultipleRedraw : virtual void applyScrollAndScale( gfx::Vector2d scroll_delta, float scale) OVERRIDE { - gfx::Vector2d offset = m_layerTreeHost->rootLayer()->scroll_offset(); - m_layerTreeHost->rootLayer()->SetScrollOffset(offset + scroll_delta); + gfx::Vector2d offset = m_layerTreeHost->root_layer()->scroll_offset(); + m_layerTreeHost->root_layer()->SetScrollOffset(offset + scroll_delta); num_scrolls_++; } @@ -182,7 +182,7 @@ class LayerTreeHostScrollTestFractionalScroll : public LayerTreeHostScrollTest { } virtual void beginTest() OVERRIDE { - m_layerTreeHost->rootLayer()->SetScrollable(true); + m_layerTreeHost->root_layer()->SetScrollable(true); postSetNeedsCommitToMainThread(); } @@ -222,8 +222,8 @@ class LayerTreeHostScrollTestFractionalScroll : public LayerTreeHostScrollTest { virtual void applyScrollAndScale( gfx::Vector2d scroll_delta, float scale) OVERRIDE { - gfx::Vector2d offset = m_layerTreeHost->rootLayer()->scroll_offset(); - m_layerTreeHost->rootLayer()->SetScrollOffset(offset + scroll_delta); + gfx::Vector2d offset = m_layerTreeHost->root_layer()->scroll_offset(); + m_layerTreeHost->root_layer()->SetScrollOffset(offset + scroll_delta); } virtual void afterTest() OVERRIDE {} @@ -249,7 +249,7 @@ class LayerTreeHostScrollTestCaseWithChild : } virtual void setupTree() OVERRIDE { - m_layerTreeHost->setDeviceScaleFactor(device_scale_factor_); + m_layerTreeHost->SetDeviceScaleFactor(device_scale_factor_); scoped_refptr<Layer> root_layer = Layer::Create(); root_layer->SetBounds(gfx::Size(10, 10)); @@ -290,7 +290,7 @@ class LayerTreeHostScrollTestCaseWithChild : expected_scroll_layer_->SetScrollOffset(initial_offset_); - m_layerTreeHost->setRootLayer(root_layer); + m_layerTreeHost->SetRootLayer(root_layer); LayerTreeHostScrollTest::setupTree(); } @@ -313,7 +313,7 @@ class LayerTreeHostScrollTestCaseWithChild : EXPECT_VECTOR_EQ( gfx::Vector2d(), expected_no_scroll_layer_->scroll_offset()); - switch (m_layerTreeHost->commitNumber()) { + switch (m_layerTreeHost->commit_number()) { case 0: EXPECT_VECTOR_EQ( initial_offset_, @@ -515,14 +515,14 @@ class ImplSidePaintingScrollTestSimple : public ImplSidePaintingScrollTest { } virtual void beginTest() OVERRIDE { - m_layerTreeHost->rootLayer()->SetScrollable(true); - m_layerTreeHost->rootLayer()->SetScrollOffset(initial_scroll_); + m_layerTreeHost->root_layer()->SetScrollable(true); + m_layerTreeHost->root_layer()->SetScrollOffset(initial_scroll_); postSetNeedsCommitToMainThread(); } virtual void layout() OVERRIDE { - Layer* root = m_layerTreeHost->rootLayer(); - if (!m_layerTreeHost->commitNumber()) + Layer* root = m_layerTreeHost->root_layer(); + if (!m_layerTreeHost->commit_number()) EXPECT_VECTOR_EQ(root->scroll_offset(), initial_scroll_); else { EXPECT_VECTOR_EQ(root->scroll_offset(), initial_scroll_ + impl_thread_scroll1_); @@ -598,8 +598,8 @@ class ImplSidePaintingScrollTestSimple : public ImplSidePaintingScrollTest { virtual void applyScrollAndScale( gfx::Vector2d scroll_delta, float scale) OVERRIDE { - gfx::Vector2d offset = m_layerTreeHost->rootLayer()->scroll_offset(); - m_layerTreeHost->rootLayer()->SetScrollOffset(offset + scroll_delta); + gfx::Vector2d offset = m_layerTreeHost->root_layer()->scroll_offset(); + m_layerTreeHost->root_layer()->SetScrollOffset(offset + scroll_delta); num_scrolls_++; } diff --git a/cc/layer_tree_impl.cc b/cc/layer_tree_impl.cc index 1af316d..8840c19 100644 --- a/cc/layer_tree_impl.cc +++ b/cc/layer_tree_impl.cc @@ -427,7 +427,7 @@ LayerImpl* LayerTreeImpl::FindPendingTreeLayerById(int id) { } int LayerTreeImpl::MaxTextureSize() const { - return layer_tree_host_impl_->rendererCapabilities().maxTextureSize; + return layer_tree_host_impl_->rendererCapabilities().max_texture_size; } bool LayerTreeImpl::PinchGestureActive() const { diff --git a/cc/layer_unittest.cc b/cc/layer_unittest.cc index 847288f..816ea9e 100644 --- a/cc/layer_unittest.cc +++ b/cc/layer_unittest.cc @@ -26,13 +26,13 @@ using ::testing::StrictMock; using ::testing::_; #define EXPECT_SET_NEEDS_COMMIT(expect, codeToTest) do { \ - EXPECT_CALL(*layer_tree_host_, setNeedsCommit()).Times((expect)); \ + EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times((expect)); \ codeToTest; \ Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \ } while (0) #define EXPECT_SET_NEEDS_FULL_TREE_SYNC(expect, codeToTest) do { \ - EXPECT_CALL(*layer_tree_host_, setNeedsFullTreeSync()).Times((expect)); \ + EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times((expect)); \ codeToTest; \ Mock::VerifyAndClearExpectations(layer_tree_host_.get()); \ } while (0) @@ -46,11 +46,11 @@ public: MockLayerImplTreeHost() : LayerTreeHost(&m_fakeClient, LayerTreeSettings()) { - initialize(scoped_ptr<Thread>(NULL)); + Initialize(scoped_ptr<Thread>(NULL)); } - MOCK_METHOD0(setNeedsCommit, void()); - MOCK_METHOD0(setNeedsFullTreeSync, void()); + MOCK_METHOD0(SetNeedsCommit, void()); + MOCK_METHOD0(SetNeedsFullTreeSync, void()); private: FakeLayerImplTreeHostClient m_fakeClient; @@ -78,7 +78,7 @@ protected: virtual void TearDown() { Mock::VerifyAndClearExpectations(layer_tree_host_.get()); - EXPECT_CALL(*layer_tree_host_, setNeedsFullTreeSync()).Times(AnyNumber()); + EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber()); parent_ = NULL; m_child1 = NULL; m_child2 = NULL; @@ -87,7 +87,7 @@ protected: m_grandChild2 = NULL; m_grandChild3 = NULL; - layer_tree_host_->setRootLayer(0); + layer_tree_host_->SetRootLayer(NULL); layer_tree_host_.reset(); } @@ -124,8 +124,8 @@ protected: m_grandChild2 = Layer::Create(); m_grandChild3 = Layer::Create(); - EXPECT_CALL(*layer_tree_host_, setNeedsFullTreeSync()).Times(AnyNumber()); - layer_tree_host_->setRootLayer(parent_); + EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber()); + layer_tree_host_->SetRootLayer(parent_); parent_->AddChild(m_child1); parent_->AddChild(m_child2); @@ -157,7 +157,7 @@ TEST_F(LayerTest, basicCreateAndDestroy) scoped_refptr<Layer> testLayer = Layer::Create(); ASSERT_TRUE(testLayer); - EXPECT_CALL(*layer_tree_host_, setNeedsCommit()).Times(0); + EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(0); testLayer->SetLayerTreeHost(layer_tree_host_.get()); } @@ -170,7 +170,7 @@ TEST_F(LayerTest, addAndRemoveChild) ASSERT_EQ(0U, parent->children().size()); EXPECT_FALSE(child->parent()); - EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->setRootLayer(parent)); + EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(parent)); EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, parent->AddChild(child)); ASSERT_EQ(1U, parent->children().size()); @@ -183,12 +183,12 @@ TEST_F(LayerTest, addAndRemoveChild) TEST_F(LayerTest, addSameChildTwice) { - EXPECT_CALL(*layer_tree_host_, setNeedsFullTreeSync()).Times(AtLeast(1)); + EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AtLeast(1)); scoped_refptr<Layer> parent = Layer::Create(); scoped_refptr<Layer> child = Layer::Create(); - layer_tree_host_->setRootLayer(parent); + layer_tree_host_->SetRootLayer(parent); ASSERT_EQ(0u, parent->children().size()); @@ -244,7 +244,7 @@ TEST_F(LayerTest, insertChild) EXPECT_EQ(child4, parent->children()[3]); EXPECT_EQ(parent.get(), child4->parent()); - EXPECT_CALL(*layer_tree_host_, setNeedsFullTreeSync()).Times(AtLeast(1)); + EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AtLeast(1)); } TEST_F(LayerTest, insertChildPastEndOfList) @@ -294,7 +294,7 @@ TEST_F(LayerTest, insertSameChildTwice) EXPECT_EQ(child2, parent->children()[0]); EXPECT_EQ(child1, parent->children()[1]); - EXPECT_CALL(*layer_tree_host_, setNeedsFullTreeSync()).Times(AtLeast(1)); + EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AtLeast(1)); } TEST_F(LayerTest, replaceChildWithNewChild) @@ -376,9 +376,9 @@ TEST_F(LayerTest, replaceChildWithSameChild) { createSimpleTestTree(); - // setNeedsFullTreeSync / setNeedsCommit should not be called because its the same child - EXPECT_CALL(*layer_tree_host_, setNeedsCommit()).Times(0); - EXPECT_CALL(*layer_tree_host_, setNeedsFullTreeSync()).Times(0); + // SetNeedsFullTreeSync / SetNeedsCommit should not be called because its the same child + EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(0); + EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(0); parent_->ReplaceChild(m_child2.get(), m_child2); verifyTestTreeInitialState(); @@ -422,15 +422,15 @@ TEST_F(LayerTest, setChildren) EXPECT_EQ(newParent.get(), child1->parent()); EXPECT_EQ(newParent.get(), child2->parent()); - EXPECT_CALL(*layer_tree_host_, setNeedsFullTreeSync()).Times(AtLeast(1)); + EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AtLeast(1)); } TEST_F(LayerTest, getRootLayerAfterTreeManipulations) { createSimpleTestTree(); - // For this test we don't care about setNeedsFullTreeSync calls. - EXPECT_CALL(*layer_tree_host_, setNeedsFullTreeSync()).Times(AnyNumber()); + // For this test we don't care about SetNeedsFullTreeSync calls. + EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times(AnyNumber()); scoped_refptr<Layer> child4 = Layer::Create(); @@ -483,7 +483,7 @@ TEST_F(LayerTest, checkSetNeedsDisplayCausesCorrectBehavior) { // The semantics for setNeedsDisplay which are tested here: // 1. sets needsDisplay flag appropriately. - // 2. indirectly calls setNeedsCommit, exactly once for each call to setNeedsDisplay. + // 2. indirectly calls SetNeedsCommit, exactly once for each call to setNeedsDisplay. scoped_refptr<Layer> testLayer = Layer::Create(); testLayer->SetLayerTreeHost(layer_tree_host_.get()); @@ -499,7 +499,7 @@ TEST_F(LayerTest, checkSetNeedsDisplayCausesCorrectBehavior) // Before anything, testLayer should not be dirty. EXPECT_FALSE(testLayer->NeedsDisplayForTesting()); - // This is just initialization, but setNeedsCommit behavior is verified anyway to avoid warnings. + // This is just initialization, but SetNeedsCommit behavior is verified anyway to avoid warnings. EXPECT_SET_NEEDS_COMMIT(1, testLayer->SetBounds(testBounds)); EXPECT_TRUE(testLayer->NeedsDisplayForTesting()); @@ -541,8 +541,8 @@ TEST_F(LayerTest, checkPropertyChangeCausesCorrectBehavior) // sanity check of initial test condition EXPECT_FALSE(testLayer->NeedsDisplayForTesting()); - // Next, test properties that should call setNeedsCommit (but not setNeedsDisplay) - // All properties need to be set to new values in order for setNeedsCommit to be called. + // Next, test properties that should call SetNeedsCommit (but not setNeedsDisplay) + // All properties need to be set to new values in order for SetNeedsCommit to be called. EXPECT_SET_NEEDS_COMMIT(1, testLayer->SetAnchorPoint(gfx::PointF(1.23f, 4.56f))); EXPECT_SET_NEEDS_COMMIT(1, testLayer->SetAnchorPointZ(0.7f)); EXPECT_SET_NEEDS_COMMIT(1, testLayer->SetBackgroundColor(SK_ColorLTGRAY)); @@ -569,7 +569,7 @@ TEST_F(LayerTest, checkPropertyChangeCausesCorrectBehavior) EXPECT_FALSE(testLayer->NeedsDisplayForTesting()); // As layers are removed from the tree, they will cause a tree sync. - EXPECT_CALL(*layer_tree_host_, setNeedsFullTreeSync()).Times((AnyNumber())); + EXPECT_CALL(*layer_tree_host_, SetNeedsFullTreeSync()).Times((AnyNumber())); } TEST_F(LayerTest, setBoundsTriggersSetNeedsRedrawAfterGettingNonEmptyBounds) @@ -685,14 +685,14 @@ public: { scoped_ptr<FakeLayerImplTreeHost> host(new FakeLayerImplTreeHost(LayerTreeSettings())); // The initialize call will fail, since our client doesn't provide a valid GraphicsContext3D, but it doesn't matter in the tests that use this fake so ignore the return value. - host->initialize(scoped_ptr<Thread>(NULL)); + host->Initialize(scoped_ptr<Thread>(NULL)); return host.Pass(); } static scoped_ptr<FakeLayerImplTreeHost> Create(LayerTreeSettings settings) { scoped_ptr<FakeLayerImplTreeHost> host(new FakeLayerImplTreeHost(settings)); - host->initialize(scoped_ptr<Thread>(NULL)); + host->Initialize(scoped_ptr<Thread>(NULL)); return host.Pass(); } @@ -737,12 +737,12 @@ TEST(LayerLayerTreeHostTest, enteringTree) scoped_ptr<FakeLayerImplTreeHost> layerTreeHost(FakeLayerImplTreeHost::Create()); // Setting the root layer should set the host pointer for all layers in the tree. - layerTreeHost->setRootLayer(parent.get()); + layerTreeHost->SetRootLayer(parent.get()); assertLayerTreeHostMatchesForSubtree(parent.get(), layerTreeHost.get()); // Clearing the root layer should also clear out the host pointers for all layers in the tree. - layerTreeHost->setRootLayer(NULL); + layerTreeHost->SetRootLayer(NULL); assertLayerTreeHostMatchesForSubtree(parent.get(), 0); } @@ -752,7 +752,7 @@ TEST(LayerLayerTreeHostTest, addingLayerSubtree) scoped_refptr<Layer> parent = Layer::Create(); scoped_ptr<FakeLayerImplTreeHost> layerTreeHost(FakeLayerImplTreeHost::Create()); - layerTreeHost->setRootLayer(parent.get()); + layerTreeHost->SetRootLayer(parent.get()); EXPECT_EQ(parent->layer_tree_host(), layerTreeHost.get()); @@ -772,7 +772,7 @@ TEST(LayerLayerTreeHostTest, addingLayerSubtree) parent->AddChild(child); assertLayerTreeHostMatchesForSubtree(parent.get(), layerTreeHost.get()); - layerTreeHost->setRootLayer(0); + layerTreeHost->SetRootLayer(NULL); } TEST(LayerLayerTreeHostTest, changeHost) @@ -790,18 +790,18 @@ TEST(LayerLayerTreeHostTest, changeHost) replica->SetMaskLayer(replicaMask.get()); scoped_ptr<FakeLayerImplTreeHost> firstLayerTreeHost(FakeLayerImplTreeHost::Create()); - firstLayerTreeHost->setRootLayer(parent.get()); + firstLayerTreeHost->SetRootLayer(parent.get()); assertLayerTreeHostMatchesForSubtree(parent.get(), firstLayerTreeHost.get()); // Now re-root the tree to a new host (simulating what we do on a context lost event). // This should update the host pointers for all layers in the tree. scoped_ptr<FakeLayerImplTreeHost> secondLayerTreeHost(FakeLayerImplTreeHost::Create()); - secondLayerTreeHost->setRootLayer(parent.get()); + secondLayerTreeHost->SetRootLayer(parent.get()); assertLayerTreeHostMatchesForSubtree(parent.get(), secondLayerTreeHost.get()); - secondLayerTreeHost->setRootLayer(0); + secondLayerTreeHost->SetRootLayer(NULL); } TEST(LayerLayerTreeHostTest, changeHostInSubtree) @@ -818,13 +818,13 @@ TEST(LayerLayerTreeHostTest, changeHostInSubtree) firstParent->AddChild(secondChild); scoped_ptr<FakeLayerImplTreeHost> firstLayerTreeHost(FakeLayerImplTreeHost::Create()); - firstLayerTreeHost->setRootLayer(firstParent.get()); + firstLayerTreeHost->SetRootLayer(firstParent.get()); assertLayerTreeHostMatchesForSubtree(firstParent.get(), firstLayerTreeHost.get()); // Now reparent the subtree starting at secondChild to a layer in a different tree. scoped_ptr<FakeLayerImplTreeHost> secondLayerTreeHost(FakeLayerImplTreeHost::Create()); - secondLayerTreeHost->setRootLayer(secondParent.get()); + secondLayerTreeHost->SetRootLayer(secondParent.get()); secondParent->AddChild(secondChild); @@ -833,8 +833,8 @@ TEST(LayerLayerTreeHostTest, changeHostInSubtree) EXPECT_EQ(secondLayerTreeHost.get(), secondGrandChild->layer_tree_host()); // Test over, cleanup time. - firstLayerTreeHost->setRootLayer(0); - secondLayerTreeHost->setRootLayer(0); + firstLayerTreeHost->SetRootLayer(NULL); + secondLayerTreeHost->SetRootLayer(NULL); } TEST(LayerLayerTreeHostTest, replaceMaskAndReplicaLayer) @@ -853,7 +853,7 @@ TEST(LayerLayerTreeHostTest, replaceMaskAndReplicaLayer) replica->AddChild(replicaChild); scoped_ptr<FakeLayerImplTreeHost> layerTreeHost(FakeLayerImplTreeHost::Create()); - layerTreeHost->setRootLayer(parent.get()); + layerTreeHost->SetRootLayer(parent.get()); assertLayerTreeHostMatchesForSubtree(parent.get(), layerTreeHost.get()); @@ -868,7 +868,7 @@ TEST(LayerLayerTreeHostTest, replaceMaskAndReplicaLayer) EXPECT_EQ(0, replicaChild->layer_tree_host()); // Test over, cleanup time. - layerTreeHost->setRootLayer(0); + layerTreeHost->SetRootLayer(NULL); } TEST(LayerLayerTreeHostTest, destroyHostWithNonNullRootLayer) @@ -877,7 +877,7 @@ TEST(LayerLayerTreeHostTest, destroyHostWithNonNullRootLayer) scoped_refptr<Layer> child = Layer::Create(); root->AddChild(child); scoped_ptr<FakeLayerImplTreeHost> layerTreeHost(FakeLayerImplTreeHost::Create()); - layerTreeHost->setRootLayer(root); + layerTreeHost->SetRootLayer(root); } static bool addTestAnimation(Layer* layer) @@ -907,7 +907,7 @@ TEST(LayerLayerTreeHostTest, shouldNotAddAnimationWithoutAnimationRegistrar) LayerTreeSettings settings; settings.acceleratedAnimationEnabled = false; scoped_ptr<FakeLayerImplTreeHost> layerTreeHost(FakeLayerImplTreeHost::Create(settings)); - layerTreeHost->setRootLayer(layer.get()); + layerTreeHost->SetRootLayer(layer); layer->SetLayerTreeHost(layerTreeHost.get()); assertLayerTreeHostMatchesForSubtree(layer.get(), layerTreeHost.get()); diff --git a/cc/nine_patch_layer.cc b/cc/nine_patch_layer.cc index 263d9f0..69c4518 100644 --- a/cc/nine_patch_layer.cc +++ b/cc/nine_patch_layer.cc @@ -43,7 +43,7 @@ void NinePatchLayer::SetTexturePriorities( // FIXME: Need to support swizzle in the shader for // !PlatformColor::sameComponentOrder(texture_format) GLenum texture_format = - layer_tree_host()->rendererCapabilities().bestTextureFormat; + layer_tree_host()->GetRendererCapabilities().best_texture_format; resource_->texture()->setDimensions( gfx::Size(bitmap_.width(), bitmap_.height()), texture_format); } @@ -89,7 +89,7 @@ void NinePatchLayer::CreateResource() { if (!resource_) { resource_ = updater_->createResource( - layer_tree_host()->contentsTextureManager()); + layer_tree_host()->contents_texture_manager()); } } diff --git a/cc/nine_patch_layer_unittest.cc b/cc/nine_patch_layer_unittest.cc index 5d1c3f5..61c0b9f 100644 --- a/cc/nine_patch_layer_unittest.cc +++ b/cc/nine_patch_layer_unittest.cc @@ -33,7 +33,7 @@ public: MockLayerTreeHost() : LayerTreeHost(&m_fakeClient, LayerTreeSettings()) { - initialize(scoped_ptr<Thread>(NULL)); + Initialize(scoped_ptr<Thread>(NULL)); } private: @@ -70,11 +70,11 @@ TEST_F(NinePatchLayerTest, triggerFullUploadOnceWhenChangingBitmap) testLayer->SetIsDrawable(true); testLayer->SetBounds(gfx::Size(100, 100)); - layer_tree_host_->setRootLayer(testLayer); + layer_tree_host_->SetRootLayer(testLayer); Mock::VerifyAndClearExpectations(layer_tree_host_.get()); EXPECT_EQ(testLayer->layer_tree_host(), layer_tree_host_.get()); - layer_tree_host_->initializeRendererIfNeeded(); + layer_tree_host_->InitializeRendererIfNeeded(); PriorityCalculator calculator; ResourceUpdateQueue queue; @@ -99,8 +99,8 @@ TEST_F(NinePatchLayerTest, triggerFullUploadOnceWhenChangingBitmap) EXPECT_TRUE(params.texture != NULL); // Upload the texture. - layer_tree_host_->contentsTextureManager()->setMaxMemoryLimitBytes(1024 * 1024); - layer_tree_host_->contentsTextureManager()->prioritizeTextures(); + layer_tree_host_->contents_texture_manager()->setMaxMemoryLimitBytes(1024 * 1024); + layer_tree_host_->contents_texture_manager()->prioritizeTextures(); scoped_ptr<OutputSurface> outputSurface; scoped_ptr<ResourceProvider> resourceProvider; @@ -122,7 +122,7 @@ TEST_F(NinePatchLayerTest, triggerFullUploadOnceWhenChangingBitmap) { DebugScopedSetImplThread implThread(proxy()); DebugScopedSetMainThreadBlocked mainThreadBlocked(proxy()); - layer_tree_host_->contentsTextureManager()->clearAllMemory(resourceProvider.get()); + layer_tree_host_->contents_texture_manager()->clearAllMemory(resourceProvider.get()); } // Reupload after eviction @@ -132,7 +132,7 @@ TEST_F(NinePatchLayerTest, triggerFullUploadOnceWhenChangingBitmap) EXPECT_EQ(queue.partialUploadSize(), 0); // PrioritizedResourceManager clearing - layer_tree_host_->contentsTextureManager()->unregisterTexture(params.texture); + layer_tree_host_->contents_texture_manager()->unregisterTexture(params.texture); EXPECT_EQ(NULL, params.texture->resourceManager()); testLayer->SetTexturePriorities(calculator); ResourceUpdateQueue queue2; @@ -141,7 +141,7 @@ TEST_F(NinePatchLayerTest, triggerFullUploadOnceWhenChangingBitmap) EXPECT_EQ(queue2.partialUploadSize(), 0); params = queue2.takeFirstFullUpload(); EXPECT_TRUE(params.texture != NULL); - EXPECT_EQ(params.texture->resourceManager(), layer_tree_host_->contentsTextureManager()); + EXPECT_EQ(params.texture->resourceManager(), layer_tree_host_->contents_texture_manager()); } } // namespace diff --git a/cc/occlusion_tracker.h b/cc/occlusion_tracker.h index bd89a6c..8a4578d 100644 --- a/cc/occlusion_tracker.h +++ b/cc/occlusion_tracker.h @@ -78,8 +78,8 @@ class CC_EXPORT OcclusionTrackerBase { bool* has_occlusion_from_outside_target_surface) const; // Report operations for recording overdraw metrics. - class OverdrawMetrics& OverdrawMetrics() const { - return *overdraw_metrics_.get(); + OverdrawMetrics* overdraw_metrics() const { + return overdraw_metrics_.get(); } // Gives the region of the screen that is not occluded by something opaque. diff --git a/cc/overdraw_metrics.cc b/cc/overdraw_metrics.cc index 0ed58d1..f28258b 100644 --- a/cc/overdraw_metrics.cc +++ b/cc/overdraw_metrics.cc @@ -148,7 +148,7 @@ void OverdrawMetrics::RecordMetrics( } static gfx::Size DeviceViewportSize(const LayerTreeHost* host) { - return host->deviceViewportSize(); + return host->device_viewport_size(); } static gfx::Size DeviceViewportSize(const LayerTreeHostImpl* host_impl) { return host_impl->DeviceViewportSize(); diff --git a/cc/picture_layer.cc b/cc/picture_layer.cc index 7dc0342..10fd3e6 100644 --- a/cc/picture_layer.cc +++ b/cc/picture_layer.cc @@ -53,7 +53,7 @@ void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) { pile_->SetTileGridSize(host->settings().defaultTileSize); pile_->set_num_raster_threads(host->settings().numRasterThreads); pile_->set_slow_down_raster_scale_factor( - host->debugState().slowDownRasterScaleFactor); + host->debug_state().slowDownRasterScaleFactor); } } diff --git a/cc/picture_layer_impl.cc b/cc/picture_layer_impl.cc index 66f9ff3..28454f0 100644 --- a/cc/picture_layer_impl.cc +++ b/cc/picture_layer_impl.cc @@ -166,12 +166,12 @@ void PictureLayerImpl::AppendQuads(QuadSink* quadSink, SkColor color = DebugColors::DefaultCheckerboardColor(); quad->SetNew(sharedQuadState, geometry_rect, color); if (quadSink->append(quad.PassAs<DrawQuad>(), appendQuadsData)) - appendQuadsData->numMissingTiles++; + appendQuadsData->numMissingTiles++; } else { scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); quad->SetNew(sharedQuadState, geometry_rect, background_color()); if (quadSink->append(quad.PassAs<DrawQuad>(), appendQuadsData)) - appendQuadsData->numMissingTiles++; + appendQuadsData->numMissingTiles++; } appendQuadsData->hadIncompleteTile = true; @@ -383,7 +383,7 @@ gfx::Size PictureLayerImpl::CalculateTileSize( // we should avoid power-of-two textures. This helps reduce the number // of different textures sizes to help recycling, and also keeps all // textures multiple-of-eight, which is preferred on some drivers (IMG). - bool avoidPow2 = layer_tree_impl()->rendererCapabilities().avoidPow2Textures; + bool avoidPow2 = layer_tree_impl()->rendererCapabilities().avoid_pow2_textures; int roundUpTo = avoidPow2 ? 56 : 64; width = RoundUp(width, roundUpTo); height = RoundUp(height, roundUpTo); @@ -78,7 +78,7 @@ class CC_EXPORT Proxy { // Returns false if the renderer couldn't be reinitialized. virtual bool RecreateOutputSurface() = 0; - virtual void GetRenderingStats(RenderingStats* stats) = 0; + virtual void CollectRenderingStats(RenderingStats* stats) = 0; virtual const RendererCapabilities& GetRendererCapabilities() const = 0; diff --git a/cc/quad_culler.cc b/cc/quad_culler.cc index b3bfebd..4efd3f8 100644 --- a/cc/quad_culler.cc +++ b/cc/quad_culler.cc @@ -41,9 +41,9 @@ static inline bool appendQuadInternal(scoped_ptr<DrawQuad> drawQuad, const gfx:: if (keepQuad) drawQuad->visible_rect = culledRect; - occlusionTracker.OverdrawMetrics().DidCullForDrawing(drawQuad->quadTransform(), drawQuad->rect, culledRect); + occlusionTracker.overdraw_metrics()->DidCullForDrawing(drawQuad->quadTransform(), drawQuad->rect, culledRect); gfx::Rect opaqueDrawRect = drawQuad->opacity() == 1.0f ? drawQuad->opaque_rect : gfx::Rect(); - occlusionTracker.OverdrawMetrics().DidDraw(drawQuad->quadTransform(), culledRect, opaqueDrawRect); + occlusionTracker.overdraw_metrics()->DidDraw(drawQuad->quadTransform(), culledRect, opaqueDrawRect); if (keepQuad) { if (createDebugBorderQuads && !drawQuad->IsDebugQuad() && drawQuad->visible_rect != drawQuad->rect) { diff --git a/cc/quad_culler_unittest.cc b/cc/quad_culler_unittest.cc index bf54020..55749dc 100644 --- a/cc/quad_culler_unittest.cc +++ b/cc/quad_culler_unittest.cc @@ -124,9 +124,9 @@ TEST_F(QuadCullerTest, verifyNoCulling) appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 13u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 90000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 40000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 40000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); } TEST_F(QuadCullerTest, verifyCullChildLinesUpTopLeft) @@ -141,9 +141,9 @@ TEST_F(QuadCullerTest, verifyCullChildLinesUpTopLeft) appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 9u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 90000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 0, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 40000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 40000, 1); } TEST_F(QuadCullerTest, verifyCullWhenChildOpacityNotOne) @@ -158,9 +158,9 @@ TEST_F(QuadCullerTest, verifyCullWhenChildOpacityNotOne) appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 13u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 90000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 40000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 40000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); } TEST_F(QuadCullerTest, verifyCullWhenChildOpaqueFlagFalse) @@ -175,9 +175,9 @@ TEST_F(QuadCullerTest, verifyCullWhenChildOpaqueFlagFalse) appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 13u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 90000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 40000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 40000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); } TEST_F(QuadCullerTest, verifyCullCenterTileOnly) @@ -210,9 +210,9 @@ TEST_F(QuadCullerTest, verifyCullCenterTileOnly) EXPECT_EQ(quadVisibleRect6.height(), 50); EXPECT_EQ(quadVisibleRect6.y(), 250); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 100000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 0, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 30000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 100000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 30000, 1); } TEST_F(QuadCullerTest, verifyCullCenterTileNonIntegralSize1) @@ -238,9 +238,9 @@ TEST_F(QuadCullerTest, verifyCullCenterTileNonIntegralSize1) appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 2u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 20363, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 0, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 20363, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); } TEST_F(QuadCullerTest, verifyCullCenterTileNonIntegralSize2) @@ -266,9 +266,9 @@ TEST_F(QuadCullerTest, verifyCullCenterTileNonIntegralSize2) appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 2u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 19643, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 0, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 19643, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); } TEST_F(QuadCullerTest, verifyCullChildLinesUpBottomRight) @@ -285,9 +285,9 @@ TEST_F(QuadCullerTest, verifyCullChildLinesUpBottomRight) appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 9u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 90000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 0, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 40000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 40000, 1); } TEST_F(QuadCullerTest, verifyCullSubRegion) @@ -305,9 +305,9 @@ TEST_F(QuadCullerTest, verifyCullSubRegion) appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 12u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 90000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 30000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 10000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 30000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 10000, 1); } TEST_F(QuadCullerTest, verifyCullSubRegion2) @@ -325,9 +325,9 @@ TEST_F(QuadCullerTest, verifyCullSubRegion2) appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 12u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 90000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 25000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 15000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 25000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 15000, 1); } TEST_F(QuadCullerTest, verifyCullSubRegionCheckOvercull) @@ -345,9 +345,9 @@ TEST_F(QuadCullerTest, verifyCullSubRegionCheckOvercull) appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 13u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 90000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 30000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 10000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 90000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 30000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 10000, 1); } TEST_F(QuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude) @@ -365,9 +365,9 @@ TEST_F(QuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude) appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 13u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 130000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 0, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 130000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); } // This test requires some explanation: here we are rotating the quads to be culled. @@ -391,9 +391,9 @@ TEST_F(QuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled) appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 12u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 100600, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 0, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 29400, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 100600, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 29400, 1); } TEST_F(QuadCullerTest, verifyCullOutsideScissorOverTile) @@ -408,9 +408,9 @@ TEST_F(QuadCullerTest, verifyCullOutsideScissorOverTile) appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 1u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 10000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 0, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 120000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 10000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 120000, 1); } TEST_F(QuadCullerTest, verifyCullOutsideScissorOverCulledTile) @@ -425,9 +425,9 @@ TEST_F(QuadCullerTest, verifyCullOutsideScissorOverCulledTile) appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 1u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 10000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 0, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 120000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 10000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 120000, 1); } TEST_F(QuadCullerTest, verifyCullOutsideScissorOverPartialTiles) @@ -442,9 +442,9 @@ TEST_F(QuadCullerTest, verifyCullOutsideScissorOverPartialTiles) appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 9u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 40000, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 0, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 90000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 40000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 90000, 1); } TEST_F(QuadCullerTest, verifyCullOutsideScissorOverNoTiles) @@ -459,9 +459,9 @@ TEST_F(QuadCullerTest, verifyCullOutsideScissorOverNoTiles) appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 0u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 0, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 0, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 130000, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 130000, 1); } TEST_F(QuadCullerTest, verifyWithoutMetrics) @@ -476,9 +476,9 @@ TEST_F(QuadCullerTest, verifyWithoutMetrics) appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker); appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker); EXPECT_EQ(quadList.size(), 9u); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_opaque(), 0, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_drawn_translucent(), 0, 1); - EXPECT_NEAR(occlusionTracker.OverdrawMetrics().pixels_culled_for_drawing(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_opaque(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_drawn_translucent(), 0, 1); + EXPECT_NEAR(occlusionTracker.overdraw_metrics()->pixels_culled_for_drawing(), 0, 1); } } // namespace diff --git a/cc/scrollbar_layer.cc b/cc/scrollbar_layer.cc index 9debbf9..6d8d6ea 100644 --- a/cc/scrollbar_layer.cc +++ b/cc/scrollbar_layer.cc @@ -67,7 +67,7 @@ WebKit::WebScrollbar::Orientation ScrollbarLayer::Orientation() const { int ScrollbarLayer::MaxTextureSize() { DCHECK(layer_tree_host()); - return layer_tree_host()->rendererCapabilities().maxTextureSize; + return layer_tree_host()->GetRendererCapabilities().max_texture_size; } float ScrollbarLayer::ClampScaleToMaxTextureSize(float scale) { @@ -253,7 +253,8 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() { if (layer_tree_host()->settings().solidColorScrollbars) return; - texture_format_ = layer_tree_host()->rendererCapabilities().bestTextureFormat; + texture_format_ = + layer_tree_host()->GetRendererCapabilities().best_texture_format; if (!back_track_updater_) { back_track_updater_ = CachingBitmapContentLayerUpdater::Create( @@ -265,7 +266,7 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() { } if (!back_track_) { back_track_ = back_track_updater_->createResource( - layer_tree_host()->contentsTextureManager()); + layer_tree_host()->contents_texture_manager()); } // Only create two-part track if we think the two parts could be different in @@ -281,7 +282,7 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() { } if (!fore_track_) { fore_track_ = fore_track_updater_->createResource( - layer_tree_host()->contentsTextureManager()); + layer_tree_host()->contents_texture_manager()); } } @@ -293,7 +294,7 @@ void ScrollbarLayer::CreateUpdaterIfNeeded() { } if (!thumb_) { thumb_ = thumb_updater_->createResource( - layer_tree_host()->contentsTextureManager()); + layer_tree_host()->contents_texture_manager()); } } diff --git a/cc/scrollbar_layer_unittest.cc b/cc/scrollbar_layer_unittest.cc index 147fb58..bf37810 100644 --- a/cc/scrollbar_layer_unittest.cc +++ b/cc/scrollbar_layer_unittest.cc @@ -199,24 +199,24 @@ public: virtual void beginTest() OVERRIDE { - m_layerTreeHost->initializeRendererIfNeeded(); + m_layerTreeHost->InitializeRendererIfNeeded(); scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::Create()); m_scrollbarLayer = ScrollbarLayer::Create(scrollbar.Pass(), FakeScrollbarThemePainter::Create(false).PassAs<ScrollbarThemePainter>(), FakeWebScrollbarThemeGeometry::create(true), 1); m_scrollbarLayer->SetLayerTreeHost(m_layerTreeHost.get()); m_scrollbarLayer->SetBounds(bounds_); - m_layerTreeHost->rootLayer()->AddChild(m_scrollbarLayer); + m_layerTreeHost->root_layer()->AddChild(m_scrollbarLayer); m_scrollLayer = Layer::Create(); m_scrollbarLayer->SetScrollLayerId(m_scrollLayer->id()); - m_layerTreeHost->rootLayer()->AddChild(m_scrollLayer); + m_layerTreeHost->root_layer()->AddChild(m_scrollLayer); postSetNeedsCommitToMainThread(); } virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { - const int kMaxTextureSize = impl->rendererCapabilities().maxTextureSize; + const int kMaxTextureSize = impl->rendererCapabilities().max_texture_size; // Check first that we're actually testing something. EXPECT_GT(m_scrollbarLayer->bounds().width(), kMaxTextureSize); @@ -250,7 +250,7 @@ public: MockLayerTreeHost(const LayerTreeSettings& settings) : LayerTreeHost(&m_fakeClient, settings) { - initialize(scoped_ptr<Thread>(NULL)); + Initialize(scoped_ptr<Thread>(NULL)); } private: @@ -275,9 +275,9 @@ public: layerTreeRoot->AddChild(contentLayer); layerTreeRoot->AddChild(scrollbarLayer); - m_layerTreeHost->initializeRendererIfNeeded(); - m_layerTreeHost->contentsTextureManager()->setMaxMemoryLimitBytes(1024 * 1024); - m_layerTreeHost->setRootLayer(layerTreeRoot); + m_layerTreeHost->InitializeRendererIfNeeded(); + m_layerTreeHost->contents_texture_manager()->setMaxMemoryLimitBytes(1024 * 1024); + m_layerTreeHost->SetRootLayer(layerTreeRoot); scrollbarLayer->SetIsDrawable(true); scrollbarLayer->SetBounds(gfx::Size(100, 100)); @@ -298,7 +298,7 @@ public: OcclusionTracker occlusionTracker(gfx::Rect(), false); scrollbarLayer->SetTexturePriorities(calculator); - m_layerTreeHost->contentsTextureManager()->prioritizeTextures(); + m_layerTreeHost->contents_texture_manager()->prioritizeTextures(); scrollbarLayer->Update(&queue, &occlusionTracker, NULL); EXPECT_EQ(0, queue.fullUploadSize()); EXPECT_EQ(expectedResources, queue.partialUploadSize()); diff --git a/cc/single_thread_proxy.cc b/cc/single_thread_proxy.cc index 3a64d82..c6b90882 100644 --- a/cc/single_thread_proxy.cc +++ b/cc/single_thread_proxy.cc @@ -41,7 +41,7 @@ SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layer_tree_host) void SingleThreadProxy::Start() { DebugScopedSetImplThread impl(this); - layer_tree_host_impl_ = layer_tree_host_->createLayerTreeHostImpl(this); + layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); } SingleThreadProxy::~SingleThreadProxy() { @@ -96,7 +96,7 @@ bool SingleThreadProxy::IsStarted() const { bool SingleThreadProxy::InitializeOutputSurface() { DCHECK(Proxy::IsMainThread()); scoped_ptr<OutputSurface> outputSurface = - layer_tree_host_->createOutputSurface(); + layer_tree_host_->CreateOutputSurface(); if (!outputSurface.get()) return false; output_surface_before_initialization_ = outputSurface.Pass(); @@ -136,7 +136,7 @@ bool SingleThreadProxy::RecreateOutputSurface() { DCHECK(output_surface_lost_); scoped_ptr<OutputSurface> outputSurface = - layer_tree_host_->createOutputSurface(); + layer_tree_host_->CreateOutputSurface(); if (!outputSurface.get()) return false; scoped_refptr<cc::ContextProvider> offscreen_context_provider; @@ -151,7 +151,7 @@ bool SingleThreadProxy::RecreateOutputSurface() { { DebugScopedSetMainThreadBlocked mainThreadBlocked(this); DebugScopedSetImplThread impl(this); - layer_tree_host_->deleteContentsTexturesOnImplThread( + layer_tree_host_->DeleteContentsTexturesOnImplThread( layer_tree_host_impl_->resourceProvider()); initialized = layer_tree_host_impl_->initializeRenderer(outputSurface.Pass()); @@ -171,7 +171,7 @@ bool SingleThreadProxy::RecreateOutputSurface() { return initialized; } -void SingleThreadProxy::GetRenderingStats(RenderingStats* stats) { +void SingleThreadProxy::CollectRenderingStats(RenderingStats* stats) { stats->totalCommitTime = total_commit_time_; stats->totalCommitCount = total_commit_count_; layer_tree_host_impl_->renderingStats(stats); @@ -198,9 +198,9 @@ void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) { base::TimeTicks startTime = base::TimeTicks::HighResNow(); layer_tree_host_impl_->beginCommit(); - layer_tree_host_->contentsTextureManager()-> + layer_tree_host_->contents_texture_manager()-> pushTexturePrioritiesToBackings(); - layer_tree_host_->beginCommitOnImplThread(layer_tree_host_impl_.get()); + layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); scoped_ptr<ResourceUpdateController> updateController = ResourceUpdateController::Create( @@ -210,7 +210,7 @@ void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) { layer_tree_host_impl_->resourceProvider()); updateController->Finalize(); - layer_tree_host_->finishCommitOnImplThread(layer_tree_host_impl_.get()); + layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get()); layer_tree_host_impl_->commitComplete(); @@ -226,13 +226,13 @@ void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) { total_commit_time_ += endTime - startTime; total_commit_count_++; } - layer_tree_host_->commitComplete(); + layer_tree_host_->CommitComplete(); next_frame_is_newly_committed_frame_ = true; } void SingleThreadProxy::SetNeedsCommit() { DCHECK(Proxy::IsMainThread()); - layer_tree_host_->scheduleComposite(); + layer_tree_host_->ScheduleComposite(); } void SingleThreadProxy::SetNeedsRedraw() { @@ -265,7 +265,7 @@ void SingleThreadProxy::Stop() { DebugScopedSetMainThreadBlocked mainThreadBlocked(this); DebugScopedSetImplThread impl(this); - layer_tree_host_->deleteContentsTexturesOnImplThread( + layer_tree_host_->DeleteContentsTexturesOnImplThread( layer_tree_host_impl_->resourceProvider()); layer_tree_host_impl_.reset(); } @@ -273,7 +273,7 @@ void SingleThreadProxy::Stop() { } void SingleThreadProxy::setNeedsRedrawOnImplThread() { - layer_tree_host_->scheduleComposite(); + layer_tree_host_->ScheduleComposite(); } void SingleThreadProxy::didUploadVisibleHighResolutionTileOnImplThread() { @@ -282,11 +282,11 @@ void SingleThreadProxy::didUploadVisibleHighResolutionTileOnImplThread() { } void SingleThreadProxy::setNeedsCommitOnImplThread() { - layer_tree_host_->scheduleComposite(); + layer_tree_host_->ScheduleComposite(); } void SingleThreadProxy::setNeedsManageTilesOnImplThread() { - layer_tree_host_->scheduleComposite(); + layer_tree_host_->ScheduleComposite(); } void SingleThreadProxy::postAnimationEventsToMainThreadOnImplThread( @@ -294,17 +294,17 @@ void SingleThreadProxy::postAnimationEventsToMainThreadOnImplThread( base::Time wall_clock_time) { DCHECK(Proxy::IsImplThread()); DebugScopedSetMainThread main(this); - layer_tree_host_->setAnimationEvents(events.Pass(), wall_clock_time); + layer_tree_host_->SetAnimationEvents(events.Pass(), wall_clock_time); } bool SingleThreadProxy::reduceContentsTextureMemoryOnImplThread( size_t limit_bytes, int priority_cutoff) { DCHECK(IsImplThread()); - if (!layer_tree_host_->contentsTextureManager()) + if (!layer_tree_host_->contents_texture_manager()) return false; - return layer_tree_host_->contentsTextureManager()->reduceMemoryOnImplThread( + return layer_tree_host_->contents_texture_manager()->reduceMemoryOnImplThread( limit_bytes, priority_cutoff, layer_tree_host_impl_->resourceProvider()); } @@ -317,13 +317,15 @@ void SingleThreadProxy::sendManagedMemoryStats() { DCHECK(Proxy::IsImplThread()); if (!layer_tree_host_impl_.get()) return; - if (!layer_tree_host_->contentsTextureManager()) + if (!layer_tree_host_->contents_texture_manager()) return; + PrioritizedResourceManager* contents_texture_manager = + layer_tree_host_->contents_texture_manager(); layer_tree_host_impl_->sendManagedMemoryStats( - layer_tree_host_->contentsTextureManager()->memoryVisibleBytes(), - layer_tree_host_->contentsTextureManager()->memoryVisibleAndNearbyBytes(), - layer_tree_host_->contentsTextureManager()->memoryUseBytes()); + contents_texture_manager->memoryVisibleBytes(), + contents_texture_manager->memoryVisibleAndNearbyBytes(), + contents_texture_manager->memoryUseBytes()); } bool SingleThreadProxy::isInsideDraw() { return inside_draw_; } @@ -369,12 +371,12 @@ void SingleThreadProxy::onSwapBuffersCompleteOnImplThread() { NOTREACHED(); } bool SingleThreadProxy::CommitAndComposite() { DCHECK(Proxy::IsMainThread()); - if (!layer_tree_host_->initializeRendererIfNeeded()) + if (!layer_tree_host_->InitializeRendererIfNeeded()) return false; scoped_refptr<cc::ContextProvider> offscreen_context_provider; - if (renderer_capabilities_for_main_thread_.usingOffscreenContext3d && - layer_tree_host_->needsOffscreenContext()) { + if (renderer_capabilities_for_main_thread_.using_offscreen_context3d && + layer_tree_host_->needs_offscreen_context()) { offscreen_context_provider = layer_tree_host_->client()->OffscreenContextProviderForMainThread(); if (offscreen_context_provider->InitializeOnMainThread()) @@ -383,17 +385,17 @@ bool SingleThreadProxy::CommitAndComposite() { offscreen_context_provider = NULL; } - layer_tree_host_->contentsTextureManager()->unlinkAndClearEvictedBackings(); + layer_tree_host_->contents_texture_manager()->unlinkAndClearEvictedBackings(); scoped_ptr<ResourceUpdateQueue> queue = make_scoped_ptr(new ResourceUpdateQueue); - layer_tree_host_->updateLayers( - *(queue.get()), layer_tree_host_impl_->memoryAllocationLimitBytes()); + layer_tree_host_->UpdateLayers( + queue.get(), layer_tree_host_impl_->memoryAllocationLimitBytes()); - layer_tree_host_->willCommit(); + layer_tree_host_->WillCommit(); DoCommit(queue.Pass()); bool result = DoComposite(offscreen_context_provider); - layer_tree_host_->didBeginFrame(); + layer_tree_host_->DidBeginFrame(); return result; } @@ -433,7 +435,7 @@ bool SingleThreadProxy::DoComposite( resourceProvider()->offscreen_context_provider(); if (offscreen_contexts) offscreen_contexts->VerifyContexts(); - layer_tree_host_->didLoseOutputSurface(); + layer_tree_host_->DidLoseOutputSurface(); return false; } @@ -443,7 +445,7 @@ bool SingleThreadProxy::DoComposite( void SingleThreadProxy::DidSwapFrame() { if (next_frame_is_newly_committed_frame_) { next_frame_is_newly_committed_frame_ = false; - layer_tree_host_->didCommitAndDrawFrame(); + layer_tree_host_->DidCommitAndDrawFrame(); } } diff --git a/cc/single_thread_proxy.h b/cc/single_thread_proxy.h index 6b948f4..f8e92b6 100644 --- a/cc/single_thread_proxy.h +++ b/cc/single_thread_proxy.h @@ -35,7 +35,7 @@ class SingleThreadProxy : public Proxy, LayerTreeHostImplClient { virtual void SetVisible(bool visible) OVERRIDE; virtual bool InitializeRenderer() OVERRIDE; virtual bool RecreateOutputSurface() OVERRIDE; - virtual void GetRenderingStats(RenderingStats* stats) OVERRIDE; + virtual void CollectRenderingStats(RenderingStats* stats) OVERRIDE; virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; virtual void SetNeedsAnimate() OVERRIDE; virtual void SetNeedsCommit() OVERRIDE; diff --git a/cc/software_renderer.cc b/cc/software_renderer.cc index 9e44e91..9294c98 100644 --- a/cc/software_renderer.cc +++ b/cc/software_renderer.cc @@ -72,14 +72,14 @@ SoftwareRenderer::SoftwareRenderer(RendererClient* client, current_canvas_(NULL) { resource_provider_->set_default_resource_type(ResourceProvider::Bitmap); - capabilities_.maxTextureSize = resource_provider_->max_texture_size(); - capabilities_.bestTextureFormat = resource_provider_->best_texture_format(); - capabilities_.usingSetVisibility = true; + capabilities_.max_texture_size = resource_provider_->max_texture_size(); + capabilities_.best_texture_format = resource_provider_->best_texture_format(); + capabilities_.using_set_visibility = true; // The updater can access bitmaps while the SoftwareRenderer is using them. - capabilities_.allowPartialTextureUpdates = true; - capabilities_.usingPartialSwap = true; + capabilities_.allow_partial_texture_updates = true; + capabilities_.using_partial_swap = true; if (client_->HasImplThread()) - capabilities_.usingSwapCompleteCallback = true; + capabilities_.using_swap_complete_callback = true; compositor_frame_.software_frame_data.reset(new SoftwareFrameData()); ViewportChanged(); diff --git a/cc/test/fake_proxy.h b/cc/test/fake_proxy.h index 31e9541..a29c765 100644 --- a/cc/test/fake_proxy.h +++ b/cc/test/fake_proxy.h @@ -28,7 +28,7 @@ class FakeProxy : public Proxy { virtual void SetVisible(bool visible) OVERRIDE {} virtual bool InitializeRenderer() OVERRIDE; virtual bool RecreateOutputSurface() OVERRIDE; - virtual void GetRenderingStats(RenderingStats* stats) OVERRIDE {} + virtual void CollectRenderingStats(RenderingStats* stats) OVERRIDE {} virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; virtual void SetNeedsAnimate() OVERRIDE {} virtual void SetNeedsCommit() OVERRIDE {} diff --git a/cc/test/layer_tree_test_common.cc b/cc/test/layer_tree_test_common.cc index 4af56b69..a27afc2 100644 --- a/cc/test/layer_tree_test_common.cc +++ b/cc/test/layer_tree_test_common.cc @@ -163,26 +163,26 @@ public: static scoped_ptr<MockLayerTreeHost> create(TestHooks* testHooks, cc::LayerTreeHostClient* client, const cc::LayerTreeSettings& settings, scoped_ptr<cc::Thread> implThread) { scoped_ptr<MockLayerTreeHost> layerTreeHost(new MockLayerTreeHost(testHooks, client, settings)); - bool success = layerTreeHost->initialize(implThread.Pass()); + bool success = layerTreeHost->Initialize(implThread.Pass()); EXPECT_TRUE(success); return layerTreeHost.Pass(); } - virtual scoped_ptr<cc::LayerTreeHostImpl> createLayerTreeHostImpl(cc::LayerTreeHostImplClient* client) OVERRIDE + virtual scoped_ptr<cc::LayerTreeHostImpl> CreateLayerTreeHostImpl(cc::LayerTreeHostImplClient* client) OVERRIDE { return MockLayerTreeHostImpl::create(m_testHooks, settings(), client, proxy()).PassAs<cc::LayerTreeHostImpl>(); } - virtual void setNeedsCommit() OVERRIDE + virtual void SetNeedsCommit() OVERRIDE { if (!m_testStarted) return; - LayerTreeHost::setNeedsCommit(); + LayerTreeHost::SetNeedsCommit(); } void setTestStarted(bool started) { m_testStarted = started; } - virtual void didDeferCommit() OVERRIDE + virtual void DidDeferCommit() OVERRIDE { m_testHooks->didDeferCommit(); } @@ -225,7 +225,7 @@ public: m_testHooks->layout(); } - virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float scale) OVERRIDE + virtual void applyScrollAndScale(gfx::Vector2d scrollDelta, float scale) OVERRIDE { m_testHooks->applyScrollAndScale(scrollDelta, scale); } @@ -365,7 +365,7 @@ void ThreadedTest::doBeginTest() m_started = true; m_beginning = true; setupTree(); - m_layerTreeHost->setSurfaceReady(); + m_layerTreeHost->SetSurfaceReady(); beginTest(); m_beginning = false; if (m_endWhenBeginReturns) @@ -379,16 +379,16 @@ void ThreadedTest::doBeginTest() void ThreadedTest::setupTree() { - if (!m_layerTreeHost->rootLayer()) { + if (!m_layerTreeHost->root_layer()) { scoped_refptr<Layer> rootLayer = Layer::Create(); rootLayer->SetBounds(gfx::Size(1, 1)); - m_layerTreeHost->setRootLayer(rootLayer); + m_layerTreeHost->SetRootLayer(rootLayer); } - gfx::Size rootBounds = m_layerTreeHost->rootLayer()->bounds(); + gfx::Size rootBounds = m_layerTreeHost->root_layer()->bounds(); gfx::Size deviceRootBounds = gfx::ToCeiledSize( - gfx::ScaleSize(rootBounds, m_layerTreeHost->deviceScaleFactor())); - m_layerTreeHost->setViewportSize(rootBounds, deviceRootBounds); + gfx::ScaleSize(rootBounds, m_layerTreeHost->device_scale_factor())); + m_layerTreeHost->SetViewportSize(rootBounds, deviceRootBounds); } void ThreadedTest::timeout() @@ -421,8 +421,8 @@ void ThreadedTest::dispatchAddInstantAnimation() { DCHECK(!proxy() || proxy()->IsMainThread()); - if (m_layerTreeHost.get() && m_layerTreeHost->rootLayer()) - addOpacityTransitionToLayer(*m_layerTreeHost->rootLayer(), 0, 0, 0.5, false); + if (m_layerTreeHost.get() && m_layerTreeHost->root_layer()) + addOpacityTransitionToLayer(*m_layerTreeHost->root_layer(), 0, 0, 0.5, false); } void ThreadedTest::dispatchAddAnimation(Layer* layerToReceiveAnimation) @@ -438,7 +438,7 @@ void ThreadedTest::dispatchSetNeedsCommit() DCHECK(!proxy() || proxy()->IsMainThread()); if (m_layerTreeHost.get()) - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); } void ThreadedTest::dispatchAcquireLayerTextures() @@ -446,7 +446,7 @@ void ThreadedTest::dispatchAcquireLayerTextures() DCHECK(!proxy() || proxy()->IsMainThread()); if (m_layerTreeHost.get()) - m_layerTreeHost->acquireLayerTextures(); + m_layerTreeHost->AcquireLayerTextures(); } void ThreadedTest::dispatchSetNeedsRedraw() @@ -454,7 +454,7 @@ void ThreadedTest::dispatchSetNeedsRedraw() DCHECK(!proxy() || proxy()->IsMainThread()); if (m_layerTreeHost.get()) - m_layerTreeHost->setNeedsRedraw(); + m_layerTreeHost->SetNeedsRedraw(); } void ThreadedTest::dispatchSetVisible(bool visible) @@ -464,7 +464,7 @@ void ThreadedTest::dispatchSetVisible(bool visible) if (!m_layerTreeHost) return; - m_layerTreeHost->setVisible(visible); + m_layerTreeHost->SetVisible(visible); // If the LTH is being made visible and a previous scheduleComposite() was // deferred because the LTH was not visible, re-schedule the composite now. @@ -487,7 +487,7 @@ void ThreadedTest::dispatchComposite() } m_scheduleWhenSetVisibleTrue = false; - m_layerTreeHost->composite(); + m_layerTreeHost->Composite(); } void ThreadedTest::runTest(bool threaded) @@ -505,8 +505,8 @@ void ThreadedTest::runTest(bool threaded) m_timeout.Reset(base::Bind(&ThreadedTest::timeout, base::Unretained(this))); m_mainCCThread->postDelayedTask(m_timeout.callback(), 5000); MessageLoop::current()->Run(); - if (m_layerTreeHost.get() && m_layerTreeHost->rootLayer()) - m_layerTreeHost->rootLayer()->SetLayerTreeHost(0); + if (m_layerTreeHost.get() && m_layerTreeHost->root_layer()) + m_layerTreeHost->root_layer()->SetLayerTreeHost(NULL); m_layerTreeHost.reset(); m_timeout.Cancel(); diff --git a/cc/texture_layer.cc b/cc/texture_layer.cc index da4aa5a..441b0ac 100644 --- a/cc/texture_layer.cc +++ b/cc/texture_layer.cc @@ -56,9 +56,9 @@ TextureLayer::~TextureLayer() { if (layer_tree_host()) { if (m_textureId) - layer_tree_host()->acquireLayerTextures(); + layer_tree_host()->AcquireLayerTextures(); if (m_rateLimitContext && m_client) - layer_tree_host()->stopRateLimiter(m_client->context()); + layer_tree_host()->StopRateLimiter(m_client->context()); } if (m_ownMailbox) m_textureMailbox.RunReleaseCallback(m_textureMailbox.sync_point()); @@ -106,7 +106,7 @@ void TextureLayer::setPremultipliedAlpha(bool premultipliedAlpha) void TextureLayer::setRateLimitContext(bool rateLimit) { if (!rateLimit && m_rateLimitContext && m_client && layer_tree_host()) - layer_tree_host()->stopRateLimiter(m_client->context()); + layer_tree_host()->StopRateLimiter(m_client->context()); m_rateLimitContext = rateLimit; } @@ -117,7 +117,7 @@ void TextureLayer::setTextureId(unsigned id) if (m_textureId == id) return; if (m_textureId && layer_tree_host()) - layer_tree_host()->acquireLayerTextures(); + layer_tree_host()->AcquireLayerTextures(); m_textureId = id; SetNeedsCommit(); } @@ -138,7 +138,7 @@ void TextureLayer::setTextureMailbox(const TextureMailbox& mailbox) void TextureLayer::willModifyTexture() { if (layer_tree_host() && (DrawsContent() || m_contentCommitted)) { - layer_tree_host()->acquireLayerTextures(); + layer_tree_host()->AcquireLayerTextures(); m_contentCommitted = false; } } @@ -148,13 +148,13 @@ void TextureLayer::SetNeedsDisplayRect(const gfx::RectF& dirtyRect) Layer::SetNeedsDisplayRect(dirtyRect); if (m_rateLimitContext && m_client && layer_tree_host() && DrawsContent()) - layer_tree_host()->startRateLimiter(m_client->context()); + layer_tree_host()->StartRateLimiter(m_client->context()); } void TextureLayer::SetLayerTreeHost(LayerTreeHost* host) { if (m_textureId && layer_tree_host() && host != layer_tree_host()) - layer_tree_host()->acquireLayerTextures(); + layer_tree_host()->AcquireLayerTextures(); Layer::SetLayerTreeHost(host); } diff --git a/cc/texture_layer_unittest.cc b/cc/texture_layer_unittest.cc index f3a81f1..5b08c50 100644 --- a/cc/texture_layer_unittest.cc +++ b/cc/texture_layer_unittest.cc @@ -32,11 +32,11 @@ public: MockLayerImplTreeHost() : LayerTreeHost(&m_fakeClient, LayerTreeSettings()) { - initialize(scoped_ptr<Thread>(NULL)); + Initialize(scoped_ptr<Thread>(NULL)); } - MOCK_METHOD0(acquireLayerTextures, void()); - MOCK_METHOD0(setNeedsCommit, void()); + MOCK_METHOD0(AcquireLayerTextures, void()); + MOCK_METHOD0(SetNeedsCommit, void()); private: FakeLayerImplTreeHostClient m_fakeClient; @@ -59,10 +59,10 @@ protected: virtual void TearDown() { Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AnyNumber()); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(AnyNumber()); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AnyNumber()); - m_layerTreeHost->setRootLayer(0); + m_layerTreeHost->SetRootLayer(NULL); m_layerTreeHost.reset(); } @@ -76,24 +76,24 @@ TEST_F(TextureLayerTest, syncImplWhenChangingTextureId) scoped_refptr<TextureLayer> testLayer = TextureLayer::Create(NULL); ASSERT_TRUE(testLayer); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AnyNumber()); - m_layerTreeHost->setRootLayer(testLayer); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(AnyNumber()); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AnyNumber()); + m_layerTreeHost->SetRootLayer(testLayer); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); EXPECT_EQ(testLayer->layer_tree_host(), m_layerTreeHost.get()); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(0); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AtLeast(1)); testLayer->setTextureId(1); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AtLeast(1)); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(AtLeast(1)); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AtLeast(1)); testLayer->setTextureId(2); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AtLeast(1)); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(AtLeast(1)); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AtLeast(1)); testLayer->setTextureId(0); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); } @@ -108,26 +108,26 @@ TEST_F(TextureLayerTest, syncImplWhenDrawing) implLayer = TextureLayerImpl::Create(m_hostImpl.activeTree(), 1, false); ASSERT_TRUE(implLayer); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AnyNumber()); - m_layerTreeHost->setRootLayer(testLayer); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(AnyNumber()); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AnyNumber()); + m_layerTreeHost->SetRootLayer(testLayer); testLayer->setTextureId(1); testLayer->SetIsDrawable(true); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); EXPECT_EQ(testLayer->layer_tree_host(), m_layerTreeHost.get()); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(1); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(0); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(1); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(0); testLayer->willModifyTexture(); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(1); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(0); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(1); testLayer->SetNeedsDisplayRect(dirtyRect); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(1); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(0); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(1); testLayer->PushPropertiesTo(implLayer.get()); // fake commit testLayer->SetIsDrawable(false); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); @@ -135,8 +135,8 @@ TEST_F(TextureLayerTest, syncImplWhenDrawing) // Verify that non-drawable layers don't signal the compositor, // except for the first draw after last commit, which must acquire // the texture. - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(1); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(0); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(1); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(0); testLayer->willModifyTexture(); testLayer->SetNeedsDisplayRect(dirtyRect); testLayer->PushPropertiesTo(implLayer.get()); // fake commit @@ -144,8 +144,8 @@ TEST_F(TextureLayerTest, syncImplWhenDrawing) // Second draw with layer in non-drawable state: no texture // acquisition. - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(0); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(0); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(0); testLayer->willModifyTexture(); testLayer->SetNeedsDisplayRect(dirtyRect); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); @@ -163,28 +163,28 @@ TEST_F(TextureLayerTest, syncImplWhenRemovingFromTree) testLayer->setTextureId(0); childLayer->AddChild(testLayer); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AnyNumber()); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AnyNumber()); - m_layerTreeHost->setRootLayer(rootLayer); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(AnyNumber()); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AnyNumber()); + m_layerTreeHost->SetRootLayer(rootLayer); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(0); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AtLeast(1)); testLayer->RemoveFromParent(); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(0); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AtLeast(1)); childLayer->AddChild(testLayer); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(0); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AtLeast(1)); testLayer->setTextureId(1); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(AtLeast(1)); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(AtLeast(1)); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AtLeast(1)); testLayer->RemoveFromParent(); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); } @@ -245,18 +245,18 @@ TEST_F(TextureLayerWithMailboxTest, replaceMailboxOnMainThreadBeforeCommit) scoped_refptr<TextureLayer> testLayer = TextureLayer::CreateForMailbox(); ASSERT_TRUE(testLayer); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AnyNumber()); - m_layerTreeHost->setRootLayer(testLayer); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(0); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AnyNumber()); + m_layerTreeHost->SetRootLayer(testLayer); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(0); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AtLeast(1)); testLayer->setTextureMailbox(m_testData.m_mailbox1); Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(0); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AtLeast(1)); EXPECT_CALL(m_testData.m_mockCallback, Release(m_testData.m_mailboxName1, m_testData.m_syncPoint1)).Times(1); @@ -264,8 +264,8 @@ TEST_F(TextureLayerWithMailboxTest, replaceMailboxOnMainThreadBeforeCommit) Mock::VerifyAndClearExpectations(m_layerTreeHost.get()); Mock::VerifyAndClearExpectations(&m_testData.m_mockCallback); - EXPECT_CALL(*m_layerTreeHost, acquireLayerTextures()).Times(0); - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); + EXPECT_CALL(*m_layerTreeHost, AcquireLayerTextures()).Times(0); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AtLeast(1)); EXPECT_CALL(m_testData.m_mockCallback, Release(m_testData.m_mailboxName2, m_testData.m_syncPoint2)).Times(1); @@ -274,7 +274,7 @@ TEST_F(TextureLayerWithMailboxTest, replaceMailboxOnMainThreadBeforeCommit) Mock::VerifyAndClearExpectations(&m_testData.m_mockCallback); // Test destructor. - EXPECT_CALL(*m_layerTreeHost, setNeedsCommit()).Times(AtLeast(1)); + EXPECT_CALL(*m_layerTreeHost, SetNeedsCommit()).Times(AtLeast(1)); testLayer->setTextureMailbox(m_testData.m_mailbox1); } @@ -314,8 +314,8 @@ public: m_layer->SetBounds(bounds); m_root->AddChild(m_layer); - m_layerTreeHost->setRootLayer(m_root); - m_layerTreeHost->setViewportSize(bounds, bounds); + m_layerTreeHost->SetRootLayer(m_root); + m_layerTreeHost->SetViewportSize(bounds, bounds); setMailbox('1'); EXPECT_EQ(0, m_callbackCount); @@ -342,7 +342,7 @@ public: // until this didCommit returns. // TODO(piman): fix this. EXPECT_EQ(1, m_callbackCount); - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); break; case 3: EXPECT_EQ(2, m_callbackCount); @@ -356,7 +356,7 @@ public: // until this didCommit returns. // TODO(piman): fix this. EXPECT_EQ(2, m_callbackCount); - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); break; case 5: EXPECT_EQ(3, m_callbackCount); @@ -369,7 +369,7 @@ public: // until this didCommit returns. // TODO(piman): fix this. EXPECT_EQ(3, m_callbackCount); - m_layerTreeHost->setNeedsCommit(); + m_layerTreeHost->SetNeedsCommit(); break; case 7: EXPECT_EQ(4, m_callbackCount); diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc index 139eddc..faa6695 100644 --- a/cc/thread_proxy.cc +++ b/cc/thread_proxy.cc @@ -80,7 +80,7 @@ bool ThreadProxy::CompositeAndReadback(void* pixels, gfx::Rect rect) DCHECK(m_layerTreeHost); DCHECK(!m_deferCommits); - if (!m_layerTreeHost->initializeRendererIfNeeded()) { + if (!m_layerTreeHost->InitializeRendererIfNeeded()) { TRACE_EVENT0("cc", "compositeAndReadback_EarlyOut_LR_Uninitialized"); return false; } @@ -158,7 +158,7 @@ bool ThreadProxy::IsStarted() const bool ThreadProxy::InitializeOutputSurface() { TRACE_EVENT0("cc", "ThreadProxy::initializeOutputSurface"); - scoped_ptr<OutputSurface> context = m_layerTreeHost->createOutputSurface(); + scoped_ptr<OutputSurface> context = m_layerTreeHost->CreateOutputSurface(); if (!context.get()) return false; @@ -224,7 +224,7 @@ bool ThreadProxy::RecreateOutputSurface() DCHECK(IsMainThread()); // Try to create the surface. - scoped_ptr<OutputSurface> outputSurface = m_layerTreeHost->createOutputSurface(); + scoped_ptr<OutputSurface> outputSurface = m_layerTreeHost->CreateOutputSurface(); if (!outputSurface.get()) return false; scoped_refptr<cc::ContextProvider> offscreenContextProvider; @@ -255,7 +255,7 @@ bool ThreadProxy::RecreateOutputSurface() return recreateSucceeded; } -void ThreadProxy::GetRenderingStats(RenderingStats* stats) +void ThreadProxy::CollectRenderingStats(RenderingStats* stats) { DCHECK(IsMainThread()); @@ -392,10 +392,10 @@ bool ThreadProxy::reduceContentsTextureMemoryOnImplThread(size_t limitBytes, int { DCHECK(IsImplThread()); - if (!m_layerTreeHost->contentsTextureManager()) + if (!m_layerTreeHost->contents_texture_manager()) return false; - bool reduceResult = m_layerTreeHost->contentsTextureManager()->reduceMemoryOnImplThread(limitBytes, priorityCutoff, m_layerTreeHostImpl->resourceProvider()); + bool reduceResult = m_layerTreeHost->contents_texture_manager()->reduceMemoryOnImplThread(limitBytes, priorityCutoff, m_layerTreeHostImpl->resourceProvider()); if (!reduceResult) return false; @@ -410,10 +410,10 @@ void ThreadProxy::reduceWastedContentsTextureMemoryOnImplThread() { DCHECK(IsImplThread()); - if (!m_layerTreeHost->contentsTextureManager()) + if (!m_layerTreeHost->contents_texture_manager()) return; - m_layerTreeHost->contentsTextureManager()->reduceWastedMemoryOnImplThread(m_layerTreeHostImpl->resourceProvider()); + m_layerTreeHost->contents_texture_manager()->reduceWastedMemoryOnImplThread(m_layerTreeHostImpl->resourceProvider()); } void ThreadProxy::sendManagedMemoryStats() @@ -421,7 +421,7 @@ void ThreadProxy::sendManagedMemoryStats() DCHECK(IsImplThread()); if (!m_layerTreeHostImpl.get()) return; - if (!m_layerTreeHost->contentsTextureManager()) + if (!m_layerTreeHost->contents_texture_manager()) return; // If we are using impl-side painting, then sendManagedMemoryStats is called @@ -431,9 +431,9 @@ void ThreadProxy::sendManagedMemoryStats() return; m_layerTreeHostImpl->sendManagedMemoryStats( - m_layerTreeHost->contentsTextureManager()->memoryVisibleBytes(), - m_layerTreeHost->contentsTextureManager()->memoryVisibleAndNearbyBytes(), - m_layerTreeHost->contentsTextureManager()->memoryUseBytes()); + m_layerTreeHost->contents_texture_manager()->memoryVisibleBytes(), + m_layerTreeHost->contents_texture_manager()->memoryVisibleAndNearbyBytes(), + m_layerTreeHost->contents_texture_manager()->memoryUseBytes()); } bool ThreadProxy::isInsideDraw() @@ -504,7 +504,7 @@ void ThreadProxy::Start() // Create LayerTreeHostImpl. DebugScopedSetMainThreadBlocked mainThreadBlocked(this); CompletionEvent completion; - scoped_ptr<InputHandler> handler = m_layerTreeHost->createInputHandler(); + scoped_ptr<InputHandler> handler = m_layerTreeHost->CreateInputHandler(); Proxy::ImplThread()->postTask(base::Bind(&ThreadProxy::initializeImplOnImplThread, base::Unretained(this), &completion, handler.release())); completion.wait(); @@ -599,7 +599,7 @@ void ThreadProxy::beginFrame(scoped_ptr<BeginFrameAndCommitState> beginFrameStat if (m_deferCommits) { m_pendingDeferredCommit = beginFrameState.Pass(); - m_layerTreeHost->didDeferCommit(); + m_layerTreeHost->DidDeferCommit(); TRACE_EVENT0("cc", "EarlyOut_DeferCommits"); return; } @@ -618,8 +618,8 @@ void ThreadProxy::beginFrame(scoped_ptr<BeginFrameAndCommitState> beginFrameStat m_animateRequested = false; if (beginFrameState) { - m_layerTreeHost->applyScrollAndScale(*beginFrameState->scrollInfo); - m_layerTreeHost->setImplTransform(beginFrameState->implTransform); + m_layerTreeHost->ApplyScrollAndScale(*beginFrameState->scrollInfo); + m_layerTreeHost->SetImplTransform(beginFrameState->implTransform); } if (!m_inCompositeAndReadback && !m_layerTreeHost->visible()) { @@ -631,17 +631,17 @@ void ThreadProxy::beginFrame(scoped_ptr<BeginFrameAndCommitState> beginFrameStat return; } - m_layerTreeHost->willBeginFrame(); + m_layerTreeHost->WillBeginFrame(); if (beginFrameState) - m_layerTreeHost->updateAnimations(beginFrameState->monotonicFrameBeginTime); + m_layerTreeHost->UpdateAnimations(beginFrameState->monotonicFrameBeginTime); // Unlink any backings that the impl thread has evicted, so that we know to re-paint // them in updateLayers. - if (m_layerTreeHost->contentsTextureManager()) - m_layerTreeHost->contentsTextureManager()->unlinkAndClearEvictedBackings(); + if (m_layerTreeHost->contents_texture_manager()) + m_layerTreeHost->contents_texture_manager()->unlinkAndClearEvictedBackings(); - m_layerTreeHost->layout(); + m_layerTreeHost->Layout(); // Clear the commit flag after updating animations and layout here --- objects that only // layout when painted will trigger another setNeedsCommit inside @@ -649,19 +649,19 @@ void ThreadProxy::beginFrame(scoped_ptr<BeginFrameAndCommitState> beginFrameStat m_commitRequested = false; m_commitRequestSentToImplThread = false; - if (!m_layerTreeHost->initializeRendererIfNeeded()) { + if (!m_layerTreeHost->InitializeRendererIfNeeded()) { TRACE_EVENT0("cc", "EarlyOut_InitializeFailed"); return; } scoped_ptr<ResourceUpdateQueue> queue = make_scoped_ptr(new ResourceUpdateQueue); - m_layerTreeHost->updateLayers(*(queue.get()), beginFrameState ? beginFrameState->memoryAllocationLimitBytes : 0); + m_layerTreeHost->UpdateLayers(queue.get(), beginFrameState ? beginFrameState->memoryAllocationLimitBytes : 0); // Once single buffered layers are committed, they cannot be modified until // they are drawn by the impl thread. m_texturesAcquired = false; - m_layerTreeHost->willCommit(); + m_layerTreeHost->WillCommit(); // Before applying scrolls and calling animate, we set m_animateRequested to // false. If it is true now, it means setNeedAnimate was called again, but // during a state when m_commitRequestSentToImplThread = true. We need to @@ -674,7 +674,7 @@ void ThreadProxy::beginFrame(scoped_ptr<BeginFrameAndCommitState> beginFrameStat } scoped_refptr<cc::ContextProvider> offscreenContextProvider; - if (m_RendererCapabilitiesMainThreadCopy.usingOffscreenContext3d && m_layerTreeHost->needsOffscreenContext()) { + if (m_RendererCapabilitiesMainThreadCopy.using_offscreen_context3d && m_layerTreeHost->needs_offscreen_context()) { offscreenContextProvider = m_layerTreeHost->client()->OffscreenContextProviderForCompositorThread(); if (offscreenContextProvider->InitializeOnMainThread()) m_createdOffscreenContextProvider = true; @@ -701,8 +701,8 @@ void ThreadProxy::beginFrame(scoped_ptr<BeginFrameAndCommitState> beginFrameStat m_totalCommitCount++; } - m_layerTreeHost->commitComplete(); - m_layerTreeHost->didBeginFrame(); + m_layerTreeHost->CommitComplete(); + m_layerTreeHost->DidBeginFrame(); } void ThreadProxy::beginFrameCompleteOnImplThread(CompletionEvent* completion, ResourceUpdateQueue* rawQueue, scoped_refptr<cc::ContextProvider> offscreenContextProvider) @@ -723,7 +723,7 @@ void ThreadProxy::beginFrameCompleteOnImplThread(CompletionEvent* completion, Re m_layerTreeHostImpl->resourceProvider()->SetOffscreenContextProvider(offscreenContextProvider); - if (m_layerTreeHost->contentsTextureManager()->linkedEvictedBackingsExist()) { + if (m_layerTreeHost->contents_texture_manager()->linkedEvictedBackingsExist()) { // Clear any uploads we were making to textures linked to evicted // resources queue->clearUploadsToEvictedResources(); @@ -732,7 +732,7 @@ void ThreadProxy::beginFrameCompleteOnImplThread(CompletionEvent* completion, Re setNeedsCommitOnImplThread(); } - m_layerTreeHost->contentsTextureManager()->pushTexturePrioritiesToBackings(); + m_layerTreeHost->contents_texture_manager()->pushTexturePrioritiesToBackings(); m_currentResourceUpdateControllerOnImplThread = ResourceUpdateController::Create(this, Proxy::ImplThread(), queue.Pass(), m_layerTreeHostImpl->resourceProvider()); m_currentResourceUpdateControllerOnImplThread->PerformMoreUpdates( @@ -763,13 +763,13 @@ void ThreadProxy::scheduledActionCommit() m_currentResourceUpdateControllerOnImplThread.reset(); m_layerTreeHostImpl->beginCommit(); - m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); - m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); + m_layerTreeHost->BeginCommitOnImplThread(m_layerTreeHostImpl.get()); + m_layerTreeHost->FinishCommitOnImplThread(m_layerTreeHostImpl.get()); m_layerTreeHostImpl->commitComplete(); m_nextFrameIsNewlyCommittedFrameOnImplThread = true; - if (m_layerTreeHost->settings().implSidePainting && m_layerTreeHost->blocksPendingCommit()) + if (m_layerTreeHost->settings().implSidePainting && m_layerTreeHost->BlocksPendingCommit()) { // For some layer types in impl-side painting, the commit is held until // the pending tree is activated. @@ -957,7 +957,7 @@ void ThreadProxy::didCommitAndDrawFrame() DCHECK(IsMainThread()); if (!m_layerTreeHost) return; - m_layerTreeHost->didCommitAndDrawFrame(); + m_layerTreeHost->DidCommitAndDrawFrame(); } void ThreadProxy::didCompleteSwapBuffers() @@ -965,7 +965,7 @@ void ThreadProxy::didCompleteSwapBuffers() DCHECK(IsMainThread()); if (!m_layerTreeHost) return; - m_layerTreeHost->didCompleteSwapBuffers(); + m_layerTreeHost->DidCompleteSwapBuffers(); } void ThreadProxy::setAnimationEvents(scoped_ptr<AnimationEventsVector> events, base::Time wallClockTime) @@ -974,14 +974,14 @@ void ThreadProxy::setAnimationEvents(scoped_ptr<AnimationEventsVector> events, b DCHECK(IsMainThread()); if (!m_layerTreeHost) return; - m_layerTreeHost->setAnimationEvents(events.Pass(), wallClockTime); + m_layerTreeHost->SetAnimationEvents(events.Pass(), wallClockTime); } void ThreadProxy::beginContextRecreation() { TRACE_EVENT0("cc", "ThreadProxy::beginContextRecreation"); DCHECK(IsMainThread()); - m_layerTreeHost->didLoseOutputSurface(); + m_layerTreeHost->DidLoseOutputSurface(); m_outputSurfaceRecreationCallback.Reset(base::Bind(&ThreadProxy::tryToRecreateOutputSurface, base::Unretained(this))); Proxy::MainThread()->postTask(m_outputSurfaceRecreationCallback.callback()); } @@ -990,7 +990,7 @@ void ThreadProxy::tryToRecreateOutputSurface() { DCHECK(IsMainThread()); DCHECK(m_layerTreeHost); - LayerTreeHost::RecreateResult result = m_layerTreeHost->recreateOutputSurface(); + LayerTreeHost::RecreateResult result = m_layerTreeHost->RecreateOutputSurface(); if (result == LayerTreeHost::RecreateFailedButTryAgain) Proxy::MainThread()->postTask(m_outputSurfaceRecreationCallback.callback()); else if (result == LayerTreeHost::RecreateSucceeded) @@ -1001,7 +1001,7 @@ void ThreadProxy::initializeImplOnImplThread(CompletionEvent* completion, InputH { TRACE_EVENT0("cc", "ThreadProxy::initializeImplOnImplThread"); DCHECK(IsImplThread()); - m_layerTreeHostImpl = m_layerTreeHost->createLayerTreeHostImpl(this); + m_layerTreeHostImpl = m_layerTreeHost->CreateLayerTreeHostImpl(this); const base::TimeDelta displayRefreshInterval = base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond / 60); scoped_ptr<FrameRateController> frameRateController; if (m_renderVSyncEnabled) @@ -1038,7 +1038,7 @@ void ThreadProxy::initializeRendererOnImplThread(CompletionEvent* completion, bo if (*initializeSucceeded) { *capabilities = m_layerTreeHostImpl->rendererCapabilities(); m_schedulerOnImplThread->setSwapBuffersCompleteSupported( - capabilities->usingSwapCompleteCallback); + capabilities->using_swap_complete_callback); int maxFramesPending = FrameRateController::kDefaultMaxFramesPending; if (m_layerTreeHostImpl->outputSurface()->capabilities().has_parent_compositor) @@ -1053,7 +1053,7 @@ void ThreadProxy::layerTreeHostClosedOnImplThread(CompletionEvent* completion) { TRACE_EVENT0("cc", "ThreadProxy::layerTreeHostClosedOnImplThread"); DCHECK(IsImplThread()); - m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); + m_layerTreeHost->DeleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); m_inputHandlerOnImplThread.reset(); m_layerTreeHostImpl.reset(); m_schedulerOnImplThread.reset(); @@ -1076,7 +1076,7 @@ void ThreadProxy::recreateOutputSurfaceOnImplThread(CompletionEvent* completion, { TRACE_EVENT0("cc", "ThreadProxy::recreateOutputSurfaceOnImplThread"); DCHECK(IsImplThread()); - m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); + m_layerTreeHost->DeleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); *recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(outputSurface.Pass()); if (*recreateSucceeded) { *capabilities = m_layerTreeHostImpl->rendererCapabilities(); diff --git a/cc/thread_proxy.h b/cc/thread_proxy.h index 0811d94..1b027e0 100644 --- a/cc/thread_proxy.h +++ b/cc/thread_proxy.h @@ -41,7 +41,7 @@ public: virtual void SetVisible(bool) OVERRIDE; virtual bool InitializeRenderer() OVERRIDE; virtual bool RecreateOutputSurface() OVERRIDE; - virtual void GetRenderingStats(RenderingStats* stats) OVERRIDE; + virtual void CollectRenderingStats(RenderingStats* stats) OVERRIDE; virtual const RendererCapabilities& GetRendererCapabilities() const OVERRIDE; virtual void SetNeedsAnimate() OVERRIDE; virtual void SetNeedsCommit() OVERRIDE; diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc index 43a6203..7f5a00f 100644 --- a/cc/tiled_layer.cc +++ b/cc/tiled_layer.cc @@ -132,7 +132,7 @@ void TiledLayer::updateTileSizeAndTilingOption() isTiled = autoTiled; gfx::Size requestedSize = isTiled ? tileSize : content_bounds(); - const int maxSize = layer_tree_host()->rendererCapabilities().maxTextureSize; + const int maxSize = layer_tree_host()->GetRendererCapabilities().max_texture_size; requestedSize.ClampToMax(gfx::Size(maxSize, maxSize)); setTileSize(requestedSize); } @@ -230,7 +230,7 @@ PrioritizedResourceManager* TiledLayer::resourceManager() const { if (!layer_tree_host()) return 0; - return layer_tree_host()->contentsTextureManager(); + return layer_tree_host()->contents_texture_manager(); } const PrioritizedResource* TiledLayer::resourceAtForTesting(int i, int j) const @@ -249,7 +249,7 @@ void TiledLayer::SetLayerTreeHost(LayerTreeHost* host) // FIXME: This should not ever be null. if (!tile) continue; - tile->managedResource()->setTextureManager(host->contentsTextureManager()); + tile->managedResource()->setTextureManager(host->contents_texture_manager()); } } ContentsScalingLayer::SetLayerTreeHost(host); @@ -323,7 +323,7 @@ bool TiledLayer::updateTiles(int left, int top, int right, int bottom, ResourceU gfx::Rect paintRect = markTilesForUpdate(left, top, right, bottom, ignoreOcclusions); if (occlusion) - occlusion->OverdrawMetrics().DidPaint(paintRect); + occlusion->overdraw_metrics()->DidPaint(paintRect); if (paintRect.IsEmpty()) return true; @@ -364,7 +364,7 @@ void TiledLayer::markOcclusionsAndRequestTextures(int left, int top, int right, if (!succeeded) return; if (occlusion) - occlusion->OverdrawMetrics().DidCullTilesForUpload(occludedTileCount); + occlusion->overdraw_metrics()->DidCullTilesForUpload(occludedTileCount); } bool TiledLayer::haveTexturesForTiles(int left, int top, int right, int bottom, bool ignoreOcclusions) @@ -407,12 +407,12 @@ gfx::Rect TiledLayer::markTilesForUpdate(int left, int top, int right, int botto continue; // FIXME: Decide if partial update should be allowed based on cost // of update. https://bugs.webkit.org/show_bug.cgi?id=77376 - if (tile->isDirty() && layer_tree_host() && layer_tree_host()->bufferedUpdates()) { + if (tile->isDirty() && layer_tree_host() && layer_tree_host()->buffered_updates()) { // If we get a partial update, we use the same texture, otherwise return the // current texture backing, so we don't update visible textures non-atomically. // If the current backing is in-use, it won't be deleted until after the commit // as the texture manager will not allow deletion or recycling of in-use textures. - if (tileOnlyNeedsPartialUpdate(tile) && layer_tree_host()->requestPartialTextureUpdate()) + if (tileOnlyNeedsPartialUpdate(tile) && layer_tree_host()->RequestPartialTextureUpdate()) tile->partialUpdate = true; else { tile->dirtyRect = m_tiler->tileRect(tile); @@ -498,7 +498,7 @@ void TiledLayer::updateTileTextures(const gfx::Rect& paintRect, int left, int to tile->updaterResource()->update(*queue, sourceRect, destOffset, tile->partialUpdate, stats); if (occlusion) - occlusion->OverdrawMetrics().DidUpload(gfx::Transform(), sourceRect, tile->opaqueRect()); + occlusion->overdraw_metrics()->DidUpload(gfx::Transform(), sourceRect, tile->opaqueRect()); } } @@ -512,7 +512,7 @@ bool TiledLayer::isSmallAnimatedLayer() const { if (!draw_transform_is_animating() && !screen_space_transform_is_animating()) return false; - gfx::Size viewportSize = layer_tree_host() ? layer_tree_host()->deviceViewportSize() : gfx::Size(); + gfx::Size viewportSize = layer_tree_host() ? layer_tree_host()->device_viewport_size() : gfx::Size(); gfx::Rect contentRect(gfx::Point(), content_bounds()); return contentRect.width() <= viewportSize.width() + m_tiler->tileSize().width() && contentRect.height() <= viewportSize.height() + m_tiler->tileSize().height(); diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc index 8b753b5..52293aa 100644 --- a/cc/tiled_layer_unittest.cc +++ b/cc/tiled_layer_unittest.cc @@ -56,11 +56,11 @@ public: virtual void SetUp() { - layer_tree_host_ = LayerTreeHost::create(&m_fakeLayerImplTreeHostClient, m_settings, scoped_ptr<Thread>(NULL)); + layer_tree_host_ = LayerTreeHost::Create(&m_fakeLayerImplTreeHostClient, m_settings, scoped_ptr<Thread>(NULL)); m_proxy = layer_tree_host_->proxy(); m_resourceManager = PrioritizedResourceManager::create(m_proxy); - layer_tree_host_->initializeRendererIfNeeded(); - layer_tree_host_->setRootLayer(Layer::Create()); + layer_tree_host_->InitializeRendererIfNeeded(); + layer_tree_host_->SetRootLayer(Layer::Create()); DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked(m_proxy); m_resourceProvider = ResourceProvider::Create(m_outputSurface.get()); @@ -119,19 +119,19 @@ public: const scoped_refptr<FakeTiledLayer>& layer2) { if (layer1 && !layer1->parent()) - layer_tree_host_->rootLayer()->AddChild(layer1); + layer_tree_host_->root_layer()->AddChild(layer1); if (layer2 && !layer2->parent()) - layer_tree_host_->rootLayer()->AddChild(layer2); + layer_tree_host_->root_layer()->AddChild(layer2); if (m_occlusion) - m_occlusion->setRenderTarget(layer_tree_host_->rootLayer()); + m_occlusion->setRenderTarget(layer_tree_host_->root_layer()); std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; LayerTreeHostCommon::calculateDrawProperties( - layer_tree_host_->rootLayer(), - layer_tree_host_->deviceViewportSize(), - layer_tree_host_->deviceScaleFactor(), + layer_tree_host_->root_layer(), + layer_tree_host_->device_viewport_size(), + layer_tree_host_->device_scale_factor(), 1, // page_scale_factor - layer_tree_host_->rendererCapabilities().maxTextureSize, + layer_tree_host_->GetRendererCapabilities().max_texture_size, false, // can_use_lcd_text renderSurfaceLayerList); } @@ -223,16 +223,16 @@ TEST_F(TiledLayerTest, pushOccludedDirtyTiles) scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1)); TestOcclusionTracker occluded; m_occlusion = &occluded; - layer_tree_host_->setViewportSize(gfx::Size(1000, 1000), gfx::Size(1000, 1000)); + layer_tree_host_->SetViewportSize(gfx::Size(1000, 1000), gfx::Size(1000, 1000)); // The tile size is 100x100, so this invalidates and then paints two tiles. layer->SetBounds(gfx::Size(100, 200)); calcDrawProps(layer); updateAndPush(layer, layerImpl); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 20000, 1); - EXPECT_EQ(0, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 20000, 1); + EXPECT_EQ(0, occluded.overdraw_metrics()->tiles_culled_for_upload()); // We should have both tiles on the impl side. EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 0)); @@ -245,9 +245,9 @@ TEST_F(TiledLayerTest, pushOccludedDirtyTiles) calcDrawProps(layer); updateAndPush(layer, layerImpl); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 20000 + 2500, 1); - EXPECT_EQ(0, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 20000 + 2500, 1); + EXPECT_EQ(0, occluded.overdraw_metrics()->tiles_culled_for_upload()); // We should still have both tiles, as part of the top tile is still unoccluded. EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 0)); @@ -467,7 +467,7 @@ TEST_F(TiledLayerTest, pushIdlePaintedOccludedTiles) // We should have the prepainted tile on the impl side, but culled it during paint. EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 0)); - EXPECT_EQ(1, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_EQ(1, occluded.overdraw_metrics()->tiles_culled_for_upload()); } TEST_F(TiledLayerTest, pushTilesMarkedDirtyDuringPaint) @@ -550,7 +550,7 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately) int layerWidth = 5 * FakeTiledLayer::tileSize().width(); int layerHeight = 5 * FakeTiledLayer::tileSize().height(); int memoryForLayer = layerWidth * layerHeight * 4; - layer_tree_host_->setViewportSize(gfx::Size(layerWidth, layerHeight), gfx::Size(layerWidth, layerHeight)); + layer_tree_host_->SetViewportSize(gfx::Size(layerWidth, layerHeight), gfx::Size(layerWidth, layerHeight)); // Use 10x5 tiles to run out of memory. if (runOutOfMemory[i]) @@ -819,38 +819,38 @@ TEST_F(TiledLayerTest, skipsDrawGetsReset) // We have enough memory for only one of the two layers. int memoryLimit = 4 * 300 * 300; // 4 bytes per pixel. - scoped_refptr<FakeTiledLayer> rootLayer = make_scoped_refptr(new FakeTiledLayer(layer_tree_host_->contentsTextureManager())); - scoped_refptr<FakeTiledLayer> childLayer = make_scoped_refptr(new FakeTiledLayer(layer_tree_host_->contentsTextureManager())); - rootLayer->AddChild(childLayer); + scoped_refptr<FakeTiledLayer> root_layer = make_scoped_refptr(new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); + scoped_refptr<FakeTiledLayer> childLayer = make_scoped_refptr(new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); + root_layer->AddChild(childLayer); - rootLayer->SetBounds(contentBounds); - rootLayer->draw_properties().visible_content_rect = contentRect; - rootLayer->SetPosition(gfx::PointF(0, 0)); + root_layer->SetBounds(contentBounds); + root_layer->draw_properties().visible_content_rect = contentRect; + root_layer->SetPosition(gfx::PointF(0, 0)); childLayer->SetBounds(contentBounds); childLayer->draw_properties().visible_content_rect = contentRect; childLayer->SetPosition(gfx::PointF(0, 0)); - rootLayer->invalidateContentRect(contentRect); + root_layer->invalidateContentRect(contentRect); childLayer->invalidateContentRect(contentRect); - layer_tree_host_->setRootLayer(rootLayer); - layer_tree_host_->setViewportSize(gfx::Size(300, 300), gfx::Size(300, 300)); + layer_tree_host_->SetRootLayer(root_layer); + layer_tree_host_->SetViewportSize(gfx::Size(300, 300), gfx::Size(300, 300)); - layer_tree_host_->updateLayers(*m_queue.get(), memoryLimit); + layer_tree_host_->UpdateLayers(m_queue.get(), memoryLimit); // We'll skip the root layer. - EXPECT_TRUE(rootLayer->skipsDraw()); + EXPECT_TRUE(root_layer->skipsDraw()); EXPECT_FALSE(childLayer->skipsDraw()); - layer_tree_host_->commitComplete(); + layer_tree_host_->CommitComplete(); // Remove the child layer. - rootLayer->RemoveAllChildren(); + root_layer->RemoveAllChildren(); - layer_tree_host_->updateLayers(*m_queue.get(), memoryLimit); - EXPECT_FALSE(rootLayer->skipsDraw()); + layer_tree_host_->UpdateLayers(m_queue.get(), memoryLimit); + EXPECT_FALSE(root_layer->skipsDraw()); - resourceManagerClearAllMemory(layer_tree_host_->contentsTextureManager(), m_resourceProvider.get()); - layer_tree_host_->setRootLayer(0); + resourceManagerClearAllMemory(layer_tree_host_->contents_texture_manager(), m_resourceProvider.get()); + layer_tree_host_->SetRootLayer(NULL); } TEST_F(TiledLayerTest, resizeToSmaller) @@ -898,18 +898,18 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) gfx::Size contentBounds(300, 200); gfx::Rect contentRect(gfx::Point(), contentBounds); - scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(layer_tree_host_->contentsTextureManager())); + scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); layer->SetBounds(contentBounds); layer->SetPosition(gfx::PointF(0, 0)); layer->draw_properties().visible_content_rect = contentRect; layer->invalidateContentRect(contentRect); - layer_tree_host_->setRootLayer(layer); - layer_tree_host_->setViewportSize(gfx::Size(300, 200), gfx::Size(300, 200)); + layer_tree_host_->SetRootLayer(layer); + layer_tree_host_->SetViewportSize(gfx::Size(300, 200), gfx::Size(300, 200)); // Full update of all 6 tiles. - layer_tree_host_->updateLayers( - *m_queue.get(), std::numeric_limits<size_t>::max()); + layer_tree_host_->UpdateLayers(m_queue.get(), + std::numeric_limits<size_t>::max()); { scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1)); EXPECT_EQ(6, m_queue->fullUploadSize()); @@ -920,11 +920,11 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) layer->fakeLayerUpdater()->clearUpdateCount(); layerPushPropertiesTo(layer.get(), layerImpl.get()); } - layer_tree_host_->commitComplete(); + layer_tree_host_->CommitComplete(); // Full update of 3 tiles and partial update of 3 tiles. layer->invalidateContentRect(gfx::Rect(0, 0, 300, 150)); - layer_tree_host_->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); + layer_tree_host_->UpdateLayers(m_queue.get(), std::numeric_limits<size_t>::max()); { scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1)); EXPECT_EQ(3, m_queue->fullUploadSize()); @@ -935,13 +935,13 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) layer->fakeLayerUpdater()->clearUpdateCount(); layerPushPropertiesTo(layer.get(), layerImpl.get()); } - layer_tree_host_->commitComplete(); + layer_tree_host_->CommitComplete(); // Partial update of 6 tiles. layer->invalidateContentRect(gfx::Rect(50, 50, 200, 100)); { scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1)); - layer_tree_host_->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); + layer_tree_host_->UpdateLayers(m_queue.get(), std::numeric_limits<size_t>::max()); EXPECT_EQ(2, m_queue->fullUploadSize()); EXPECT_EQ(4, m_queue->partialUploadSize()); updateTextures(); @@ -950,7 +950,7 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) layer->fakeLayerUpdater()->clearUpdateCount(); layerPushPropertiesTo(layer.get(), layerImpl.get()); } - layer_tree_host_->commitComplete(); + layer_tree_host_->CommitComplete(); // Checkerboard all tiles. layer->invalidateContentRect(gfx::Rect(0, 0, 300, 200)); @@ -958,13 +958,13 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1)); layerPushPropertiesTo(layer.get(), layerImpl.get()); } - layer_tree_host_->commitComplete(); + layer_tree_host_->CommitComplete(); // Partial update of 6 checkerboard tiles. layer->invalidateContentRect(gfx::Rect(50, 50, 200, 100)); { scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1)); - layer_tree_host_->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); + layer_tree_host_->UpdateLayers(m_queue.get(), std::numeric_limits<size_t>::max()); EXPECT_EQ(6, m_queue->fullUploadSize()); EXPECT_EQ(0, m_queue->partialUploadSize()); updateTextures(); @@ -973,13 +973,13 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) layer->fakeLayerUpdater()->clearUpdateCount(); layerPushPropertiesTo(layer.get(), layerImpl.get()); } - layer_tree_host_->commitComplete(); + layer_tree_host_->CommitComplete(); // Partial update of 4 tiles. layer->invalidateContentRect(gfx::Rect(50, 50, 100, 100)); { scoped_ptr<FakeTiledLayerImpl> layerImpl = make_scoped_ptr(new FakeTiledLayerImpl(m_hostImpl->activeTree(), 1)); - layer_tree_host_->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max()); + layer_tree_host_->UpdateLayers(m_queue.get(), std::numeric_limits<size_t>::max()); EXPECT_EQ(0, m_queue->fullUploadSize()); EXPECT_EQ(4, m_queue->partialUploadSize()); updateTextures(); @@ -988,10 +988,10 @@ TEST_F(TiledLayerPartialUpdateTest, partialUpdates) layer->fakeLayerUpdater()->clearUpdateCount(); layerPushPropertiesTo(layer.get(), layerImpl.get()); } - layer_tree_host_->commitComplete(); + layer_tree_host_->CommitComplete(); - resourceManagerClearAllMemory(layer_tree_host_->contentsTextureManager(), m_resourceProvider.get()); - layer_tree_host_->setRootLayer(0); + resourceManagerClearAllMemory(layer_tree_host_->contents_texture_manager(), m_resourceProvider.get()); + layer_tree_host_->SetRootLayer(NULL); } TEST_F(TiledLayerTest, tilesPaintedWithoutOcclusion) @@ -1016,7 +1016,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion) // The tile size is 100x100. - layer_tree_host_->setViewportSize(gfx::Size(600, 600), gfx::Size(600, 600)); + layer_tree_host_->SetViewportSize(gfx::Size(600, 600), gfx::Size(600, 600)); layer->SetBounds(gfx::Size(600, 600)); calcDrawProps(layer); @@ -1030,9 +1030,9 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion) layer->Update(m_queue.get(), &occluded, NULL); EXPECT_EQ(36-3, layer->fakeLayerUpdater()->updateCount()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 330000, 1); - EXPECT_EQ(3, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 330000, 1); + EXPECT_EQ(3, occluded.overdraw_metrics()->tiles_culled_for_upload()); layer->fakeLayerUpdater()->clearUpdateCount(); layer->SetTexturePriorities(m_priorityCalculator); @@ -1043,9 +1043,9 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion) layer->Update(m_queue.get(), &occluded, NULL); EXPECT_EQ(36-2, layer->fakeLayerUpdater()->updateCount()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 330000 + 340000, 1); - EXPECT_EQ(3 + 2, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 330000 + 340000, 1); + EXPECT_EQ(3 + 2, occluded.overdraw_metrics()->tiles_culled_for_upload()); layer->fakeLayerUpdater()->clearUpdateCount(); layer->SetTexturePriorities(m_priorityCalculator); @@ -1056,9 +1056,9 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion) layer->Update(m_queue.get(), &occluded, NULL); EXPECT_EQ(36, layer->fakeLayerUpdater()->updateCount()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 330000 + 340000 + 360000, 1); - EXPECT_EQ(3 + 2, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 330000 + 340000 + 360000, 1); + EXPECT_EQ(3 + 2, occluded.overdraw_metrics()->tiles_culled_for_upload()); } TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints) @@ -1069,7 +1069,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints) // The tile size is 100x100. - layer_tree_host_->setViewportSize(gfx::Size(600, 600), gfx::Size(600, 600)); + layer_tree_host_->SetViewportSize(gfx::Size(600, 600), gfx::Size(600, 600)); layer->SetBounds(gfx::Size(600, 600)); calcDrawProps(layer); @@ -1084,9 +1084,9 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints) layer->Update(m_queue.get(), &occluded, NULL); EXPECT_EQ(24-3, layer->fakeLayerUpdater()->updateCount()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 210000, 1); - EXPECT_EQ(3, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 210000, 1); + EXPECT_EQ(3, occluded.overdraw_metrics()->tiles_culled_for_upload()); layer->fakeLayerUpdater()->clearUpdateCount(); @@ -1100,9 +1100,9 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints) layer->Update(m_queue.get(), &occluded, NULL); EXPECT_EQ(24-6, layer->fakeLayerUpdater()->updateCount()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 210000 + 180000, 1); - EXPECT_EQ(3 + 6, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 210000 + 180000, 1); + EXPECT_EQ(3 + 6, occluded.overdraw_metrics()->tiles_culled_for_upload()); layer->fakeLayerUpdater()->clearUpdateCount(); @@ -1116,9 +1116,9 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints) layer->Update(m_queue.get(), &occluded, NULL); EXPECT_EQ(24-6, layer->fakeLayerUpdater()->updateCount()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 210000 + 180000 + 180000, 1); - EXPECT_EQ(3 + 6 + 6, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 210000 + 180000 + 180000, 1); + EXPECT_EQ(3 + 6 + 6, occluded.overdraw_metrics()->tiles_culled_for_upload()); } @@ -1130,7 +1130,7 @@ TEST_F(TiledLayerTest, tilesNotPaintedWithoutInvalidation) // The tile size is 100x100. - layer_tree_host_->setViewportSize(gfx::Size(600, 600), gfx::Size(600, 600)); + layer_tree_host_->SetViewportSize(gfx::Size(600, 600), gfx::Size(600, 600)); layer->SetBounds(gfx::Size(600, 600)); calcDrawProps(layer); @@ -1146,9 +1146,9 @@ TEST_F(TiledLayerTest, tilesNotPaintedWithoutInvalidation) updateTextures(); } - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 330000, 1); - EXPECT_EQ(3, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 330000, 1); + EXPECT_EQ(3, occluded.overdraw_metrics()->tiles_culled_for_upload()); layer->fakeLayerUpdater()->clearUpdateCount(); layer->SetTexturePriorities(m_priorityCalculator); @@ -1158,9 +1158,9 @@ TEST_F(TiledLayerTest, tilesNotPaintedWithoutInvalidation) layer->Update(m_queue.get(), &occluded, NULL); EXPECT_EQ(3, layer->fakeLayerUpdater()->updateCount()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 330000, 1); - EXPECT_EQ(6, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 330000, 1); + EXPECT_EQ(6, occluded.overdraw_metrics()->tiles_culled_for_upload()); } TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndTransforms) @@ -1173,7 +1173,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndTransforms) // This makes sure the painting works when the occluded region (in screen space) // is transformed differently than the layer. - layer_tree_host_->setViewportSize(gfx::Size(600, 600), gfx::Size(600, 600)); + layer_tree_host_->SetViewportSize(gfx::Size(600, 600), gfx::Size(600, 600)); layer->SetBounds(gfx::Size(600, 600)); calcDrawProps(layer); gfx::Transform screenTransform; @@ -1190,9 +1190,9 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndTransforms) layer->Update(m_queue.get(), &occluded, NULL); EXPECT_EQ(36-3, layer->fakeLayerUpdater()->updateCount()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 330000, 1); - EXPECT_EQ(3, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 330000, 1); + EXPECT_EQ(3, occluded.overdraw_metrics()->tiles_culled_for_upload()); } TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling) @@ -1206,7 +1206,7 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling) // This makes sure the painting works when the content space is scaled to // a different layer space. In this case tiles are scaled to be 200x200 // pixels, which means none should be occluded. - layer_tree_host_->setViewportSize(gfx::Size(600, 600), gfx::Size(600, 600)); + layer_tree_host_->SetViewportSize(gfx::Size(600, 600), gfx::Size(600, 600)); layer->SetBounds(gfx::Size(600, 600)); layer->SetRasterScale(0.5); calcDrawProps(layer); @@ -1229,9 +1229,9 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling) // number of tiles 3x3. EXPECT_EQ(9, layer->fakeLayerUpdater()->updateCount()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 90000, 1); - EXPECT_EQ(0, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 90000, 1); + EXPECT_EQ(0, occluded.overdraw_metrics()->tiles_culled_for_upload()); layer->fakeLayerUpdater()->clearUpdateCount(); @@ -1247,9 +1247,9 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling) layer->Update(m_queue.get(), &occluded, NULL); EXPECT_EQ(9-1, layer->fakeLayerUpdater()->updateCount()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 90000 + 80000, 1); - EXPECT_EQ(1, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 90000 + 80000, 1); + EXPECT_EQ(1, occluded.overdraw_metrics()->tiles_culled_for_upload()); layer->fakeLayerUpdater()->clearUpdateCount(); @@ -1270,9 +1270,9 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling) layer->Update(m_queue.get(), &occluded, NULL); EXPECT_EQ(9-1, layer->fakeLayerUpdater()->updateCount()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 90000 + 80000 + 80000, 1); - EXPECT_EQ(1 + 1, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 90000 + 80000 + 80000, 1); + EXPECT_EQ(1 + 1, occluded.overdraw_metrics()->tiles_culled_for_upload()); } TEST_F(TiledLayerTest, visibleContentOpaqueRegion) @@ -1280,7 +1280,7 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion) scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); TestOcclusionTracker occluded; m_occlusion = &occluded; - layer_tree_host_->setViewportSize(gfx::Size(1000, 1000), gfx::Size(1000, 1000)); + layer_tree_host_->SetViewportSize(gfx::Size(1000, 1000), gfx::Size(1000, 1000)); // The tile size is 100x100, so this invalidates and then paints two tiles in various ways. @@ -1304,10 +1304,10 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion) opaqueContents = layer->VisibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.IsEmpty()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_painted(), 20000, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 20000, 1); - EXPECT_EQ(0, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_painted(), 20000, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 20000, 1); + EXPECT_EQ(0, occluded.overdraw_metrics()->tiles_culled_for_upload()); // visibleContentOpaqueRegion should match the visible part of what is painted opaque. opaquePaintRect = gfx::Rect(10, 10, 90, 190); @@ -1320,10 +1320,10 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion) opaqueContents = layer->VisibleContentOpaqueRegion(); EXPECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds).ToString(), opaqueContents.ToString()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_painted(), 20000 * 2, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 17100, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 20000 + 20000 - 17100, 1); - EXPECT_EQ(0, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_painted(), 20000 * 2, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 17100, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 20000 + 20000 - 17100, 1); + EXPECT_EQ(0, occluded.overdraw_metrics()->tiles_culled_for_upload()); // If we paint again without invalidating, the same stuff should be opaque. layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect()); @@ -1334,10 +1334,10 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion) opaqueContents = layer->VisibleContentOpaqueRegion(); EXPECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds).ToString(), opaqueContents.ToString()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_painted(), 20000 * 2, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 17100, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 20000 + 20000 - 17100, 1); - EXPECT_EQ(0, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_painted(), 20000 * 2, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 17100, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 20000 + 20000 - 17100, 1); + EXPECT_EQ(0, occluded.overdraw_metrics()->tiles_culled_for_upload()); // If we repaint a non-opaque part of the tile, then it shouldn't lose its opaque-ness. And other tiles should // not be affected. @@ -1350,10 +1350,10 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion) opaqueContents = layer->VisibleContentOpaqueRegion(); EXPECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds).ToString(), opaqueContents.ToString()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_painted(), 20000 * 2 + 1, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 17100, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 20000 + 20000 - 17100 + 1, 1); - EXPECT_EQ(0, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_painted(), 20000 * 2 + 1, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 17100, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 20000 + 20000 - 17100 + 1, 1); + EXPECT_EQ(0, occluded.overdraw_metrics()->tiles_culled_for_upload()); // If we repaint an opaque part of the tile, then it should lose its opaque-ness. But other tiles should still // not be affected. @@ -1366,10 +1366,10 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion) opaqueContents = layer->VisibleContentOpaqueRegion(); EXPECT_EQ(gfx::IntersectRects(gfx::Rect(10, 100, 90, 100), visibleBounds).ToString(), opaqueContents.ToString()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_painted(), 20000 * 2 + 1 + 1, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 17100, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 20000 + 20000 - 17100 + 1 + 1, 1); - EXPECT_EQ(0, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_painted(), 20000 * 2 + 1 + 1, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 17100, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 20000 + 20000 - 17100 + 1 + 1, 1); + EXPECT_EQ(0, occluded.overdraw_metrics()->tiles_culled_for_upload()); } TEST_F(TiledLayerTest, pixels_paintedMetrics) @@ -1377,7 +1377,7 @@ TEST_F(TiledLayerTest, pixels_paintedMetrics) scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_resourceManager.get())); TestOcclusionTracker occluded; m_occlusion = &occluded; - layer_tree_host_->setViewportSize(gfx::Size(1000, 1000), gfx::Size(1000, 1000)); + layer_tree_host_->SetViewportSize(gfx::Size(1000, 1000), gfx::Size(1000, 1000)); // The tile size is 100x100, so this invalidates and then paints two tiles in various ways. @@ -1398,10 +1398,10 @@ TEST_F(TiledLayerTest, pixels_paintedMetrics) opaqueContents = layer->VisibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.IsEmpty()); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_painted(), 30000, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 30000, 1); - EXPECT_EQ(0, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_painted(), 30000, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 30000, 1); + EXPECT_EQ(0, occluded.overdraw_metrics()->tiles_culled_for_upload()); // Invalidates an area on the top and bottom tile, which will cause us to paint the tile in the middle, // even though it is not dirty and will not be uploaded. @@ -1416,11 +1416,11 @@ TEST_F(TiledLayerTest, pixels_paintedMetrics) EXPECT_TRUE(opaqueContents.IsEmpty()); // The middle tile was painted even though not invalidated. - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_painted(), 30000 + 60 * 210, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_painted(), 30000 + 60 * 210, 1); // The pixels uploaded will not include the non-invalidated tile in the middle. - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_opaque(), 0, 1); - EXPECT_NEAR(occluded.OverdrawMetrics().pixels_uploaded_translucent(), 30000 + 1 + 100, 1); - EXPECT_EQ(0, occluded.OverdrawMetrics().tiles_culled_for_upload()); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_opaque(), 0, 1); + EXPECT_NEAR(occluded.overdraw_metrics()->pixels_uploaded_translucent(), 30000 + 1 + 100, 1); + EXPECT_EQ(0, occluded.overdraw_metrics()->tiles_culled_for_upload()); } TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) @@ -1430,10 +1430,10 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) gfx::Rect childRect(0, 0, 300, 100); gfx::Rect child2Rect(0, 100, 300, 100); - scoped_refptr<FakeTiledLayer> root = make_scoped_refptr(new FakeTiledLayer(layer_tree_host_->contentsTextureManager())); + scoped_refptr<FakeTiledLayer> root = make_scoped_refptr(new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); scoped_refptr<Layer> surface = Layer::Create(); - scoped_refptr<FakeTiledLayer> child = make_scoped_refptr(new FakeTiledLayer(layer_tree_host_->contentsTextureManager())); - scoped_refptr<FakeTiledLayer> child2 = make_scoped_refptr(new FakeTiledLayer(layer_tree_host_->contentsTextureManager())); + scoped_refptr<FakeTiledLayer> child = make_scoped_refptr(new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); + scoped_refptr<FakeTiledLayer> child2 = make_scoped_refptr(new FakeTiledLayer(layer_tree_host_->contents_texture_manager())); root->SetBounds(rootRect.size()); root->SetAnchorPoint(gfx::PointF()); @@ -1459,15 +1459,14 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) child2->draw_properties().visible_content_rect = child2Rect; child2->draw_properties().drawable_content_rect = rootRect; - layer_tree_host_->setRootLayer(root); - layer_tree_host_->setViewportSize(rootRect.size(), rootRect.size()); + layer_tree_host_->SetRootLayer(root); + layer_tree_host_->SetViewportSize(rootRect.size(), rootRect.size()); // With a huge memory limit, all layers should update and push their textures. root->invalidateContentRect(rootRect); child->invalidateContentRect(childRect); child2->invalidateContentRect(child2Rect); - layer_tree_host_->updateLayers( - *m_queue.get(), std::numeric_limits<size_t>::max()); + layer_tree_host_->UpdateLayers(m_queue.get(), std::numeric_limits<size_t>::max()); { updateTextures(); EXPECT_EQ(6, root->fakeLayerUpdater()->updateCount()); @@ -1493,7 +1492,7 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) EXPECT_TRUE(child2Impl->hasResourceIdForTileAt(i, 0)); } } - layer_tree_host_->commitComplete(); + layer_tree_host_->CommitComplete(); // With a memory limit that includes only the root layer (3x2 tiles) and half the surface that // the child layers draw into, the child layers will not be allocated. If the surface isn't @@ -1501,8 +1500,7 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) root->invalidateContentRect(rootRect); child->invalidateContentRect(childRect); child2->invalidateContentRect(child2Rect); - layer_tree_host_->updateLayers( - *m_queue.get(), (3 * 2 + 3 * 1) * (100 * 100) * 4); + layer_tree_host_->UpdateLayers(m_queue.get(), (3 * 2 + 3 * 1) * (100 * 100) * 4); { updateTextures(); EXPECT_EQ(6, root->fakeLayerUpdater()->updateCount()); @@ -1528,7 +1526,7 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) EXPECT_FALSE(child2Impl->hasResourceIdForTileAt(i, 0)); } } - layer_tree_host_->commitComplete(); + layer_tree_host_->CommitComplete(); // With a memory limit that includes only half the root layer, no contents will be // allocated. If render surface memory wasn't accounted for, there is enough space @@ -1537,8 +1535,7 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) root->invalidateContentRect(rootRect); child->invalidateContentRect(childRect); child2->invalidateContentRect(child2Rect); - layer_tree_host_->updateLayers( - *m_queue.get(), (3 * 1) * (100 * 100) * 4); + layer_tree_host_->UpdateLayers(m_queue.get(), (3 * 1) * (100 * 100) * 4); { updateTextures(); EXPECT_EQ(0, root->fakeLayerUpdater()->updateCount()); @@ -1564,10 +1561,10 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated) EXPECT_FALSE(child2Impl->hasResourceIdForTileAt(i, 0)); } } - layer_tree_host_->commitComplete(); + layer_tree_host_->CommitComplete(); - resourceManagerClearAllMemory(layer_tree_host_->contentsTextureManager(), m_resourceProvider.get()); - layer_tree_host_->setRootLayer(0); + resourceManagerClearAllMemory(layer_tree_host_->contents_texture_manager(), m_resourceProvider.get()); + layer_tree_host_->SetRootLayer(NULL); } class TrackingLayerPainter : public LayerPainter { diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc index 753f20d..f2aa4c4 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc @@ -129,7 +129,7 @@ CompositorImpl::~CompositorImpl() { void CompositorImpl::Composite() { if (host_.get()) - host_->composite(); + host_->Composite(); } void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) { @@ -200,19 +200,19 @@ void CompositorImpl::SetVisible(bool visible) { impl_thread = cc::ThreadImpl::createForDifferentThread( g_impl_thread->message_loop()->message_loop_proxy()); - host_ = cc::LayerTreeHost::create(this, settings, impl_thread.Pass()); - host_->setRootLayer(root_layer_); + host_ = cc::LayerTreeHost::Create(this, settings, impl_thread.Pass()); + host_->SetRootLayer(root_layer_); - host_->setVisible(true); - host_->setSurfaceReady(); - host_->setViewportSize(size_, size_); - host_->setHasTransparentBackground(has_transparent_background_); + host_->SetVisible(true); + host_->SetSurfaceReady(); + host_->SetViewportSize(size_, size_); + host_->set_has_transparent_background(has_transparent_background_); } } void CompositorImpl::setDeviceScaleFactor(float factor) { if (host_) - host_->setDeviceScaleFactor(factor); + host_->SetDeviceScaleFactor(factor); } void CompositorImpl::SetWindowBounds(const gfx::Size& size) { @@ -221,19 +221,19 @@ void CompositorImpl::SetWindowBounds(const gfx::Size& size) { size_ = size; if (host_) - host_->setViewportSize(size, size); + host_->SetViewportSize(size, size); root_layer_->SetBounds(size); } void CompositorImpl::SetHasTransparentBackground(bool flag) { has_transparent_background_ = flag; if (host_.get()) - host_->setHasTransparentBackground(flag); + host_->set_has_transparent_background(flag); } bool CompositorImpl::CompositeAndReadback(void *pixels, const gfx::Rect& rect) { if (host_.get()) - return host_->compositeAndReadback(pixels, rect); + return host_->CompositeAndReadback(pixels, rect); else return false; } diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc index de7b6f8..438831a 100644 --- a/content/renderer/gpu/render_widget_compositor.cc +++ b/content/renderer/gpu/render_widget_compositor.cc @@ -268,23 +268,23 @@ void RenderWidgetCompositor::SetSuppressScheduleComposite(bool suppress) { } void RenderWidgetCompositor::Animate(base::TimeTicks time) { - layer_tree_host_->updateAnimations(time); + layer_tree_host_->UpdateAnimations(time); } void RenderWidgetCompositor::Composite() { - layer_tree_host_->composite(); + layer_tree_host_->Composite(); } void RenderWidgetCompositor::GetRenderingStats(cc::RenderingStats* stats) { - layer_tree_host_->renderingStats(stats); + layer_tree_host_->CollectRenderingStats(stats); } skia::RefPtr<SkPicture> RenderWidgetCompositor::CapturePicture() { - return layer_tree_host_->capturePicture(); + return layer_tree_host_->CapturePicture(); } void RenderWidgetCompositor::EnableHidingTopControls(bool enable) { - layer_tree_host_->enableHidingTopControls(enable); + layer_tree_host_->EnableHidingTopControls(enable); } bool RenderWidgetCompositor::initialize(cc::LayerTreeSettings settings) { @@ -296,37 +296,37 @@ bool RenderWidgetCompositor::initialize(cc::LayerTreeSettings settings) { impl_thread = cc::ThreadImpl::createForDifferentThread( compositor_message_loop_proxy); } - layer_tree_host_ = cc::LayerTreeHost::create(this, + layer_tree_host_ = cc::LayerTreeHost::Create(this, settings, impl_thread.Pass()); return layer_tree_host_; } void RenderWidgetCompositor::setSurfaceReady() { - layer_tree_host_->setSurfaceReady(); + layer_tree_host_->SetSurfaceReady(); } void RenderWidgetCompositor::setRootLayer(const WebKit::WebLayer& layer) { - layer_tree_host_->setRootLayer( + layer_tree_host_->SetRootLayer( static_cast<const WebKit::WebLayerImpl*>(&layer)->layer()); } void RenderWidgetCompositor::clearRootLayer() { - layer_tree_host_->setRootLayer(scoped_refptr<cc::Layer>()); + layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); } void RenderWidgetCompositor::setViewportSize( const WebSize& layout_viewport_size, const WebSize& device_viewport_size) { - layer_tree_host_->setViewportSize(layout_viewport_size, device_viewport_size); + layer_tree_host_->SetViewportSize(layout_viewport_size, device_viewport_size); } WebSize RenderWidgetCompositor::layoutViewportSize() const { - return layer_tree_host_->layoutViewportSize(); + return layer_tree_host_->layout_viewport_size(); } WebSize RenderWidgetCompositor::deviceViewportSize() const { - return layer_tree_host_->deviceViewportSize(); + return layer_tree_host_->device_viewport_size(); } WebFloatPoint RenderWidgetCompositor::adjustEventPointForPinchZoom( @@ -335,28 +335,28 @@ WebFloatPoint RenderWidgetCompositor::adjustEventPointForPinchZoom( } void RenderWidgetCompositor::setDeviceScaleFactor(float device_scale) { - layer_tree_host_->setDeviceScaleFactor(device_scale); + layer_tree_host_->SetDeviceScaleFactor(device_scale); } float RenderWidgetCompositor::deviceScaleFactor() const { - return layer_tree_host_->deviceScaleFactor(); + return layer_tree_host_->device_scale_factor(); } void RenderWidgetCompositor::setBackgroundColor(WebKit::WebColor color) { - layer_tree_host_->setBackgroundColor(color); + layer_tree_host_->set_background_color(color); } void RenderWidgetCompositor::setHasTransparentBackground(bool transparent) { - layer_tree_host_->setHasTransparentBackground(transparent); + layer_tree_host_->set_has_transparent_background(transparent); } void RenderWidgetCompositor::setVisible(bool visible) { - layer_tree_host_->setVisible(visible); + layer_tree_host_->SetVisible(visible); } void RenderWidgetCompositor::setPageScaleFactorAndLimits( float page_scale_factor, float minimum, float maximum) { - layer_tree_host_->setPageScaleFactorAndLimits( + layer_tree_host_->SetPageScaleFactorAndLimits( page_scale_factor, minimum, maximum); } @@ -367,7 +367,7 @@ void RenderWidgetCompositor::startPageScaleAnimation( double duration_sec) { base::TimeDelta duration = base::TimeDelta::FromMicroseconds( duration_sec * base::Time::kMicrosecondsPerSecond); - layer_tree_host_->startPageScaleAnimation( + layer_tree_host_->StartPageScaleAnimation( gfx::Vector2d(destination.x, destination.y), use_anchor, new_page_scale, @@ -375,65 +375,66 @@ void RenderWidgetCompositor::startPageScaleAnimation( } void RenderWidgetCompositor::setNeedsAnimate() { - layer_tree_host_->setNeedsAnimate(); + layer_tree_host_->SetNeedsAnimate(); } void RenderWidgetCompositor::setNeedsRedraw() { if (threaded_) - layer_tree_host_->setNeedsAnimate(); + layer_tree_host_->SetNeedsAnimate(); else widget_->scheduleAnimation(); } bool RenderWidgetCompositor::commitRequested() const { - return layer_tree_host_->commitRequested(); + return layer_tree_host_->CommitRequested(); } void RenderWidgetCompositor::didStopFlinging() { - layer_tree_host_->didStopFlinging(); + layer_tree_host_->DidStopFlinging(); } void RenderWidgetCompositor::registerForAnimations(WebKit::WebLayer* layer) { cc::Layer* cc_layer = static_cast<WebKit::WebLayerImpl*>(layer)->layer(); cc_layer->layer_animation_controller()->SetAnimationRegistrar( - layer_tree_host_->animationRegistrar()); + layer_tree_host_->animation_registrar()); } -bool RenderWidgetCompositor::compositeAndReadback(void *pixels, - const WebRect& rect) { - return layer_tree_host_->compositeAndReadback(pixels, rect); +bool RenderWidgetCompositor::compositeAndReadback( + void *pixels, const WebRect& rect_in_device_viewport) { + return layer_tree_host_->CompositeAndReadback(pixels, + rect_in_device_viewport); } void RenderWidgetCompositor::finishAllRendering() { - layer_tree_host_->finishAllRendering(); + layer_tree_host_->FinishAllRendering(); } void RenderWidgetCompositor::setDeferCommits(bool defer_commits) { - layer_tree_host_->setDeferCommits(defer_commits); + layer_tree_host_->SetDeferCommits(defer_commits); } void RenderWidgetCompositor::setShowFPSCounter(bool show) { - cc::LayerTreeDebugState debug_state = layer_tree_host_->debugState(); + cc::LayerTreeDebugState debug_state = layer_tree_host_->debug_state(); debug_state.showFPSCounter = show; - layer_tree_host_->setDebugState(debug_state); + layer_tree_host_->SetDebugState(debug_state); } void RenderWidgetCompositor::setShowPaintRects(bool show) { - cc::LayerTreeDebugState debug_state = layer_tree_host_->debugState(); + cc::LayerTreeDebugState debug_state = layer_tree_host_->debug_state(); debug_state.showPaintRects = show; - layer_tree_host_->setDebugState(debug_state); + layer_tree_host_->SetDebugState(debug_state); } void RenderWidgetCompositor::setShowDebugBorders(bool show) { - cc::LayerTreeDebugState debug_state = layer_tree_host_->debugState(); + cc::LayerTreeDebugState debug_state = layer_tree_host_->debug_state(); debug_state.showDebugBorders = show; - layer_tree_host_->setDebugState(debug_state); + layer_tree_host_->SetDebugState(debug_state); } void RenderWidgetCompositor::setContinuousPaintingEnabled(bool enabled) { - cc::LayerTreeDebugState debug_state = layer_tree_host_->debugState(); + cc::LayerTreeDebugState debug_state = layer_tree_host_->debug_state(); debug_state.continuousPainting = enabled; - layer_tree_host_->setDebugState(debug_state); + layer_tree_host_->SetDebugState(debug_state); } void RenderWidgetCompositor::willBeginFrame() { diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc index 4ecabdc..bff9e8b 100644 --- a/ui/compositor/compositor.cc +++ b/ui/compositor/compositor.cc @@ -409,9 +409,9 @@ Compositor::Compositor(CompositorDelegate* delegate, g_compositor_thread->message_loop_proxy()); } - host_ = cc::LayerTreeHost::create(this, settings, thread.Pass()); - host_->setRootLayer(root_web_layer_); - host_->setSurfaceReady(); + host_ = cc::LayerTreeHost::Create(this, settings, thread.Pass()); + host_->SetRootLayer(root_web_layer_); + host_->SetSurfaceReady(); } Compositor::~Compositor() { @@ -447,7 +447,7 @@ void Compositor::Terminate() { void Compositor::ScheduleDraw() { if (g_compositor_thread) - host_->composite(); + host_->Composite(); else if (delegate_) delegate_->ScheduleDraw(); } @@ -467,7 +467,7 @@ void Compositor::SetRootLayer(Layer* root_layer) { void Compositor::SetHostHasTransparentBackground( bool host_has_transparent_background) { - host_->setHasTransparentBackground(host_has_transparent_background); + host_->set_has_transparent_background(host_has_transparent_background); } void Compositor::Draw(bool force_clear) { @@ -482,14 +482,14 @@ void Compositor::Draw(bool force_clear) { // TODO(nduca): Temporary while compositor calls // compositeImmediately() directly. layout(); - host_->composite(); + host_->Composite(); } if (!pending_swap.posted()) NotifyEnd(); } void Compositor::ScheduleFullDraw() { - host_->setNeedsRedraw(); + host_->SetNeedsRedraw(); } bool Compositor::ReadPixels(SkBitmap* bitmap, @@ -504,14 +504,14 @@ bool Compositor::ReadPixels(SkBitmap* bitmap, unsigned char* pixels = static_cast<unsigned char*>(bitmap->getPixels()); CancelCompositorLock(); PendingSwap pending_swap(READPIXELS_SWAP, posted_swaps_.get()); - return host_->compositeAndReadback(pixels, bounds_in_pixel); + return host_->CompositeAndReadback(pixels, bounds_in_pixel); } void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) { DCHECK_GT(scale, 0); if (!size_in_pixel.IsEmpty()) { size_ = size_in_pixel; - host_->setViewportSize(size_in_pixel, size_in_pixel); + host_->SetViewportSize(size_in_pixel, size_in_pixel); root_web_layer_->SetBounds(size_in_pixel); } if (device_scale_factor_ != scale) { @@ -646,7 +646,7 @@ scoped_refptr<CompositorLock> Compositor::GetCompositorLock() { if (!compositor_lock_) { compositor_lock_ = new CompositorLock(this); if (g_compositor_thread) - host_->setDeferCommits(true); + host_->SetDeferCommits(true); FOR_EACH_OBSERVER(CompositorObserver, observer_list_, OnCompositingLockStateChanged(this)); @@ -658,7 +658,7 @@ void Compositor::UnlockCompositor() { DCHECK(compositor_lock_); compositor_lock_ = NULL; if (g_compositor_thread) - host_->setDeferCommits(false); + host_->SetDeferCommits(false); FOR_EACH_OBSERVER(CompositorObserver, observer_list_, OnCompositingLockStateChanged(this)); diff --git a/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc b/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc index 1e7f38e..5bfbd57 100644 --- a/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc +++ b/webkit/compositor_bindings/web_layer_tree_view_impl_for_testing.cc @@ -47,66 +47,66 @@ bool WebLayerTreeViewImplForTesting::initialize( // tests. settings.acceleratedAnimationEnabled = type_ == webkit_support::FAKE_CONTEXT; layer_tree_host_ = - cc::LayerTreeHost::create(this, settings, compositor_thread.Pass()); + cc::LayerTreeHost::Create(this, settings, compositor_thread.Pass()); if (!layer_tree_host_.get()) return false; return true; } void WebLayerTreeViewImplForTesting::setSurfaceReady() { - layer_tree_host_->setSurfaceReady(); + layer_tree_host_->SetSurfaceReady(); } void WebLayerTreeViewImplForTesting::setRootLayer(const WebLayer& root) { - layer_tree_host_->setRootLayer(static_cast<const WebLayerImpl*>(&root) - ->layer()); + layer_tree_host_->SetRootLayer( + static_cast<const WebLayerImpl*>(&root)->layer()); } void WebLayerTreeViewImplForTesting::clearRootLayer() { - layer_tree_host_->setRootLayer(scoped_refptr<cc::Layer>()); + layer_tree_host_->SetRootLayer(scoped_refptr<cc::Layer>()); } void WebLayerTreeViewImplForTesting::setViewportSize( const WebSize& layout_viewport_size, const WebSize& device_viewport_size) { - layer_tree_host_->setViewportSize(layout_viewport_size, device_viewport_size); + layer_tree_host_->SetViewportSize(layout_viewport_size, device_viewport_size); } WebSize WebLayerTreeViewImplForTesting::layoutViewportSize() const { - return layer_tree_host_->layoutViewportSize(); + return layer_tree_host_->layout_viewport_size(); } WebSize WebLayerTreeViewImplForTesting::deviceViewportSize() const { - return layer_tree_host_->deviceViewportSize(); + return layer_tree_host_->device_viewport_size(); } void WebLayerTreeViewImplForTesting::setDeviceScaleFactor( float device_scale_factor) { - layer_tree_host_->setDeviceScaleFactor(device_scale_factor); + layer_tree_host_->SetDeviceScaleFactor(device_scale_factor); } float WebLayerTreeViewImplForTesting::deviceScaleFactor() const { - return layer_tree_host_->deviceScaleFactor(); + return layer_tree_host_->device_scale_factor(); } void WebLayerTreeViewImplForTesting::setBackgroundColor(WebColor color) { - layer_tree_host_->setBackgroundColor(color); + layer_tree_host_->set_background_color(color); } void WebLayerTreeViewImplForTesting::setHasTransparentBackground( bool transparent) { - layer_tree_host_->setHasTransparentBackground(transparent); + layer_tree_host_->set_has_transparent_background(transparent); } void WebLayerTreeViewImplForTesting::setVisible(bool visible) { - layer_tree_host_->setVisible(visible); + layer_tree_host_->SetVisible(visible); } void WebLayerTreeViewImplForTesting::setPageScaleFactorAndLimits( float page_scale_factor, float minimum, float maximum) { - layer_tree_host_->setPageScaleFactorAndLimits( + layer_tree_host_->SetPageScaleFactorAndLimits( page_scale_factor, minimum, maximum); } @@ -117,41 +117,42 @@ void WebLayerTreeViewImplForTesting::startPageScaleAnimation( double duration_sec) {} void WebLayerTreeViewImplForTesting::setNeedsAnimate() { - layer_tree_host_->setNeedsAnimate(); + layer_tree_host_->SetNeedsAnimate(); } void WebLayerTreeViewImplForTesting::setNeedsRedraw() { - layer_tree_host_->setNeedsRedraw(); + layer_tree_host_->SetNeedsRedraw(); } bool WebLayerTreeViewImplForTesting::commitRequested() const { - return layer_tree_host_->commitRequested(); + return layer_tree_host_->CommitRequested(); } void WebLayerTreeViewImplForTesting::composite() { - layer_tree_host_->composite(); + layer_tree_host_->Composite(); } void WebLayerTreeViewImplForTesting::updateAnimations( double frame_begin_timeSeconds) { base::TimeTicks frame_begin_time = base::TimeTicks::FromInternalValue( frame_begin_timeSeconds * base::Time::kMicrosecondsPerMillisecond); - layer_tree_host_->updateAnimations(frame_begin_time); + layer_tree_host_->UpdateAnimations(frame_begin_time); } void WebLayerTreeViewImplForTesting::didStopFlinging() {} -bool WebLayerTreeViewImplForTesting::compositeAndReadback(void* pixels, - const WebRect& rect) { - return layer_tree_host_->compositeAndReadback(pixels, rect); +bool WebLayerTreeViewImplForTesting::compositeAndReadback( + void* pixels, const WebRect& rect_in_device_viewport) { + return layer_tree_host_->CompositeAndReadback(pixels, + rect_in_device_viewport); } void WebLayerTreeViewImplForTesting::finishAllRendering() { - layer_tree_host_->finishAllRendering(); + layer_tree_host_->FinishAllRendering(); } void WebLayerTreeViewImplForTesting::setDeferCommits(bool defer_commits) { - layer_tree_host_->setDeferCommits(defer_commits); + layer_tree_host_->SetDeferCommits(defer_commits); } void WebLayerTreeViewImplForTesting::renderingStats(WebRenderingStats&) const {} |