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