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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 221833009: cc: Move scheduling logic out of OutputSurface (Closed) Base URL: http://git.chromium.org/chromium/src.git@swapAck2Sched11
Patch Set: Add OutputSurface::SetNeedsRedrawRect back Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), 1504 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id),
1505 "SwapBuffers"); 1505 "SwapBuffers");
1506 } 1506 }
1507 renderer_->SwapBuffers(metadata); 1507 renderer_->SwapBuffers(metadata);
1508 return true; 1508 return true;
1509 } 1509 }
1510 1510
1511 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) { 1511 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) {
1512 if (output_surface_) 1512 if (output_surface_)
1513 output_surface_->SetNeedsBeginFrame(enable); 1513 output_surface_->SetNeedsBeginFrame(enable);
1514 else
1515 DCHECK(!enable);
1514 } 1516 }
1515 1517
1516 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { 1518 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) {
1517 // Sample the frame time now. This time will be used for updating animations 1519 // Sample the frame time now. This time will be used for updating animations
1518 // when we draw. 1520 // when we draw.
1519 UpdateCurrentFrameTime(); 1521 UpdateCurrentFrameTime();
1520 } 1522 }
1521 1523
1522 gfx::SizeF LayerTreeHostImpl::ComputeInnerViewportContainerSize() const { 1524 gfx::SizeF LayerTreeHostImpl::ComputeInnerViewportContainerSize() const {
1523 gfx::SizeF dip_size = 1525 gfx::SizeF dip_size =
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 return false; 1895 return false;
1894 1896
1895 if (settings_.impl_side_painting) { 1897 if (settings_.impl_side_painting) {
1896 CreateAndSetTileManager( 1898 CreateAndSetTileManager(
1897 resource_provider.get(), 1899 resource_provider.get(),
1898 output_surface->context_provider().get(), 1900 output_surface->context_provider().get(),
1899 GetRendererCapabilities().using_map_image, 1901 GetRendererCapabilities().using_map_image,
1900 GetRendererCapabilities().allow_rasterize_on_demand); 1902 GetRendererCapabilities().allow_rasterize_on_demand);
1901 } 1903 }
1902 1904
1903 if (!settings_.throttle_frame_production) { 1905 // Initialize vsync parameters to sane values.
1904 // Disable VSync 1906 const base::TimeDelta display_refresh_interval =
1905 output_surface->SetThrottleFrameProduction(false); 1907 base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond /
1906 } else if (!settings_.begin_impl_frame_scheduling_enabled) { 1908 settings_.refresh_rate);
1907 // Setup BeginFrameEmulation if it's not supported natively 1909 CommitVSyncParameters(base::TimeTicks(), display_refresh_interval);
1908 const base::TimeDelta display_refresh_interval =
1909 base::TimeDelta::FromMicroseconds(
1910 base::Time::kMicrosecondsPerSecond /
1911 settings_.refresh_rate);
1912 1910
1913 output_surface->InitializeBeginFrameEmulation( 1911 // TODO(brianderson): Don't use a hard-coded parent draw time.
1914 proxy_->ImplThreadTaskRunner(), 1912 base::TimeDelta parent_draw_time =
1915 display_refresh_interval); 1913 output_surface->capabilities().adjust_deadline_for_parent
1916 } 1914 ? BeginFrameArgs::DefaultDeadlineAdjustment()
1915 : base::TimeDelta();
1916 client_->SetEstimatedParentDrawTime(parent_draw_time);
1917 1917
1918 int max_frames_pending = 1918 int max_frames_pending =
1919 output_surface->capabilities().max_frames_pending; 1919 output_surface->capabilities().max_frames_pending;
1920 if (max_frames_pending <= 0) 1920 if (max_frames_pending <= 0)
1921 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; 1921 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING;
1922 client_->SetMaxSwapsPendingOnImplThread(max_frames_pending); 1922 client_->SetMaxSwapsPendingOnImplThread(max_frames_pending);
1923 1923
1924 resource_provider_ = resource_provider.Pass(); 1924 resource_provider_ = resource_provider.Pass();
1925 output_surface_ = output_surface.Pass(); 1925 output_surface_ = output_surface.Pass();
1926 1926
1927 client_->OnCanDrawStateChanged(CanDraw()); 1927 client_->OnCanDrawStateChanged(CanDraw());
1928 1928
1929 return true; 1929 return true;
1930 } 1930 }
1931 1931
1932 void LayerTreeHostImpl::CommitVSyncParameters(base::TimeTicks timebase,
1933 base::TimeDelta interval) {
1934 client_->CommitVSyncParameters(timebase, interval);
1935 }
1936
1932 bool LayerTreeHostImpl::DeferredInitialize( 1937 bool LayerTreeHostImpl::DeferredInitialize(
1933 scoped_refptr<ContextProvider> offscreen_context_provider) { 1938 scoped_refptr<ContextProvider> offscreen_context_provider) {
1934 DCHECK(output_surface_->capabilities().deferred_gl_initialization); 1939 DCHECK(output_surface_->capabilities().deferred_gl_initialization);
1935 DCHECK(settings_.impl_side_painting); 1940 DCHECK(settings_.impl_side_painting);
1936 DCHECK(output_surface_->context_provider()); 1941 DCHECK(output_surface_->context_provider());
1937 1942
1938 ReleaseTreeResources(); 1943 ReleaseTreeResources();
1939 renderer_.reset(); 1944 renderer_.reset();
1940 1945
1941 bool resource_provider_success = resource_provider_->InitializeGL(); 1946 bool resource_provider_success = resource_provider_->InitializeGL();
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
3122 swap_promise_monitor_.erase(monitor); 3127 swap_promise_monitor_.erase(monitor);
3123 } 3128 }
3124 3129
3125 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { 3130 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() {
3126 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 3131 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
3127 for (; it != swap_promise_monitor_.end(); it++) 3132 for (; it != swap_promise_monitor_.end(); it++)
3128 (*it)->OnSetNeedsRedrawOnImpl(); 3133 (*it)->OnSetNeedsRedrawOnImpl();
3129 } 3134 }
3130 3135
3131 } // namespace cc 3136 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698