OLD | NEW |
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 needs_composite_(false), | 183 needs_composite_(false), |
184 needs_animate_(false), | 184 needs_animate_(false), |
185 will_composite_immediately_(false), | 185 will_composite_immediately_(false), |
186 composite_on_vsync_trigger_(DO_NOT_COMPOSITE), | 186 composite_on_vsync_trigger_(DO_NOT_COMPOSITE), |
187 pending_swapbuffers_(0U), | 187 pending_swapbuffers_(0U), |
188 weak_factory_(this) { | 188 weak_factory_(this) { |
189 DCHECK(client); | 189 DCHECK(client); |
190 DCHECK(root_window); | 190 DCHECK(root_window); |
191 ImageTransportFactoryAndroid::AddObserver(this); | 191 ImageTransportFactoryAndroid::AddObserver(this); |
192 root_window->AttachCompositor(this); | 192 root_window->AttachCompositor(this); |
| 193 resource_manager_.reset( |
| 194 new content::ResourceManagerImpl(&ui_resource_provider_)); |
193 } | 195 } |
194 | 196 |
195 CompositorImpl::~CompositorImpl() { | 197 CompositorImpl::~CompositorImpl() { |
| 198 resource_manager_.reset(nullptr); |
196 root_window_->DetachCompositor(); | 199 root_window_->DetachCompositor(); |
197 ImageTransportFactoryAndroid::RemoveObserver(this); | 200 ImageTransportFactoryAndroid::RemoveObserver(this); |
198 // Clean-up any surface references. | 201 // Clean-up any surface references. |
199 SetSurface(NULL); | 202 SetSurface(NULL); |
200 } | 203 } |
201 | 204 |
202 void CompositorImpl::PostComposite(CompositingTrigger trigger) { | 205 void CompositorImpl::PostComposite(CompositingTrigger trigger) { |
203 DCHECK(needs_composite_); | 206 DCHECK(needs_composite_); |
204 DCHECK(trigger == COMPOSITE_IMMEDIATELY || trigger == COMPOSITE_EVENTUALLY); | 207 DCHECK(trigger == COMPOSITE_IMMEDIATELY || trigger == COMPOSITE_EVENTUALLY); |
205 | 208 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 pending_swapbuffers_++; | 314 pending_swapbuffers_++; |
312 | 315 |
313 // Need to track vsync to avoid compositing more than once per frame. | 316 // Need to track vsync to avoid compositing more than once per frame. |
314 root_window_->RequestVSyncUpdate(); | 317 root_window_->RequestVSyncUpdate(); |
315 } | 318 } |
316 | 319 |
317 UIResourceProvider& CompositorImpl::GetUIResourceProvider() { | 320 UIResourceProvider& CompositorImpl::GetUIResourceProvider() { |
318 return ui_resource_provider_; | 321 return ui_resource_provider_; |
319 } | 322 } |
320 | 323 |
| 324 ResourceManager* CompositorImpl::GetResourceManager() { |
| 325 return resource_manager_.get(); |
| 326 } |
| 327 |
321 ui::SystemUIResourceManager& CompositorImpl::GetSystemUIResourceManager() { | 328 ui::SystemUIResourceManager& CompositorImpl::GetSystemUIResourceManager() { |
322 return ui_resource_provider_.GetSystemUIResourceManager(); | 329 return ui_resource_provider_.GetSystemUIResourceManager(); |
323 } | 330 } |
324 | 331 |
325 void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) { | 332 void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) { |
326 if (subroot_layer_.get()) { | 333 if (subroot_layer_.get()) { |
327 subroot_layer_->RemoveFromParent(); | 334 subroot_layer_->RemoveFromParent(); |
328 subroot_layer_ = NULL; | 335 subroot_layer_ = NULL; |
329 } | 336 } |
330 if (root_layer.get()) { | 337 if (root_layer.get()) { |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 } | 676 } |
670 | 677 |
671 void CompositorImpl::SetNeedsAnimate() { | 678 void CompositorImpl::SetNeedsAnimate() { |
672 if (!host_) | 679 if (!host_) |
673 return; | 680 return; |
674 | 681 |
675 host_->SetNeedsAnimate(); | 682 host_->SetNeedsAnimate(); |
676 } | 683 } |
677 | 684 |
678 } // namespace content | 685 } // namespace content |
OLD | NEW |