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

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 377013002: android: Use UIResource for overscroll glow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments. moved resource loading to its own class. Created 6 years, 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer_host/compositor_impl_android.h" 5 #include "content/browser/renderer_host/compositor_impl_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 needs_composite_(false), 199 needs_composite_(false),
200 needs_animate_(false), 200 needs_animate_(false),
201 will_composite_immediately_(false), 201 will_composite_immediately_(false),
202 composite_on_vsync_trigger_(DO_NOT_COMPOSITE), 202 composite_on_vsync_trigger_(DO_NOT_COMPOSITE),
203 pending_swapbuffers_(0U), 203 pending_swapbuffers_(0U),
204 weak_factory_(this) { 204 weak_factory_(this) {
205 DCHECK(client); 205 DCHECK(client);
206 DCHECK(root_window); 206 DCHECK(root_window);
207 ImageTransportFactoryAndroid::AddObserver(this); 207 ImageTransportFactoryAndroid::AddObserver(this);
208 root_window->AttachCompositor(this); 208 root_window->AttachCompositor(this);
209 system_ui_resource_manager_.SetUIResourceProvider(&ui_resource_provider_);
209 } 210 }
210 211
211 CompositorImpl::~CompositorImpl() { 212 CompositorImpl::~CompositorImpl() {
212 root_window_->DetachCompositor(); 213 root_window_->DetachCompositor();
213 ImageTransportFactoryAndroid::RemoveObserver(this); 214 ImageTransportFactoryAndroid::RemoveObserver(this);
214 // Clean-up any surface references. 215 // Clean-up any surface references.
215 SetSurface(NULL); 216 SetSurface(NULL);
216 } 217 }
217 218
218 void CompositorImpl::PostComposite(CompositingTrigger trigger) { 219 void CompositorImpl::PostComposite(CompositingTrigger trigger) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 pending_swapbuffers_++; 330 pending_swapbuffers_++;
330 331
331 // Need to track vsync to avoid compositing more than once per frame. 332 // Need to track vsync to avoid compositing more than once per frame.
332 root_window_->RequestVSyncUpdate(); 333 root_window_->RequestVSyncUpdate();
333 } 334 }
334 335
335 void CompositorImpl::OnGpuChannelEstablished() { 336 void CompositorImpl::OnGpuChannelEstablished() {
336 ScheduleComposite(); 337 ScheduleComposite();
337 } 338 }
338 339
339 UIResourceProvider& CompositorImpl::GetUIResourceProvider() { 340 ui::UIResourceProvider& CompositorImpl::GetUIResourceProvider() {
340 return ui_resource_provider_; 341 return ui_resource_provider_;
341 } 342 }
342 343
344 ui::SystemUIResourceManager& CompositorImpl::GetSystemUIResourceManager() {
345 return system_ui_resource_manager_;
346 }
347
343 void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) { 348 void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) {
344 root_layer_->RemoveAllChildren(); 349 root_layer_->RemoveAllChildren();
345 if (root_layer) 350 if (root_layer)
346 root_layer_->AddChild(root_layer); 351 root_layer_->AddChild(root_layer);
347 } 352 }
348 353
349 void CompositorImpl::SetWindowSurface(ANativeWindow* window) { 354 void CompositorImpl::SetWindowSurface(ANativeWindow* window) {
350 GpuSurfaceTracker* tracker = GpuSurfaceTracker::Get(); 355 GpuSurfaceTracker* tracker = GpuSurfaceTracker::Get();
351 356
352 if (window_) { 357 if (window_) {
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 } 622 }
618 623
619 void CompositorImpl::SetNeedsAnimate() { 624 void CompositorImpl::SetNeedsAnimate() {
620 if (!host_) 625 if (!host_)
621 return; 626 return;
622 627
623 host_->SetNeedsAnimate(); 628 host_->SetNeedsAnimate();
624 } 629 }
625 630
626 } // namespace content 631 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698