OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/android/in_process/synchronous_compositor_impl.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_impl.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
68 | 68 |
69 SynchronousCompositorImpl::SynchronousCompositorImpl(WebContents* contents) | 69 SynchronousCompositorImpl::SynchronousCompositorImpl(WebContents* contents) |
70 : compositor_client_(NULL), | 70 : compositor_client_(NULL), |
71 output_surface_(NULL), | 71 output_surface_(NULL), |
72 begin_frame_source_(nullptr), | 72 begin_frame_source_(nullptr), |
73 contents_(contents), | 73 contents_(contents), |
74 routing_id_(contents->GetRoutingID()), | 74 routing_id_(contents->GetRoutingID()), |
75 input_handler_(NULL), | 75 input_handler_(NULL), |
76 invoking_composite_(false), | 76 invoking_composite_(false), |
| 77 block_updates_(false), |
77 weak_ptr_factory_(this) { | 78 weak_ptr_factory_(this) { |
78 DCHECK(contents); | 79 DCHECK(contents); |
79 DCHECK_NE(routing_id_, MSG_ROUTING_NONE); | 80 DCHECK_NE(routing_id_, MSG_ROUTING_NONE); |
80 SynchronousCompositorRegistry::GetInstance()->RegisterCompositor(routing_id_, | 81 SynchronousCompositorRegistry::GetInstance()->RegisterCompositor(routing_id_, |
81 this); | 82 this); |
82 } | 83 } |
83 | 84 |
84 SynchronousCompositorImpl::~SynchronousCompositorImpl() { | 85 SynchronousCompositorImpl::~SynchronousCompositorImpl() { |
85 SynchronousCompositorRegistry::GetInstance()->UnregisterCompositor( | 86 SynchronousCompositorRegistry::GetInstance()->UnregisterCompositor( |
86 routing_id_, this); | 87 routing_id_, this); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 return gfx::ScrollOffset(); | 326 return gfx::ScrollOffset(); |
326 } | 327 } |
327 | 328 |
328 bool SynchronousCompositorImpl::IsExternalFlingActive() const { | 329 bool SynchronousCompositorImpl::IsExternalFlingActive() const { |
329 DCHECK(CalledOnValidThread()); | 330 DCHECK(CalledOnValidThread()); |
330 if (compositor_client_) | 331 if (compositor_client_) |
331 return compositor_client_->IsExternalFlingActive(); | 332 return compositor_client_->IsExternalFlingActive(); |
332 return false; | 333 return false; |
333 } | 334 } |
334 | 335 |
| 336 void SynchronousCompositorImpl::SetBlockUpdates(bool block_updates) { |
| 337 block_updates_ = block_updates; |
| 338 } |
| 339 |
335 void SynchronousCompositorImpl::UpdateRootLayerState( | 340 void SynchronousCompositorImpl::UpdateRootLayerState( |
336 const gfx::ScrollOffset& total_scroll_offset, | 341 const gfx::ScrollOffset& total_scroll_offset, |
337 const gfx::ScrollOffset& max_scroll_offset, | 342 const gfx::ScrollOffset& max_scroll_offset, |
338 const gfx::SizeF& scrollable_size, | 343 const gfx::SizeF& scrollable_size, |
339 float page_scale_factor, | 344 float page_scale_factor, |
340 float min_page_scale_factor, | 345 float min_page_scale_factor, |
341 float max_page_scale_factor) { | 346 float max_page_scale_factor) { |
342 DCHECK(CalledOnValidThread()); | 347 DCHECK(CalledOnValidThread()); |
343 if (!compositor_client_) | 348 if (!compositor_client_) |
344 return; | 349 return; |
(...skipping 23 matching lines...) Expand all Loading... |
368 g_factory.Get(); // Ensure it's initialized. | 373 g_factory.Get(); // Ensure it's initialized. |
369 SynchronousCompositorImpl::CreateForWebContents(contents); | 374 SynchronousCompositorImpl::CreateForWebContents(contents); |
370 } | 375 } |
371 SynchronousCompositorImpl* instance = | 376 SynchronousCompositorImpl* instance = |
372 SynchronousCompositorImpl::FromWebContents(contents); | 377 SynchronousCompositorImpl::FromWebContents(contents); |
373 DCHECK(instance); | 378 DCHECK(instance); |
374 instance->SetClient(client); | 379 instance->SetClient(client); |
375 } | 380 } |
376 | 381 |
377 } // namespace content | 382 } // namespace content |
OLD | NEW |