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

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: blow up the patchset :( 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
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 return gfx::ScrollOffset(
danakj 2014/09/27 00:00:44 TODO that GetTotalRootLayerScrollOffset should ret
Yufeng Shen (Slow to review) 2014/09/29 19:27:34 Done.
263 return gfx::Vector2dF(); 263 compositor_client_->GetTotalRootLayerScrollOffset());
264 }
265 return gfx::ScrollOffset();
264 } 266 }
265 267
266 bool SynchronousCompositorImpl::IsExternalFlingActive() const { 268 bool SynchronousCompositorImpl::IsExternalFlingActive() const {
267 DCHECK(CalledOnValidThread()); 269 DCHECK(CalledOnValidThread());
268 if (compositor_client_) 270 if (compositor_client_)
269 return compositor_client_->IsExternalFlingActive(); 271 return compositor_client_->IsExternalFlingActive();
270 return false; 272 return false;
271 } 273 }
272 274
273 void SynchronousCompositorImpl::UpdateRootLayerState( 275 void SynchronousCompositorImpl::UpdateRootLayerState(
274 const gfx::Vector2dF& total_scroll_offset, 276 const gfx::ScrollOffset& total_scroll_offset,
275 const gfx::Vector2dF& max_scroll_offset, 277 const gfx::ScrollOffset& max_scroll_offset,
276 const gfx::SizeF& scrollable_size, 278 const gfx::SizeF& scrollable_size,
277 float page_scale_factor, 279 float page_scale_factor,
278 float min_page_scale_factor, 280 float min_page_scale_factor,
279 float max_page_scale_factor) { 281 float max_page_scale_factor) {
280 DCHECK(CalledOnValidThread()); 282 DCHECK(CalledOnValidThread());
281 if (!compositor_client_) 283 if (!compositor_client_)
282 return; 284 return;
283 285
284 compositor_client_->UpdateRootLayerState(total_scroll_offset, 286 compositor_client_->UpdateRootLayerState(
danakj 2014/09/27 00:00:44 TODO that we should pass ScrollOffsets here
Yufeng Shen (Slow to review) 2014/09/29 19:27:33 Done.
285 max_scroll_offset, 287 gfx::ScrollOffsetToVector2dF(total_scroll_offset),
286 scrollable_size, 288 gfx::ScrollOffsetToVector2dF(max_scroll_offset),
287 page_scale_factor, 289 scrollable_size,
288 min_page_scale_factor, 290 page_scale_factor,
289 max_page_scale_factor); 291 min_page_scale_factor,
292 max_page_scale_factor);
290 } 293 }
291 294
292 // Not using base::NonThreadSafe as we want to enforce a more exacting threading 295 // Not using base::NonThreadSafe as we want to enforce a more exacting threading
293 // requirement: SynchronousCompositorImpl() must only be used on the UI thread. 296 // requirement: SynchronousCompositorImpl() must only be used on the UI thread.
294 bool SynchronousCompositorImpl::CalledOnValidThread() const { 297 bool SynchronousCompositorImpl::CalledOnValidThread() const {
295 return BrowserThread::CurrentlyOn(BrowserThread::UI); 298 return BrowserThread::CurrentlyOn(BrowserThread::UI);
296 } 299 }
297 300
298 // static 301 // static
299 void SynchronousCompositor::SetClientForWebContents( 302 void SynchronousCompositor::SetClientForWebContents(
300 WebContents* contents, 303 WebContents* contents,
301 SynchronousCompositorClient* client) { 304 SynchronousCompositorClient* client) {
302 DCHECK(contents); 305 DCHECK(contents);
303 if (client) { 306 if (client) {
304 g_factory.Get(); // Ensure it's initialized. 307 g_factory.Get(); // Ensure it's initialized.
305 SynchronousCompositorImpl::CreateForWebContents(contents); 308 SynchronousCompositorImpl::CreateForWebContents(contents);
306 } 309 }
307 if (SynchronousCompositorImpl* instance = 310 if (SynchronousCompositorImpl* instance =
308 SynchronousCompositorImpl::FromWebContents(contents)) { 311 SynchronousCompositorImpl::FromWebContents(contents)) {
309 instance->SetClient(client); 312 instance->SetClient(client);
310 } 313 }
311 } 314 }
312 315
313 } // namespace content 316 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698