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

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
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 } 196 }
197 197
198 LayerTreeHostImpl::LayerTreeHostImpl( 198 LayerTreeHostImpl::LayerTreeHostImpl(
199 const LayerTreeSettings& settings, 199 const LayerTreeSettings& settings,
200 LayerTreeHostImplClient* client, 200 LayerTreeHostImplClient* client,
201 Proxy* proxy, 201 Proxy* proxy,
202 RenderingStatsInstrumentation* rendering_stats_instrumentation, 202 RenderingStatsInstrumentation* rendering_stats_instrumentation,
203 SharedBitmapManager* shared_bitmap_manager, 203 SharedBitmapManager* shared_bitmap_manager,
204 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, 204 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
205 int id) 205 int id)
206 : BeginFrameSourceMixIn(), 206 : client_(client),
207 client_(client),
208 proxy_(proxy), 207 proxy_(proxy),
209 use_gpu_rasterization_(false), 208 use_gpu_rasterization_(false),
210 input_handler_client_(NULL), 209 input_handler_client_(NULL),
211 did_lock_scrolling_layer_(false), 210 did_lock_scrolling_layer_(false),
212 should_bubble_scrolls_(false), 211 should_bubble_scrolls_(false),
213 wheel_scrolling_(false), 212 wheel_scrolling_(false),
214 scroll_affects_scroll_handler_(false), 213 scroll_affects_scroll_handler_(false),
215 scroll_layer_id_when_mouse_over_scrollbar_(0), 214 scroll_layer_id_when_mouse_over_scrollbar_(0),
216 tile_priorities_dirty_(false), 215 tile_priorities_dirty_(false),
217 root_layer_scroll_offset_delegate_(NULL), 216 root_layer_scroll_offset_delegate_(NULL),
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 resourceless_software_draw_ = resourceless_software_draw; 1336 resourceless_software_draw_ = resourceless_software_draw;
1338 } 1337 }
1339 1338
1340 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { 1339 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) {
1341 if (damage_rect.IsEmpty()) 1340 if (damage_rect.IsEmpty())
1342 return; 1341 return;
1343 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); 1342 NotifySwapPromiseMonitorsOfSetNeedsRedraw();
1344 client_->SetNeedsRedrawRectOnImplThread(damage_rect); 1343 client_->SetNeedsRedrawRectOnImplThread(damage_rect);
1345 } 1344 }
1346 1345
1347 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) {
1348 CallOnBeginFrame(args);
1349 }
1350
1351 void LayerTreeHostImpl::DidSwapBuffers() { 1346 void LayerTreeHostImpl::DidSwapBuffers() {
1352 client_->DidSwapBuffersOnImplThread(); 1347 client_->DidSwapBuffersOnImplThread();
1353 } 1348 }
1354 1349
1355 void LayerTreeHostImpl::DidSwapBuffersComplete() { 1350 void LayerTreeHostImpl::DidSwapBuffersComplete() {
1356 client_->DidSwapBuffersCompleteOnImplThread(); 1351 client_->DidSwapBuffersCompleteOnImplThread();
1357 } 1352 }
1358 1353
1359 void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) { 1354 void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) {
1360 // TODO(piman): We may need to do some validation on this ack before 1355 // TODO(piman): We may need to do some validation on this ack before
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 TRACE_EVENT_FLOW_STEP0( 1574 TRACE_EVENT_FLOW_STEP0(
1580 "input", 1575 "input",
1581 "LatencyInfo.Flow", 1576 "LatencyInfo.Flow",
1582 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), 1577 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id),
1583 "SwapBuffers"); 1578 "SwapBuffers");
1584 } 1579 }
1585 renderer_->SwapBuffers(metadata); 1580 renderer_->SwapBuffers(metadata);
1586 return true; 1581 return true;
1587 } 1582 }
1588 1583
1589 void LayerTreeHostImpl::OnNeedsBeginFramesChange(bool enable) {
1590 if (output_surface_)
1591 output_surface_->SetNeedsBeginFrame(enable);
1592 else
1593 DCHECK(!enable);
1594 }
1595
1596 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { 1584 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) {
1597 // Sample the frame time now. This time will be used for updating animations 1585 // Sample the frame time now. This time will be used for updating animations
1598 // when we draw. 1586 // when we draw.
1599 UpdateCurrentBeginFrameArgs(args); 1587 UpdateCurrentBeginFrameArgs(args);
1600 // Cache the begin impl frame interval 1588 // Cache the begin impl frame interval
1601 begin_impl_frame_interval_ = args.interval; 1589 begin_impl_frame_interval_ = args.interval;
1602 } 1590 }
1603 1591
1604 void LayerTreeHostImpl::UpdateViewportContainerSizes() { 1592 void LayerTreeHostImpl::UpdateViewportContainerSizes() {
1605 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); 1593 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer();
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after
3180 // Try to use the current frame time to keep animations non-jittery. But if 3168 // Try to use the current frame time to keep animations non-jittery. But if
3181 // we're not in a frame (because this is during an input event or a delayed 3169 // we're not in a frame (because this is during an input event or a delayed
3182 // task), fall back to physical time. This should still be monotonic. 3170 // task), fall back to physical time. This should still be monotonic.
3183 if (current_begin_frame_args_.IsValid()) 3171 if (current_begin_frame_args_.IsValid())
3184 return current_begin_frame_args_; 3172 return current_begin_frame_args_;
3185 return BeginFrameArgs::Create(gfx::FrameTime::Now(), 3173 return BeginFrameArgs::Create(gfx::FrameTime::Now(),
3186 base::TimeTicks(), 3174 base::TimeTicks(),
3187 BeginFrameArgs::DefaultInterval()); 3175 BeginFrameArgs::DefaultInterval());
3188 } 3176 }
3189 3177
3190 void LayerTreeHostImpl::AsValueInto(base::debug::TracedValue* value) const {
3191 return AsValueWithFrameInto(NULL, value);
3192 }
3193
3194 scoped_refptr<base::debug::ConvertableToTraceFormat> 3178 scoped_refptr<base::debug::ConvertableToTraceFormat>
3195 LayerTreeHostImpl::AsValue() const { 3179 LayerTreeHostImpl::AsValue() const {
3196 return AsValueWithFrame(NULL); 3180 return AsValueWithFrame(NULL);
3197 } 3181 }
3198 3182
3199 scoped_refptr<base::debug::ConvertableToTraceFormat> 3183 scoped_refptr<base::debug::ConvertableToTraceFormat>
3200 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { 3184 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const {
3201 scoped_refptr<base::debug::TracedValue> state = 3185 scoped_refptr<base::debug::TracedValue> state =
3202 new base::debug::TracedValue(); 3186 new base::debug::TracedValue();
3203 AsValueWithFrameInto(frame, state.get()); 3187 AsValueWithFrameInto(frame, state.get());
3204 return state; 3188 return state;
3205 } 3189 }
3206 3190
3191 void LayerTreeHostImpl::AsValueInto(base::debug::TracedValue* value) const {
3192 return AsValueWithFrameInto(NULL, value);
3193 }
3194
3207 void LayerTreeHostImpl::AsValueWithFrameInto( 3195 void LayerTreeHostImpl::AsValueWithFrameInto(
3208 FrameData* frame, 3196 FrameData* frame,
3209 base::debug::TracedValue* state) const { 3197 base::debug::TracedValue* state) const {
3210 if (this->pending_tree_) { 3198 if (this->pending_tree_) {
3211 state->BeginDictionary("activation_state"); 3199 state->BeginDictionary("activation_state");
3212 ActivationStateAsValueInto(state); 3200 ActivationStateAsValueInto(state);
3213 state->EndDictionary(); 3201 state->EndDictionary();
3214 } 3202 }
3215 state->BeginDictionary("device_viewport_size"); 3203 state->BeginDictionary("device_viewport_size");
3216 MathUtil::AddToTracedValue(device_viewport_size_, state); 3204 MathUtil::AddToTracedValue(device_viewport_size_, state);
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
3422 } 3410 }
3423 3411
3424 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { 3412 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) {
3425 std::vector<PictureLayerImpl*>::iterator it = 3413 std::vector<PictureLayerImpl*>::iterator it =
3426 std::find(picture_layers_.begin(), picture_layers_.end(), layer); 3414 std::find(picture_layers_.begin(), picture_layers_.end(), layer);
3427 DCHECK(it != picture_layers_.end()); 3415 DCHECK(it != picture_layers_.end());
3428 picture_layers_.erase(it); 3416 picture_layers_.erase(it);
3429 } 3417 }
3430 3418
3431 } // namespace cc 3419 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698