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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 158 } |
159 | 159 |
160 // static | 160 // static |
161 bool CompositorImpl::IsInitialized() { | 161 bool CompositorImpl::IsInitialized() { |
162 return g_initialized; | 162 return g_initialized; |
163 } | 163 } |
164 | 164 |
165 CompositorImpl::CompositorImpl(CompositorClient* client, | 165 CompositorImpl::CompositorImpl(CompositorClient* client, |
166 gfx::NativeWindow root_window) | 166 gfx::NativeWindow root_window) |
167 : root_layer_(cc::Layer::Create()), | 167 : root_layer_(cc::Layer::Create()), |
| 168 resource_manager_(&ui_resource_provider_), |
168 surface_id_allocator_( | 169 surface_id_allocator_( |
169 new cc::SurfaceIdAllocator(++g_surface_id_namespace)), | 170 new cc::SurfaceIdAllocator(++g_surface_id_namespace)), |
170 has_transparent_background_(false), | 171 has_transparent_background_(false), |
171 device_scale_factor_(1), | 172 device_scale_factor_(1), |
172 window_(NULL), | 173 window_(NULL), |
173 surface_id_(0), | 174 surface_id_(0), |
174 client_(client), | 175 client_(client), |
175 root_window_(root_window), | 176 root_window_(root_window), |
176 did_post_swapbuffers_(false), | 177 did_post_swapbuffers_(false), |
177 ignore_schedule_composite_(false), | 178 ignore_schedule_composite_(false), |
178 needs_composite_(false), | 179 needs_composite_(false), |
179 needs_animate_(false), | 180 needs_animate_(false), |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 pending_swapbuffers_++; | 316 pending_swapbuffers_++; |
316 | 317 |
317 // Need to track vsync to avoid compositing more than once per frame. | 318 // Need to track vsync to avoid compositing more than once per frame. |
318 root_window_->RequestVSyncUpdate(); | 319 root_window_->RequestVSyncUpdate(); |
319 } | 320 } |
320 | 321 |
321 UIResourceProvider& CompositorImpl::GetUIResourceProvider() { | 322 UIResourceProvider& CompositorImpl::GetUIResourceProvider() { |
322 return ui_resource_provider_; | 323 return ui_resource_provider_; |
323 } | 324 } |
324 | 325 |
| 326 ui::ResourceManager& CompositorImpl::GetResourceManager() { |
| 327 return resource_manager_; |
| 328 } |
| 329 |
325 ui::SystemUIResourceManager& CompositorImpl::GetSystemUIResourceManager() { | 330 ui::SystemUIResourceManager& CompositorImpl::GetSystemUIResourceManager() { |
326 return ui_resource_provider_.GetSystemUIResourceManager(); | 331 return ui_resource_provider_.GetSystemUIResourceManager(); |
327 } | 332 } |
328 | 333 |
329 void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) { | 334 void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) { |
330 if (subroot_layer_.get()) { | 335 if (subroot_layer_.get()) { |
331 subroot_layer_->RemoveFromParent(); | 336 subroot_layer_->RemoveFromParent(); |
332 subroot_layer_ = NULL; | 337 subroot_layer_ = NULL; |
333 } | 338 } |
334 if (root_layer.get()) { | 339 if (root_layer.get()) { |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 } | 675 } |
671 | 676 |
672 void CompositorImpl::SetNeedsAnimate() { | 677 void CompositorImpl::SetNeedsAnimate() { |
673 if (!host_) | 678 if (!host_) |
674 return; | 679 return; |
675 | 680 |
676 host_->SetNeedsAnimate(); | 681 host_->SetNeedsAnimate(); |
677 } | 682 } |
678 | 683 |
679 } // namespace content | 684 } // namespace content |
OLD | NEW |