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

Side by Side Diff: content/browser/android/in_process/synchronous_compositor_impl.cc

Issue 584503005: Make scroll offset type of float in cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: link crbug to TODO 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
« no previous file with comments | « content/browser/android/in_process/synchronous_compositor_impl.h ('k') | ui/gfx/BUILD.gn » ('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 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/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "cc/input/input_handler.h" 9 #include "cc/input/input_handler.h"
10 #include "content/browser/android/in_process/synchronous_compositor_factory_impl .h" 10 #include "content/browser/android/in_process/synchronous_compositor_factory_impl .h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 ++i) { 249 ++i) {
250 rph->OnMessageReceived(**i); 250 rph->OnMessageReceived(**i);
251 } 251 }
252 } 252 }
253 253
254 void SynchronousCompositorImpl::DidActivatePendingTree() { 254 void SynchronousCompositorImpl::DidActivatePendingTree() {
255 if (compositor_client_) 255 if (compositor_client_)
256 compositor_client_->DidUpdateContent(); 256 compositor_client_->DidUpdateContent();
257 } 257 }
258 258
259 gfx::Vector2dF SynchronousCompositorImpl::GetTotalScrollOffset() { 259 gfx::ScrollOffset SynchronousCompositorImpl::GetTotalScrollOffset() {
260 DCHECK(CalledOnValidThread()); 260 DCHECK(CalledOnValidThread());
261 if (compositor_client_) 261 if (compositor_client_) {
262 return compositor_client_->GetTotalRootLayerScrollOffset(); 262 // TODO(miletus): Make GetTotalRootLayerScrollOffset return
263 return gfx::Vector2dF(); 263 // ScrollOffset. crbug.com/414283.
264 return gfx::ScrollOffset(
265 compositor_client_->GetTotalRootLayerScrollOffset());
266 }
267 return gfx::ScrollOffset();
264 } 268 }
265 269
266 bool SynchronousCompositorImpl::IsExternalFlingActive() const { 270 bool SynchronousCompositorImpl::IsExternalFlingActive() const {
267 DCHECK(CalledOnValidThread()); 271 DCHECK(CalledOnValidThread());
268 if (compositor_client_) 272 if (compositor_client_)
269 return compositor_client_->IsExternalFlingActive(); 273 return compositor_client_->IsExternalFlingActive();
270 return false; 274 return false;
271 } 275 }
272 276
273 void SynchronousCompositorImpl::UpdateRootLayerState( 277 void SynchronousCompositorImpl::UpdateRootLayerState(
274 const gfx::Vector2dF& total_scroll_offset, 278 const gfx::ScrollOffset& total_scroll_offset,
275 const gfx::Vector2dF& max_scroll_offset, 279 const gfx::ScrollOffset& max_scroll_offset,
276 const gfx::SizeF& scrollable_size, 280 const gfx::SizeF& scrollable_size,
277 float page_scale_factor, 281 float page_scale_factor,
278 float min_page_scale_factor, 282 float min_page_scale_factor,
279 float max_page_scale_factor) { 283 float max_page_scale_factor) {
280 DCHECK(CalledOnValidThread()); 284 DCHECK(CalledOnValidThread());
281 if (!compositor_client_) 285 if (!compositor_client_)
282 return; 286 return;
283 287
284 compositor_client_->UpdateRootLayerState(total_scroll_offset, 288 // TODO(miletus): Pass in ScrollOffset. crbug.com/414283.
285 max_scroll_offset, 289 compositor_client_->UpdateRootLayerState(
286 scrollable_size, 290 gfx::ScrollOffsetToVector2dF(total_scroll_offset),
287 page_scale_factor, 291 gfx::ScrollOffsetToVector2dF(max_scroll_offset),
288 min_page_scale_factor, 292 scrollable_size,
289 max_page_scale_factor); 293 page_scale_factor,
294 min_page_scale_factor,
295 max_page_scale_factor);
290 } 296 }
291 297
292 // Not using base::NonThreadSafe as we want to enforce a more exacting threading 298 // Not using base::NonThreadSafe as we want to enforce a more exacting threading
293 // requirement: SynchronousCompositorImpl() must only be used on the UI thread. 299 // requirement: SynchronousCompositorImpl() must only be used on the UI thread.
294 bool SynchronousCompositorImpl::CalledOnValidThread() const { 300 bool SynchronousCompositorImpl::CalledOnValidThread() const {
295 return BrowserThread::CurrentlyOn(BrowserThread::UI); 301 return BrowserThread::CurrentlyOn(BrowserThread::UI);
296 } 302 }
297 303
298 // static 304 // static
299 void SynchronousCompositor::SetClientForWebContents( 305 void SynchronousCompositor::SetClientForWebContents(
300 WebContents* contents, 306 WebContents* contents,
301 SynchronousCompositorClient* client) { 307 SynchronousCompositorClient* client) {
302 DCHECK(contents); 308 DCHECK(contents);
303 if (client) { 309 if (client) {
304 g_factory.Get(); // Ensure it's initialized. 310 g_factory.Get(); // Ensure it's initialized.
305 SynchronousCompositorImpl::CreateForWebContents(contents); 311 SynchronousCompositorImpl::CreateForWebContents(contents);
306 } 312 }
307 if (SynchronousCompositorImpl* instance = 313 if (SynchronousCompositorImpl* instance =
308 SynchronousCompositorImpl::FromWebContents(contents)) { 314 SynchronousCompositorImpl::FromWebContents(contents)) {
309 instance->SetClient(client); 315 instance->SetClient(client);
310 } 316 }
311 } 317 }
312 318
313 } // namespace content 319 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/in_process/synchronous_compositor_impl.h ('k') | ui/gfx/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698