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

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

Issue 619843002: cc: Make separate interface for BeginFrame ipc from OutputSurface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 261 }
262 262
263 LayerTreeHostImpl::LayerTreeHostImpl( 263 LayerTreeHostImpl::LayerTreeHostImpl(
264 const LayerTreeSettings& settings, 264 const LayerTreeSettings& settings,
265 LayerTreeHostImplClient* client, 265 LayerTreeHostImplClient* client,
266 Proxy* proxy, 266 Proxy* proxy,
267 RenderingStatsInstrumentation* rendering_stats_instrumentation, 267 RenderingStatsInstrumentation* rendering_stats_instrumentation,
268 SharedBitmapManager* shared_bitmap_manager, 268 SharedBitmapManager* shared_bitmap_manager,
269 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 269 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
270 int id) 270 int id)
271 : BeginFrameSourceMixIn(), 271 : client_(client),
272 client_(client),
273 proxy_(proxy), 272 proxy_(proxy),
274 use_gpu_rasterization_(false), 273 use_gpu_rasterization_(false),
275 input_handler_client_(NULL), 274 input_handler_client_(NULL),
276 did_lock_scrolling_layer_(false), 275 did_lock_scrolling_layer_(false),
277 should_bubble_scrolls_(false), 276 should_bubble_scrolls_(false),
278 wheel_scrolling_(false), 277 wheel_scrolling_(false),
279 scroll_affects_scroll_handler_(false), 278 scroll_affects_scroll_handler_(false),
280 scroll_layer_id_when_mouse_over_scrollbar_(0), 279 scroll_layer_id_when_mouse_over_scrollbar_(0),
281 tile_priorities_dirty_(false), 280 tile_priorities_dirty_(false),
282 root_layer_scroll_offset_delegate_(NULL), 281 root_layer_scroll_offset_delegate_(NULL),
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 resourceless_software_draw_ = resourceless_software_draw; 1426 resourceless_software_draw_ = resourceless_software_draw;
1428 } 1427 }
1429 1428
1430 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { 1429 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) {
1431 if (damage_rect.IsEmpty()) 1430 if (damage_rect.IsEmpty())
1432 return; 1431 return;
1433 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); 1432 NotifySwapPromiseMonitorsOfSetNeedsRedraw();
1434 client_->SetNeedsRedrawRectOnImplThread(damage_rect); 1433 client_->SetNeedsRedrawRectOnImplThread(damage_rect);
1435 } 1434 }
1436 1435
1437 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) {
1438 CallOnBeginFrame(args);
1439 }
1440
1441 void LayerTreeHostImpl::DidSwapBuffers() { 1436 void LayerTreeHostImpl::DidSwapBuffers() {
1442 client_->DidSwapBuffersOnImplThread(); 1437 client_->DidSwapBuffersOnImplThread();
1443 } 1438 }
1444 1439
1445 void LayerTreeHostImpl::DidSwapBuffersComplete() { 1440 void LayerTreeHostImpl::DidSwapBuffersComplete() {
1446 client_->DidSwapBuffersCompleteOnImplThread(); 1441 client_->DidSwapBuffersCompleteOnImplThread();
1447 } 1442 }
1448 1443
1449 void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) { 1444 void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) {
1450 // TODO(piman): We may need to do some validation on this ack before 1445 // TODO(piman): We may need to do some validation on this ack before
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 TRACE_EVENT_FLOW_STEP0( 1663 TRACE_EVENT_FLOW_STEP0(
1669 "input", 1664 "input",
1670 "LatencyInfo.Flow", 1665 "LatencyInfo.Flow",
1671 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), 1666 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id),
1672 "SwapBuffers"); 1667 "SwapBuffers");
1673 } 1668 }
1674 renderer_->SwapBuffers(metadata); 1669 renderer_->SwapBuffers(metadata);
1675 return true; 1670 return true;
1676 } 1671 }
1677 1672
1678 void LayerTreeHostImpl::OnNeedsBeginFramesChange(bool enable) {
1679 if (output_surface_)
1680 output_surface_->SetNeedsBeginFrame(enable);
1681 else
1682 DCHECK(!enable);
1683 }
1684
1685 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { 1673 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) {
1686 // Sample the frame time now. This time will be used for updating animations 1674 // Sample the frame time now. This time will be used for updating animations
1687 // when we draw. 1675 // when we draw.
1688 UpdateCurrentBeginFrameArgs(args); 1676 UpdateCurrentBeginFrameArgs(args);
1689 // Cache the begin impl frame interval 1677 // Cache the begin impl frame interval
1690 begin_impl_frame_interval_ = args.interval; 1678 begin_impl_frame_interval_ = args.interval;
1691 } 1679 }
1692 1680
1693 void LayerTreeHostImpl::UpdateViewportContainerSizes() { 1681 void LayerTreeHostImpl::UpdateViewportContainerSizes() {
1694 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); 1682 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer();
(...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after
3238 // Try to use the current frame time to keep animations non-jittery. But if 3226 // Try to use the current frame time to keep animations non-jittery. But if
3239 // we're not in a frame (because this is during an input event or a delayed 3227 // we're not in a frame (because this is during an input event or a delayed
3240 // task), fall back to physical time. This should still be monotonic. 3228 // task), fall back to physical time. This should still be monotonic.
3241 if (current_begin_frame_args_.IsValid()) 3229 if (current_begin_frame_args_.IsValid())
3242 return current_begin_frame_args_; 3230 return current_begin_frame_args_;
3243 return BeginFrameArgs::Create(gfx::FrameTime::Now(), 3231 return BeginFrameArgs::Create(gfx::FrameTime::Now(),
3244 base::TimeTicks(), 3232 base::TimeTicks(),
3245 BeginFrameArgs::DefaultInterval()); 3233 BeginFrameArgs::DefaultInterval());
3246 } 3234 }
3247 3235
3248 void LayerTreeHostImpl::AsValueInto(base::debug::TracedValue* value) const {
3249 return AsValueWithFrameInto(NULL, value);
3250 }
3251
3252 scoped_refptr<base::debug::ConvertableToTraceFormat> 3236 scoped_refptr<base::debug::ConvertableToTraceFormat>
3253 LayerTreeHostImpl::AsValue() const { 3237 LayerTreeHostImpl::AsValue() const {
3254 return AsValueWithFrame(NULL); 3238 return AsValueWithFrame(NULL);
3255 } 3239 }
3256 3240
3257 scoped_refptr<base::debug::ConvertableToTraceFormat> 3241 scoped_refptr<base::debug::ConvertableToTraceFormat>
3258 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { 3242 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const {
3259 scoped_refptr<base::debug::TracedValue> state = 3243 scoped_refptr<base::debug::TracedValue> state =
3260 new base::debug::TracedValue(); 3244 new base::debug::TracedValue();
3261 AsValueWithFrameInto(frame, state.get()); 3245 AsValueWithFrameInto(frame, state.get());
3262 return state; 3246 return state;
3263 } 3247 }
3264 3248
3249 void LayerTreeHostImpl::AsValueInto(base::debug::TracedValue* value) const {
3250 return AsValueWithFrameInto(NULL, value);
3251 }
3252
3265 void LayerTreeHostImpl::AsValueWithFrameInto( 3253 void LayerTreeHostImpl::AsValueWithFrameInto(
3266 FrameData* frame, 3254 FrameData* frame,
3267 base::debug::TracedValue* state) const { 3255 base::debug::TracedValue* state) const {
3268 if (this->pending_tree_) { 3256 if (this->pending_tree_) {
3269 state->BeginDictionary("activation_state"); 3257 state->BeginDictionary("activation_state");
3270 ActivationStateAsValueInto(state); 3258 ActivationStateAsValueInto(state);
3271 state->EndDictionary(); 3259 state->EndDictionary();
3272 } 3260 }
3273 state->BeginDictionary("device_viewport_size"); 3261 state->BeginDictionary("device_viewport_size");
3274 MathUtil::AddToTracedValue(device_viewport_size_, state); 3262 MathUtil::AddToTracedValue(device_viewport_size_, state);
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
3480 } 3468 }
3481 3469
3482 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3470 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3483 std::vector<PictureLayerImpl*>::iterator it = 3471 std::vector<PictureLayerImpl*>::iterator it =
3484 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3472 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3485 DCHECK(it != picture_layers_.end()); 3473 DCHECK(it != picture_layers_.end());
3486 picture_layers_.erase(it); 3474 picture_layers_.erase(it);
3487 } 3475 }
3488 3476
3489 } // namespace cc 3477 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698