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

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

Issue 267783004: Refactoring the way begin frame sources inside scheduler work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Trying an alternative to OnMissedBeginFrames method. Created 6 years, 2 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 | Annotate | Revision Log
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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 227
228 LayerTreeHostImpl::LayerTreeHostImpl( 228 LayerTreeHostImpl::LayerTreeHostImpl(
229 const LayerTreeSettings& settings, 229 const LayerTreeSettings& settings,
230 LayerTreeHostImplClient* client, 230 LayerTreeHostImplClient* client,
231 Proxy* proxy, 231 Proxy* proxy,
232 RenderingStatsInstrumentation* rendering_stats_instrumentation, 232 RenderingStatsInstrumentation* rendering_stats_instrumentation,
233 SharedBitmapManager* manager, 233 SharedBitmapManager* manager,
234 int id) 234 int id)
235 : client_(client), 235 : client_(client),
236 proxy_(proxy), 236 proxy_(proxy),
237 needs_begin_frames_(false),
237 use_gpu_rasterization_(false), 238 use_gpu_rasterization_(false),
238 input_handler_client_(NULL), 239 input_handler_client_(NULL),
239 did_lock_scrolling_layer_(false), 240 did_lock_scrolling_layer_(false),
240 should_bubble_scrolls_(false), 241 should_bubble_scrolls_(false),
241 wheel_scrolling_(false), 242 wheel_scrolling_(false),
242 scroll_affects_scroll_handler_(false), 243 scroll_affects_scroll_handler_(false),
243 scroll_layer_id_when_mouse_over_scrollbar_(0), 244 scroll_layer_id_when_mouse_over_scrollbar_(0),
244 tile_priorities_dirty_(false), 245 tile_priorities_dirty_(false),
245 root_layer_scroll_offset_delegate_(NULL), 246 root_layer_scroll_offset_delegate_(NULL),
246 settings_(settings), 247 settings_(settings),
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1425 } 1426 }
1426 1427
1427 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { 1428 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) {
1428 if (damage_rect.IsEmpty()) 1429 if (damage_rect.IsEmpty())
1429 return; 1430 return;
1430 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); 1431 NotifySwapPromiseMonitorsOfSetNeedsRedraw();
1431 client_->SetNeedsRedrawRectOnImplThread(damage_rect); 1432 client_->SetNeedsRedrawRectOnImplThread(damage_rect);
1432 } 1433 }
1433 1434
1434 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { 1435 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) {
1435 client_->BeginFrame(args); 1436 CallOnBeginFrame(args);
1436 } 1437 }
1437 1438
1438 void LayerTreeHostImpl::DidSwapBuffers() { 1439 void LayerTreeHostImpl::DidSwapBuffers() {
1439 client_->DidSwapBuffersOnImplThread(); 1440 client_->DidSwapBuffersOnImplThread();
1440 } 1441 }
1441 1442
1442 void LayerTreeHostImpl::DidSwapBuffersComplete() { 1443 void LayerTreeHostImpl::DidSwapBuffersComplete() {
1443 client_->DidSwapBuffersCompleteOnImplThread(); 1444 client_->DidSwapBuffersCompleteOnImplThread();
1444 } 1445 }
1445 1446
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 TRACE_EVENT_FLOW_STEP0( 1666 TRACE_EVENT_FLOW_STEP0(
1666 "input", 1667 "input",
1667 "LatencyInfo.Flow", 1668 "LatencyInfo.Flow",
1668 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), 1669 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id),
1669 "SwapBuffers"); 1670 "SwapBuffers");
1670 } 1671 }
1671 renderer_->SwapBuffers(metadata); 1672 renderer_->SwapBuffers(metadata);
1672 return true; 1673 return true;
1673 } 1674 }
1674 1675
1675 void LayerTreeHostImpl::SetNeedsBeginFrame(bool enable) { 1676 bool LayerTreeHostImpl::NeedsBeginFrames() const {
1677 return needs_begin_frames_;
1678 }
1679
1680 void LayerTreeHostImpl::SetNeedsBeginFrames(bool enable) {
1681 needs_begin_frames_ = enable;
1676 if (output_surface_) 1682 if (output_surface_)
1677 output_surface_->SetNeedsBeginFrame(enable); 1683 output_surface_->SetNeedsBeginFrame(enable);
1678 else 1684 else
1679 DCHECK(!enable); 1685 DCHECK(!enable);
1680 } 1686 }
1681 1687
1682 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { 1688 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) {
1683 // Sample the frame time now. This time will be used for updating animations 1689 // Sample the frame time now. This time will be used for updating animations
1684 // when we draw. 1690 // when we draw.
1685 UpdateCurrentBeginFrameArgs(args); 1691 UpdateCurrentBeginFrameArgs(args);
(...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after
3146 // Try to use the current frame time to keep animations non-jittery. But if 3152 // Try to use the current frame time to keep animations non-jittery. But if
3147 // we're not in a frame (because this is during an input event or a delayed 3153 // we're not in a frame (because this is during an input event or a delayed
3148 // task), fall back to physical time. This should still be monotonic. 3154 // task), fall back to physical time. This should still be monotonic.
3149 if (current_begin_frame_args_.IsValid()) 3155 if (current_begin_frame_args_.IsValid())
3150 return current_begin_frame_args_; 3156 return current_begin_frame_args_;
3151 return BeginFrameArgs::Create(gfx::FrameTime::Now(), 3157 return BeginFrameArgs::Create(gfx::FrameTime::Now(),
3152 base::TimeTicks(), 3158 base::TimeTicks(),
3153 BeginFrameArgs::DefaultInterval()); 3159 BeginFrameArgs::DefaultInterval());
3154 } 3160 }
3155 3161
3162 void LayerTreeHostImpl::AsValueInto(base::debug::TracedValue* value) const {
3163 return AsValueWithFrameInto(NULL, value);
3164 }
3165
3156 scoped_refptr<base::debug::ConvertableToTraceFormat> 3166 scoped_refptr<base::debug::ConvertableToTraceFormat>
3157 LayerTreeHostImpl::AsValue() const { 3167 LayerTreeHostImpl::AsValue() const {
3158 return AsValueWithFrame(NULL); 3168 return AsValueWithFrame(NULL);
3159 } 3169 }
3160 3170
3161 scoped_refptr<base::debug::ConvertableToTraceFormat> 3171 scoped_refptr<base::debug::ConvertableToTraceFormat>
3162 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { 3172 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const {
3163 scoped_refptr<base::debug::TracedValue> state = 3173 scoped_refptr<base::debug::TracedValue> state =
3164 new base::debug::TracedValue(); 3174 new base::debug::TracedValue();
3165 AsValueWithFrameInto(frame, state.get()); 3175 AsValueWithFrameInto(frame, state.get());
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
3384 } 3394 }
3385 3395
3386 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3396 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3387 std::vector<PictureLayerImpl*>::iterator it = 3397 std::vector<PictureLayerImpl*>::iterator it =
3388 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3398 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3389 DCHECK(it != picture_layers_.end()); 3399 DCHECK(it != picture_layers_.end());
3390 picture_layers_.erase(it); 3400 picture_layers_.erase(it);
3391 } 3401 }
3392 3402
3393 } // namespace cc 3403 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698